Merge pull request #2 from tudinhtu98/ft-more-payment-methods

Ft more payment methods
This commit is contained in:
Tu Đình Tư 2023-02-23 10:50:01 +07:00 committed by GitHub
commit a3cc64159f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 18 deletions

View File

@ -28,7 +28,8 @@ export default Component.extend({
total: {
label: plan.subscriptionRate,
amount: plan.unit_amount,
}
},
disableWallets: ["link", "browserCard"],
});
this.set("buttonElement",
elements.create('paymentRequestButton', {
@ -78,28 +79,28 @@ export default Component.extend({
if (authenticationResult && !authenticationResult.error) {
return Transaction.finalize(transactionId, planId).then(
() => {
this.advanceSuccessfulTransaction(plan);
this._advanceSuccessfulTransaction(plan);
e.complete("success");
console.log(`Success: ${authenticationResult.paymentIntent.id}`);
}
);
} else if (authenticationResult.error) {
console.log("Payment fail");
console.log("Payment fail", authenticationResult.error);
e.complete("fail");
}
}
);
} else {
this.advanceSuccessfulTransaction(plan);
this._advanceSuccessfulTransaction(plan);
e.complete("success");
console.log(`Success`);
}
})
.catch((result) => {
e.complete("fail");
console.log("Payment fail");
console.log("Catch Payment fail");
this.dialog.alert(
result.jqXHR.responseJSON?.errors[0] || result.errorThrown
result.jqXHR?.responseJSON?.errors[0] || result.errorThrown
);
});

View File

@ -83,15 +83,6 @@ export default Controller.extend({
},
actions: {
alert(path) {
this.alert(path)
},
handleAuthentication(plan, transaction) {
this.handleAuthentication(plan, transaction)
},
advanceSuccessfulTransaction(plan) {
this._advanceSuccessfulTransaction(plan)
},
stripePaymentHandler() {
this.set("loading", true);
const plan = this.get("model.plans")

View File

@ -46,13 +46,13 @@
}}
{{subscribe-google-pay
alert=alert
stripe=stripe
plans=model.plans
selectedPlan=selectedPlan
promoCode=promoCode
advanceSuccessfulTransaction=(action "advanceSuccessfulTransaction")
handleAuthentication=(action "handleAuthentication")
alert=alert
_advanceSuccessfulTransaction=_advanceSuccessfulTransaction
handleAuthentication=handleAuthentication
}}
{{/if}}