Skip to content

Commit 2a02283

Browse files
mrsaicharan1niranjan94
authored andcommitted
feat: Alipay backend connect using loader & icon resize. (#3047)
Stacked alipay button along with stripe conditions Compressed alipay icon semnatic ui image Corrected alipay condition Added error handling for unavailability of server Output the actual error Updated with async/await payment success message notif Added translation helpers
1 parent 3502065 commit 2a02283

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

app/controllers/orders/pending.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,14 @@ export default Controller.extend({
3838
}),
3939

4040
actions: {
41-
aliPayCheckout(order_identifier) {
42-
this.loader.post(`/create_source/${order_identifier}`)
43-
.then(charge => {
44-
if (charge.status) {
45-
this.notify.success('Payment has succeeded');
46-
this.transitionToRoute('orders.view', order_identifier);
47-
} else {
48-
this.notify.error('Payment has failed');
49-
}
50-
});
51-
41+
async aliPayCheckout(order_identifier) {
42+
try {
43+
const res = await this.loader.load(`alipay/create_source/${order_identifier}`);
44+
this.notify.success(this.l10n.t('Payment has succeeded'));
45+
window.location.replace(res.link);
46+
} catch (error) {
47+
this.notify.error(this.l10n.t(error.error));
48+
}
5249
},
5350
processStripeToken(token) {
5451
// Send this token to server to process payment

app/models/setting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ export default ModelBase.extend({
4343
stripeClientId : attr('string'),
4444
stripeSecretKey : attr('string'),
4545
stripePublishableKey : attr('string'),
46-
isAliPayActivated : attr('boolean'),
4746
isPaypalActivated : attr('boolean'),
4847
isStripeActivated : attr('boolean'),
48+
isAliPayActivated : attr('boolean'),
4949
isOmiseActivated : attr('boolean'),
5050
emailService : attr('string'),
5151
emailFrom : attr('string'),
-29.2 KB
Loading

0 commit comments

Comments
 (0)