mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on Alipay
This commit is contained in:
parent
f654259ae8
commit
d251df7531
@ -331,10 +331,14 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
$data = "type=alipay&amount={$amount}¤cy={$currency}&redirect[return_url]={$redirect}";
|
$data = "type=alipay&amount={$amount}¤cy={$currency}&redirect[return_url]={$redirect}";
|
||||||
$response = $this->makeStripeCall('POST', 'sources', $data);
|
$response = $this->makeStripeCall('POST', 'sources', $data);
|
||||||
|
|
||||||
|
if (is_array($response) && isset($response['id'])) {
|
||||||
$this->invitation->transaction_reference = $response['id'];
|
$this->invitation->transaction_reference = $response['id'];
|
||||||
$this->invitation->save();
|
$this->invitation->save();
|
||||||
|
|
||||||
return redirect($response['redirect']['url']);
|
return redirect($response['redirect']['url']);
|
||||||
|
} else {
|
||||||
|
throw new Exception($response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function makeStripeCall($method, $url, $body = null)
|
public function makeStripeCall($method, $url, $body = null)
|
||||||
@ -459,8 +463,10 @@ class StripePaymentDriver extends BasePaymentDriver
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$data = sprintf('amount=%d¤cy=%s&source=%s', $source['amount'], $source['currency'], $source['id']);
|
$data = sprintf('amount=%d¤cy=%s&source=%s', $source['amount'], $source['currency'], $source['id']);
|
||||||
$this->purchaseResponse = $this->makeStripeCall('POST', 'charges', $data);
|
$this->purchaseResponse = $response = $this->makeStripeCall('POST', 'charges', $data);
|
||||||
$this->createPayment($this->purchaseResponse['id']);
|
if (is_array($response) && isset($response['id'])) {
|
||||||
|
$this->createPayment($response['id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'Processed successfully';
|
return 'Processed successfully';
|
||||||
|
@ -37,6 +37,7 @@ class PaymentTypesSeeder extends Seeder
|
|||||||
['name' => 'Venmo'],
|
['name' => 'Venmo'],
|
||||||
['name' => 'Money Order'],
|
['name' => 'Money Order'],
|
||||||
['name' => 'Alipay', 'gateway_type_id' => GATEWAY_TYPE_ALIPAY],
|
['name' => 'Alipay', 'gateway_type_id' => GATEWAY_TYPE_ALIPAY],
|
||||||
|
['name' => 'Sofort', 'gateway_type_id' => GATEWAY_TYPE_BANK_TRANSFER],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($paymentTypes as $paymentType) {
|
foreach ($paymentTypes as $paymentType) {
|
||||||
|
@ -66,6 +66,10 @@
|
|||||||
@foreach ($gateways as $gateway)
|
@foreach ($gateways as $gateway)
|
||||||
|
|
||||||
<div id="gateway_{{ $gateway->id }}_div" class='gateway-fields' style="display: none">
|
<div id="gateway_{{ $gateway->id }}_div" class='gateway-fields' style="display: none">
|
||||||
|
@if ($gateway->id == GATEWAY_STRIPE)
|
||||||
|
{!! Former::text('publishable_key') !!}
|
||||||
|
@endif
|
||||||
|
|
||||||
@foreach ($gateway->fields as $field => $details)
|
@foreach ($gateway->fields as $field => $details)
|
||||||
|
|
||||||
@if ($details && !$accountGateway && !is_array($details) && !is_bool($details))
|
@if ($details && !$accountGateway && !is_array($details) && !is_bool($details))
|
||||||
@ -89,9 +93,7 @@
|
|||||||
|
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
@if ($gateway->id == GATEWAY_STRIPE)
|
@if ($gateway->id == GATEWAY_BRAINTREE)
|
||||||
{!! Former::text('publishable_key') !!}
|
|
||||||
@elseif ($gateway->id == GATEWAY_BRAINTREE)
|
|
||||||
@if ($account->hasGatewayId(GATEWAY_PAYPAL_EXPRESS))
|
@if ($account->hasGatewayId(GATEWAY_PAYPAL_EXPRESS))
|
||||||
{!! Former::checkbox('enable_paypal')
|
{!! Former::checkbox('enable_paypal')
|
||||||
->label(trans('texts.paypal'))
|
->label(trans('texts.paypal'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user