Working on Alipay

This commit is contained in:
Hillel Coren 2017-09-04 23:22:57 +03:00
parent 9f0a60486d
commit 1f0dee82cd
5 changed files with 30 additions and 19 deletions

View File

@ -294,6 +294,10 @@ class AccountGatewayController extends BaseController
$config->plaidPublicKey = $oldConfig->plaidPublicKey;
}
if ($gatewayId == GATEWAY_STRIPE) {
$config->enableAlipay = boolval(Input::get('enable_alipay'));
}
if ($gatewayId == GATEWAY_STRIPE || $gatewayId == GATEWAY_WEPAY) {
$config->enableAch = boolval(Input::get('enable_ach'));
}

View File

@ -149,10 +149,6 @@ class AccountGateway extends EntityModel
*/
public function getAlipayEnabled()
{
if (\Utils::isNinjaDev()) {
return true;
}
return ! empty($this->getConfigField('enableAlipay'));
}

View File

@ -1214,7 +1214,7 @@ $LANG = array(
'payment_type_stripe' => 'Stripe',
'ach' => 'ACH',
'enable_ach' => 'Enable ACH',
'stripe_ach_help' => 'ACH support must also be enabled at Stripe.',
'stripe_ach_help' => 'ACH support must also be enabled in :link.',
'ach_disabled' => 'Another gateway is already configured for direct debit.',
'plaid' => 'Plaid',
@ -2438,7 +2438,9 @@ $LANG = array(
'deleted_company_details' => 'Your company (:account) has been successfully deleted.',
'deleted_account_details' => 'Your account (:account) has been successfully deleted.',
'alipay' => 'Alipay',
'enable_alipay' => 'Enable Alipay',
'stripe_alipay_help' => 'ACH/Alipay support must also be enabled in :link.',
);

View File

@ -19,6 +19,7 @@
{!! Former::populateField('update_address', intval($accountGateway->update_address)) !!}
{!! Former::populateField('publishable_key', $accountGateway->getPublishableStripeKey() ? str_repeat('*', strlen($accountGateway->getPublishableStripeKey())) : '') !!}
{!! Former::populateField('enable_ach', $accountGateway->getAchEnabled() ? 1 : 0) !!}
{!! Former::populateField('enable_alipay', $accountGateway->getAlipayEnabled() ? 1 : 0) !!}
{!! Former::populateField('enable_paypal', $accountGateway->getPayPalEnabled() ? 1 : 0) !!}
{!! Former::populateField('plaid_client_id', $accountGateway->getPlaidClientId() ? str_repeat('*', strlen($accountGateway->getPlaidClientId())) : '') !!}
{!! Former::populateField('plaid_secret', $accountGateway->getPlaidSecret() ? str_repeat('*', strlen($accountGateway->getPlaidSecret())) : '') !!}
@ -149,7 +150,12 @@
{!! Former::checkbox('enable_ach')
->label(trans('texts.ach'))
->text(trans('texts.enable_ach'))
->help(trans('texts.stripe_ach_help'))
->value(1) !!}
{!! Former::checkbox('enable_alipay')
->label(trans('texts.alipay'))
->text(trans('texts.enable_alipay'))
->help(trans('texts.stripe_alipay_help', ['link' => link_to('https://dashboard.stripe.com/account/payments/settings', 'Stripe', ['target' => '_blank'])]))
->value(1) !!}
<div class="stripe-ach-options">

View File

@ -1164,6 +1164,8 @@
@endif
var invoice = createInvoiceModel();
@if ($invoice->exists)
if (! checkedInvoiceBalances) {
// check amounts are correct
checkedInvoiceBalances = true;
@ -1177,6 +1179,7 @@
window.onerror(invitationKey + ': Balances do not match | PHP: ' + phpBalance + ', JS: ' + jsBalance + ', KO: ' + koBalance);
}
}
@endif
@if ( ! $account->live_preview)
return;