#javascript
Вопрос:
Код в index.html
:
lt;script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.8/angular.min.js"gt;lt;/scriptgt;
Код в компоненте, из которого вызывается paypal selpasarela.componente.html
:
lt;div style="max-width: 30vw; margin: auto; color: black; min-height: 10px; min-width: 10px;" id="paypal-button-container" gt;lt;/divgt; lt;ion-card class="dvCategProduc boxShadow"gt; lt;ion-img (click)="buyPayPal()" src="./assets/img/paypal.png"gt;lt;/ion-imggt; lt;ion-card-content class="contentCard"gt; lt;ion-item lines="none"gt;lt;/ion-itemgt; lt;/ion-card-contentgt; lt;/ion-cardgt;
Функция, в которой выполняется вызов selpasarela.componente.ts
:
async buyPayPal() { const resp = await this._task.paypalPWA( this.datosProductos, this.dataUsr, this.origen ) }
Функция вызова Paypal. Здесь я отправил 1190,00 мексиканских песо (MXN), но при загрузке формы PayPal он показывает доллары США
async paypalPWA(datosProductos, datausr, origen) { this.paypalConfig = { // Set up the transaction //currency: 'MXN', //commmit:false, createOrder: (data, actions) =gt; { return actions.order.create({ purchase_units: [ { amount: { currency: 'MXN', value: Math.round( datosProductos['datospasarela']['totalimportecobrar'] ), }, breakdown: { item_total: { currency: 'MXN', value: Math.round( datosProductos['datospasarela']['totalimportecobrar'] ), }, }, description: datosProductos['datospasarela']['descripcion'], }, ], application_context: { shipping_preference: 'NO_SHIPPING', }, }) }, // Finalize the transaction onApprove: (data, actions) =gt; { return actions.order .capture() .then(details =gt; { console.log('DATA PAGO:', data, 'DETAILS:', details) const resp = this.savePay(details, datosProductos, datausr, origen) }) .catch(err =gt; { console.log(err) }) }, } paypal.Buttons(this.paypalConfig).render('#paypal-button-container') }
Сумма указана в долларах, и, следовательно, конвертация неправильная, она должна была быть указана в MXN: