diff --git a/src/app/organization/organizationBillingChangePaymentController.js b/src/app/organization/organizationBillingChangePaymentController.js index 7893ac308d..3f40c3dc57 100644 --- a/src/app/organization/organizationBillingChangePaymentController.js +++ b/src/app/organization/organizationBillingChangePaymentController.js @@ -6,11 +6,30 @@ $analytics.eventTrack('organizationBillingChangePaymentController', { category: 'Modal' }); $scope.existingPaymentMethod = existingPaymentMethod; $scope.paymentMethod = 'card'; - $scope.showPaymentOptions = false; + $scope.showPaymentOptions = true; + $scope.hidePaypal = true; $scope.card = {}; + $scope.bank = {}; + + $scope.changePaymentMethod = function (val) { + $scope.paymentMethod = val; + }; $scope.submit = function () { - $scope.submitPromise = stripe.card.createToken($scope.card).then(function (response) { + var stripeReq = null; + if ($scope.paymentMethod === 'card') { + stripeReq = stripe.card.createToken($scope.card); + } + else if ($scope.paymentMethod === 'bank') { + $scope.bank.currency = 'USD'; + $scope.bank.country = 'US'; + stripeReq = stripe.bankAccount.createToken($scope.bank); + } + else { + return; + } + + $scope.submitPromise = stripeReq.then(function (response) { var request = { paymentToken: response.id }; diff --git a/src/app/organization/organizationBillingController.js b/src/app/organization/organizationBillingController.js index c44d6b34d0..2eb06dd07c 100644 --- a/src/app/organization/organizationBillingController.js +++ b/src/app/organization/organizationBillingController.js @@ -80,6 +80,18 @@ }); }; + $scope.verifyBank = function () { + var modal = $uibModal.open({ + animation: true, + templateUrl: 'app/organization/views/organizationBillingVerifyBank.html', + controller: 'organizationBillingVerifyBankController' + }); + + modal.result.then(function () { + load(); + }); + }; + $scope.cancel = function () { if (!confirm('Are you sure you want to cancel? All users will lose access to the organization ' + 'at the end of this billing cycle.')) { @@ -167,7 +179,8 @@ $scope.paymentSource = { type: org.PaymentSource.Type, description: org.PaymentSource.Description, - cardBrand: org.PaymentSource.CardBrand + cardBrand: org.PaymentSource.CardBrand, + needsVerification: org.PaymentSource.NeedsVerification }; } diff --git a/src/app/organization/organizationBillingVerifyBankController.js b/src/app/organization/organizationBillingVerifyBankController.js new file mode 100644 index 0000000000..9489ebbc58 --- /dev/null +++ b/src/app/organization/organizationBillingVerifyBankController.js @@ -0,0 +1,25 @@ +angular + .module('bit.organization') + + .controller('organizationBillingVerifyBankController', function ($scope, $state, $uibModalInstance, apiService, + $analytics, toastr) { + $analytics.eventTrack('organizationBillingVerifyBankController', { category: 'Modal' }); + + $scope.submit = function () { + var request = { + amount1: $scope.amount1, + amount2: $scope.amount2 + }; + + $scope.submitPromise = apiService.organizations.postVerifyBank({ id: $state.params.orgId }, request) + .$promise.then(function (response) { + $analytics.eventTrack('Verified Bank Account'); + toastr.success('You have successfully verified your bank account.'); + $uibModalInstance.close(); + }); + }; + + $scope.close = function () { + $uibModalInstance.dismiss('cancel'); + }; + }); diff --git a/src/app/organization/views/organizationBilling.html b/src/app/organization/views/organizationBilling.html index 843111ea5f..81f7803a84 100644 --- a/src/app/organization/views/organizationBilling.html +++ b/src/app/organization/views/organizationBilling.html @@ -140,6 +140,15 @@ No payment method on file.
+ We have made two micro-deposits to your bank account (it may take 1-2 business days to show up). + Enter these amounts to verify the bank account. Failure to verify the bank account will result in a + missed payment and your organization being disabled. +
+ ++ Payment with a bank account is only available to customers in the United States. + You will be required to verify your bank account. We will make two micro-deposits within the next + 1-2 business days. Enter these amounts in the organization's billing area to verify the bank account. + Failure to verify the bank account will result in a missed payment and your organization being + disabled. +
++ Payment with a bank account is only available to customers in the United States. + You will be required to verify your bank account. We will make two micro-deposits within the next + 1-2 business days. Enter these amounts in the organization's billing area to verify the bank account. + Failure to verify the bank account will result in a missed payment and your organization being + disabled. +
+