Skip to content

Commit

Permalink
feat: add paytm checkout modals
Browse files Browse the repository at this point in the history
  • Loading branch information
uds5501 committed Aug 20, 2019
1 parent f1fcb70 commit 3d3a9ad
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/components/modals/paytm-otp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// import { computed } from '@ember/object';
import ModalBase from 'open-event-frontend/components/modals/modal-base';

export default class extends ModalBase {
isSmall = true;

// @computed('this.otp')
// get isOTPvalid() {
// return this.otp.length === 6;
// }
}
7 changes: 7 additions & 0 deletions app/components/modals/paytm-payment-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import ModalBase from 'open-event-frontend/components/modals/modal-base';

export default class extends ModalBase {
isSmall = true;
isWalletSelected = false;
mobileNumber = '';
}
14 changes: 14 additions & 0 deletions app/controllers/orders/pending.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ export default Controller.extend({
this.notify.error(this.l10n.t(error.error));
}
},
openPaytmModal() {
// Model controller for PaytmModal
this.setProperties({
'isPaytmModalOpen' : true
});
},

openOTPController() {
// Modal controller for OTP step
this.setProperties({
'isPaytmModalOpen' : false,
'isOTPModalOpen' : true
});
},
processStripeToken(token) {
// Send this token to server to process payment
this.set('isLoading', true);
Expand Down
16 changes: 16 additions & 0 deletions app/templates/components/modals/paytm-otp.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="header">
{{t 'Amount to be paid:'}} {{currency-symbol currency}} {{amount}}
</div>

<div class="content">
{{t 'Enter OTP sent to mobile number'}}
<div class="ui {{if isLoading 'loading'}} form" autocomplete="off">
{{input type='number' name='otp' value=otp required=true}}
</div>
</div>

<div class="actions">
<button class="ui green button" disabled={{isOTPvalid}}>
{{t 'Verify'}}
</button>
</div>
32 changes: 32 additions & 0 deletions app/templates/components/modals/paytm-payment-options.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="header">
{{t 'Amount to be paid:'}} {{currency-symbol currency}} {{amount}}
</div>

<div class="content">
<div class="muted small text">
{{t 'Select an option to pay'}}
</div>
<div class="ui {{if isLoading 'loading'}} form" autocomplete="off" >
<div class="field">
{{ui-radio name='payment_mode' value='paytm' onChange=(action (mut isWalletSelected))}}
{{t 'Paytm Wallet'}}<img src="/images/payment-logos/paytm.png" alt="paytm">
</div>
{{#if isWalletSelected}}
<div class="field">
<div class="label">
{{t 'Please enter your Paytm registered Mobile Number to continue'}}
</div>
{{input type='number' name='mobile_number' value=mobileNumber required=true}}
</div>
{{/if}}
</div>
</div>

<div class="actions">
<button type="button" class="ui black button" {{action 'close'}}>
{{t 'Cancel'}}
</button>
<button {{action openOTPController}} class="ui green button" disabled={{not isWalletSelected}}>
{{t 'Proceed'}}
</button>
</div>
5 changes: 5 additions & 0 deletions app/templates/orders/pending.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
</form>
</div>
{{/if}}
{{#if isPaytm}}
<button class="ui button primary" {{action "openPaytmModal"}}>{{t 'Pay with Paytm'}}</button>
{{/if}}
{{#if isAliPay}}
<button class="ui button primary" {{action alipayCheckout model.order.identifier}}>{{t 'Pay with AliPay'}}</button>
{{/if}}
Expand All @@ -77,3 +80,5 @@
</div>
</div>
</div>
{{modals/paytm-payment-options isLoading=isLoading isOpen=isPaytmModalOpen amount=model.order.amount currency=model.order.event.paymentCurrency openOTPController=(action 'openOTPController')}}
{{modals/paytm-otp isLoading=isLoading isOpen=isOTPModalOpen amount=model.order.amount currency=model.order.event.paymentCurrency}}

0 comments on commit 3d3a9ad

Please sign in to comment.