Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private continue = async () => {
const {
datasource,
checkoutId,
ShopifySupportedMethods,
orderDetails,
test,
payment,
onSuccess
} = this.props;
// clone orderDetails to mutate it
const details = JSON.parse(JSON.stringify(orderDetails));
details.total.amount.value = this.state.total;
const secondReq = new PaymentRequest(ShopifySupportedMethods, details, {
requestPayerName: true
});
const secondPaymentResponse = await secondReq.show();
if (secondPaymentResponse) {
// Fetch PaymentToken
if (!secondPaymentResponse.details.getPaymentToken) {
throw new ShopifyAPIError('getPaymentToken does not exist on android order?');
}
const pToken = await secondPaymentResponse.details.getPaymentToken();
const submitResponse = await datasource.api
.checkoutCompleteWithTokenizedPayment(checkoutId, {
test,
type: 'android_pay',
amount: this.state.total.amount.value,