![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/vreg/mixins/ |
export default { methods: { handleServerResponse(response, event = null) { if (this.thds_tries > 4 && response.status !== "requires_capture") { this.paymentFormSubmittedEvent() this.cardErrors = "Payment Error, Try another Card Please."; return; } if ((['requires_source_action', 'requires_action'].includes(response.status)) && (response.next_action.type === "use_stripe_sdk")) { this.handleAction(response, event); } else if (['requires_source', 'requires_payment_method'].includes(response.status)) { this.cardErrors = "Invalid Payment method, Please select another card or payment method"; this.paymentFormSubmittedEvent() if (event) { event.complete('fail'); } } else if (response.status === "requires_capture") { this.handleRequiresCapture(response, event); } else { this.paymentFormSubmittedEvent() if (event) { event.complete('fail'); } this.cardErrors = "Payment Error"; } }, handleAction(response, event = null) { if (event) { event.complete('success'); } console.log('handleAction: ', response); this.$stripe.handleCardAction( response.client_secret ).then((result) => { if (result.error) { this.paymentFormSubmittedEvent() this.cardErrors = result.error.message; if (event) { event.complete('fail'); } } else { let url = `payment/order/gateway-check-payment-token/Stripe?gateway_account=${this.stripeAccount.account_key}&payment_intent_id=${response.payment_intent_id}`; this.$axios.get(url).then((result) => { this.thds_tries++; this.handleServerResponse(result.data, event); }).catch((error) => { this.paymentFormSubmittedEvent(); if (error.response) { this.cardErrors = error.response.data.message; } if (event) { event.complete('fail'); } }) } }); }, paymentFormSubmittingEvent() { this.$emit('payment-form-submitting'); }, paymentFormSubmittedEvent() { this.$emit('payment-form-submitted'); }, handleRequiresCapture(data, event = null) { this.form.checkoutToken = data.payment_intent_id; this.form.is_intent = 1; if (event) { let paymentMethodCard = event.paymentMethod.card; this.form.card_last_four = paymentMethodCard.last4; this.form.card_expiry_month = paymentMethodCard.exp_month; this.form.card_expiry_year = paymentMethodCard.exp_year; this.form.card_brand = paymentMethodCard.brand; this.form.billing_information = event.paymentMethod.billing_details; event.complete('success'); } this.fireFormSubmitEvent(); }, } }