Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions app/components/forms/admin/settings/payment-gateway-form.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Component from '@ember/component';
import { computed } from '@ember/object';
import FormMixin from 'open-event-frontend/mixins/form';
import ENV from 'open-event-frontend/config/environment';

export default Component.extend(FormMixin, {
getValidationRules() {
Expand Down Expand Up @@ -38,6 +39,25 @@ export default Component.extend(FormMixin, {
}
]
},
stripeTestSecretKey: {
identifier : 'stripe_test_secret_key',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the secret test key')
}
]
},

stripeTestPublishableKey: {
identifier : 'stripe_test_publishable_key',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the publishable test key')
}
]
},
alipaySecretKey: {
identifier : 'alipay_secret_key',
rules : [
Expand Down Expand Up @@ -145,6 +165,10 @@ export default Component.extend(FormMixin, {
return this.get('settings.stripeClientId');
}),

stripeMode: computed(function() {
return ENV.environment === 'development' || ENV.environment === 'test' ? 'debug' : 'production';
}),

isCheckedPaypal: computed(function() {
return this.get('settings.paypalSandboxClient') || this.get('settings.paypalClient');
}),
Expand Down
2 changes: 2 additions & 0 deletions app/models/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export default ModelBase.extend({
stripeClientId : attr('string'),
stripeSecretKey : attr('string'),
stripePublishableKey : attr('string'),
stripeTestSecretKey : attr('string'),
stripeTestPublishableKey : attr('string'),
isAliPayActivated : attr('boolean'),
isPaypalActivated : attr('boolean'),
isStripeActivated : attr('boolean'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,52 @@
</label>
{{input type='text' name='stripe_client_id' value=settings.stripeClientId}}
</div>
<h5 class="ui header">
{{t 'Stripe Integration Mode'}}
</h5>
<div class="field">
<label>
{{t 'Secret Key'}}
</label>
{{input type='text' name='stripe_secret_key' value=settings.stripeSecretKey}}
{{ui-radio label=(t 'Test mode - Used during development and testing')
name='stripe_integration_mode'
value='debug'
current=stripeMode
onChange=(action (mut stripeMode))}}
</div>
{{#if (eq stripeMode 'debug')}}
<div class="field">
<label>
{{t 'Secret Test Key'}}
</label>
{{input type='text' name='stripe_test_secret_key' value=settings.stripeTestSecretKey}}
</div>
<div class="field">
<label>
{{t 'Publishable Test Key'}}
</label>
{{input type='text' name='stripe_test_publishable_key' value=settings.stripeTestPublishableKey}}
</div>
{{/if}}
<div class="ui hidden divider"></div>
<div class="field">
<label>
{{t 'Publishable Key'}}
</label>
{{input type='text' name='stripe_publishable_key' value=settings.stripePublishableKey}}
{{ui-radio label=(t 'Live mode - Used during production')
name='stripe_integration_mode'
value='production'
current=stripeMode
onChange=(action (mut stripeMode))}}
</div>
{{#if (eq stripeMode 'production')}}
<div class="field">
<label>
{{t 'Secret Key'}}
</label>
{{input type='text' name='stripe_secret_key' value=settings.stripeSecretKey}}
</div>
<div class="field">
<label>
{{t 'Publishable Key'}}
</label>
{{input type='text' name='stripe_publishable_key' value=settings.stripePublishableKey}}
</div>
{{/if}}
<div class="ui hidden divider"></div>
{{/if}}
<div class="inline field">
Expand Down