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
62f792fcd8
commit
421327ae8e
@ -69,10 +69,6 @@ class ClientPortalController extends BaseController
|
||||
|
||||
$account->loadLocalizationSettings($client);
|
||||
|
||||
if (! Input::has('phantomjs')) {
|
||||
$this->invoiceRepo->clearGatewayFee($invoice);
|
||||
}
|
||||
|
||||
if (! Input::has('phantomjs') && ! session('silent:' . $client->id) && ! Session::has($invitation->invitation_key)
|
||||
&& (! Auth::check() || Auth::user()->account_id != $invoice->account_id)) {
|
||||
if ($invoice->isType(INVOICE_TYPE_QUOTE)) {
|
||||
|
@ -198,21 +198,6 @@ class OnlinePaymentController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function createSource($invitationKey, $gatewayType)
|
||||
{
|
||||
if (! $invitation = $this->invoiceRepo->findInvoiceByInvitation($invitationKey)) {
|
||||
return response()->view('error', [
|
||||
'error' => trans('texts.invoice_not_found'),
|
||||
'hideHeader' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
$gatewayTypeId = GatewayType::getIdFromAlias($gatewayType);
|
||||
$paymentDriver = $invitation->account->paymentDriver($invitation, $gatewayTypeId);
|
||||
|
||||
return $paymentDriver->createSource();
|
||||
}
|
||||
|
||||
public function completeSource($invitationKey, $gatewayType)
|
||||
{
|
||||
if (! $invitation = $this->invoiceRepo->findInvoiceByInvitation($invitationKey)) {
|
||||
|
@ -33,7 +33,6 @@ Route::group(['middleware' => ['lookup:contact', 'auth:client']], function () {
|
||||
Route::get('approve/{invitation_key}', 'QuoteController@approve');
|
||||
Route::get('payment/{invitation_key}/{gateway_type?}/{source_id?}', 'OnlinePaymentController@showPayment');
|
||||
Route::post('payment/{invitation_key}', 'OnlinePaymentController@doPayment');
|
||||
Route::get('create_source/{invitation_key}/{gateway_type}', 'OnlinePaymentController@createSource');
|
||||
Route::get('complete_source/{invitation_key}/{gateway_type}', 'OnlinePaymentController@completeSource');
|
||||
Route::match(['GET', 'POST'], 'complete/{invitation_key?}/{gateway_type?}', 'OnlinePaymentController@offsitePayment');
|
||||
Route::get('bank/{routing_number}', 'OnlinePaymentController@getBankInfo');
|
||||
|
@ -141,6 +141,11 @@ class BasePaymentDriver
|
||||
$invoicRepo->setGatewayFee($this->invoice(), $this->gatewayType);
|
||||
}
|
||||
|
||||
// For these gateway types we use the API directrly rather than Omnipay
|
||||
if (in_array($this->gatewayType, [GATEWAY_TYPE_ALIPAY])) {
|
||||
return $this->createSource();
|
||||
}
|
||||
|
||||
if ($this->isGatewayType(GATEWAY_TYPE_TOKEN) || $gateway->is_offsite) {
|
||||
if (Session::has('error')) {
|
||||
Session::reflash();
|
||||
@ -937,11 +942,7 @@ class BasePaymentDriver
|
||||
$url = 'javascript:showCustomModal();';
|
||||
$label = e($this->accountGateway->getConfigField('name'));
|
||||
} else {
|
||||
if ($gatewayTypeId == GATEWAY_TYPE_ALIPAY) {
|
||||
$url = url("/create_source/{$this->invitation->invitation_key}/alipay");
|
||||
} else {
|
||||
$url = $this->paymentUrl($gatewayTypeAlias);
|
||||
}
|
||||
$url = $this->paymentUrl($gatewayTypeAlias);
|
||||
if ($custom = $this->account()->getLabel($gatewayTypeAlias)) {
|
||||
$label = $custom;
|
||||
} else {
|
||||
|
@ -328,7 +328,7 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
$redirect = url("/complete_source/{$this->invitation->invitation_key}/{$gatewayType}");
|
||||
$email = $this->contact()->email;
|
||||
|
||||
$data = "type=alipay&amount={$amount}¤cy={$currency}&redirect[return_url]={$redirect}&owner[email]={$email}";
|
||||
$data = "type=alipay&amount={$amount}¤cy={$currency}&redirect[return_url]={$redirect}";
|
||||
$response = $this->makeStripeCall('POST', 'sources', $data);
|
||||
|
||||
$this->invitation->transaction_reference = $response['id'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user