Skip to content

Commit

Permalink
fix: submit google pay
Browse files Browse the repository at this point in the history
fix: submit google pay
  • Loading branch information
fabiano-mallmann authored Sep 25, 2024
2 parents 0b995f4 + b927095 commit 78b5b84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion assets/javascripts/front/checkout/model/payment/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ let pagarmeCard = {
!pagarmeCard.isTokenized() &&
pagarmeCard.haveCardForm(checkoutPaymentElement)
) {
jQuery("#payment_method_woo-pagarme-payments-credit_card").val("woo-pagarme-payments-credit_card");
if (typeof pagarmeTds == 'object') {
const tdsExecuted = pagarmeTds.start(event);

Expand Down
5 changes: 4 additions & 1 deletion assets/javascripts/front/checkout/model/payment/googlepay.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ let pagarmeGooglePay = {
woocommercePaymentMethods: 'input[name="payment_method"]',
googlePayAllowedBrands: ["AMEX", "ELO", "MASTERCARD", "VISA"],
pagarmeAllowedBrands: wc_pagarme_googlepay.allowedCcFlags,
woocommercePaymentId: "#payment_method_woo-pagarme-payments-credit_card",

getGooglePaymentsClient: function () {
let environment = "TEST";
Expand Down Expand Up @@ -116,6 +117,7 @@ let pagarmeGooglePay = {
pagarmeGooglePay.processPayment(paymentData, self);
})
.catch(function (err) {
jQuery(pagarmeGooglePay.woocommercePaymentId ).val("woo-pagarme-payments-credit_card");
if (err.statusCode === "CANCELED") {
return;
}
Expand Down Expand Up @@ -155,9 +157,10 @@ let pagarmeGooglePay = {
.attr('id', "googlepaytoken")
.attr('value', paymentData.paymentMethodData.tokenizationData.token);
checkoutPaymentElement.append(input);
jQuery("#payment_method_woo-pagarme-payments-credit_card").val("woo-pagarme-payments-googlepay");
jQuery(pagarmeGooglePay.woocommercePaymentId ).val("woo-pagarme-payments-googlepay");
checkoutPaymentElement.submit();
jQuery('form#order_review').submit();
jQuery(pagarmeGooglePay.woocommercePaymentId ).val("woo-pagarme-payments-credit_card");
},

getCheckoutPaymentElement: function () {
Expand Down

0 comments on commit 78b5b84

Please sign in to comment.