1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-26 06:28:19 +01:00

Don't try to access the Stripe object until the user submits the credit card form

Summary: Ref T12232. I can't reproduce the original issue, but this should probably fix it without side effects?

Test Plan: Added a card with Stripe, but I could do that before too.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12232

Differential Revision: https://secure.phabricator.com/D17333
This commit is contained in:
epriestley 2017-02-10 08:34:12 -08:00
parent 743dc9fdb5
commit 4039f5f11b
2 changed files with 9 additions and 8 deletions

View file

@ -433,7 +433,7 @@ return array(
'rsrc/js/application/passphrase/passphrase-credential-control.js' => '3cb0b2fc',
'rsrc/js/application/pholio/behavior-pholio-mock-edit.js' => 'bee502c8',
'rsrc/js/application/pholio/behavior-pholio-mock-view.js' => 'fbe497e7',
'rsrc/js/application/phortune/behavior-stripe-payment-form.js' => '3f5d6dbf',
'rsrc/js/application/phortune/behavior-stripe-payment-form.js' => 'a6b98425',
'rsrc/js/application/phortune/behavior-test-payment-form.js' => 'fc91ab6c',
'rsrc/js/application/phortune/phortune-credit-card-form.js' => '2290aeef',
'rsrc/js/application/policy/behavior-policy-control.js' => 'd0c516d5',
@ -712,7 +712,7 @@ return array(
'javelin-behavior-select-on-click' => '4e3e79a6',
'javelin-behavior-setup-check-https' => '491416b3',
'javelin-behavior-slowvote-embed' => '887ad43f',
'javelin-behavior-stripe-payment-form' => '3f5d6dbf',
'javelin-behavior-stripe-payment-form' => 'a6b98425',
'javelin-behavior-test-payment-form' => 'fc91ab6c',
'javelin-behavior-time-typeahead' => '522431f7',
'javelin-behavior-toggle-class' => '92b9ec77',
@ -1161,11 +1161,6 @@ return array(
'javelin-workflow',
'javelin-stratcom',
),
'3f5d6dbf' => array(
'javelin-behavior',
'javelin-dom',
'phortune-credit-card-form',
),
'40a6a403' => array(
'javelin-install',
'javelin-dom',
@ -1761,6 +1756,11 @@ return array(
'phuix-icon-view',
'phabricator-busy',
),
'a6b98425' => array(
'javelin-behavior',
'javelin-dom',
'phortune-credit-card-form',
),
'a6f7a73b' => array(
'javelin-behavior',
'javelin-stratcom',

View file

@ -6,11 +6,12 @@
*/
JX.behavior('stripe-payment-form', function(config) {
Stripe.setPublishableKey(config.stripePublishableKey);
function onsubmit(card_data) {
var errors = [];
Stripe.setPublishableKey(config.stripePublishableKey);
if (!Stripe.validateCardNumber(card_data.number)) {
errors.push('cc:invalid:number');
}