completeCheckoutWithTokenizedPaymentV2 method
Updates the shipping address on given checkoutId
Implementation
Future<String?> completeCheckoutWithTokenizedPaymentV2({
required String checkoutId,
required PriceV2 price,
required Address billingAddress,
required String impotencyKey,
required String tokenizedPayment,
required String type,
bool test = false,
}) async {
final MutationOptions _options = MutationOptions(
document: gql(compCheckoutWithTokenizedPaymentV2),
variables: {
'checkoutId': checkoutId,
"payment": {
"paymentAmount": {
"amount": price.amount,
"currencyCode": price.currencyCode
},
"idempotencyKey": impotencyKey,
"billingAddress": {
"firstName": billingAddress.firstName,
"lastName": billingAddress.lastName,
"address1": billingAddress.address1,
"province": billingAddress.province,
"country": billingAddress.country,
"city": billingAddress.city,
"zip": billingAddress.zip
},
"paymentData": tokenizedPayment,
"type": type
}
},
);
final QueryResult result = await _graphQLClient!.mutate(_options);
checkForError(
result,
key: 'checkoutCompleteWithTokenizedPaymentV2',
errorKey: 'checkoutUserErrors',
);
return (result.data!['checkoutCompleteWithTokenizedPaymentV2'] ??
const {})['payment']['id'];
}