mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-05 18:52:44 +01:00
Refator payments and gateway fees
This commit is contained in:
parent
9fdbed4472
commit
9dce4c3de1
@ -18,6 +18,7 @@ use App\Jobs\Util\SystemLogger;
|
||||
use App\Models\ClientGatewayToken;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentHash;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\CheckoutCom\Utilities;
|
||||
@ -109,6 +110,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver
|
||||
'value' => $request->value,
|
||||
'raw_value' => $request->raw_value,
|
||||
'currency' => $request->currency,
|
||||
'payment_hash' =>$request->payment_hash,
|
||||
];
|
||||
|
||||
$state = array_merge($state, $request->all());
|
||||
@ -163,10 +165,9 @@ class CheckoutComPaymentDriver extends BasePaymentDriver
|
||||
];
|
||||
|
||||
$payment = $this->createPayment($data, Payment::STATUS_COMPLETED);
|
||||
|
||||
$this->attachInvoices($payment, $state['hashed_ids']);
|
||||
|
||||
$payment->service()->updateInvoicePayment();
|
||||
$payment_hash = PaymentHash::whereRaw("BINARY `hash`= ?", [$state['payment_hash']])->firstOrFail();
|
||||
$this->attachInvoices($payment, $payment_hash);
|
||||
$payment->service()->updateInvoicePayment($payment_hash);
|
||||
|
||||
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
||||
|
||||
|
@ -18,6 +18,7 @@ use App\Jobs\Util\SystemLogger;
|
||||
use App\Models\ClientGatewayToken;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentHash;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\Utils\Ninja;
|
||||
@ -91,7 +92,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
|
||||
* @var $data['amount_with_fee']
|
||||
* @var $data['token']
|
||||
* @var $data['payment_method_id']
|
||||
* @var $data['hashed_ids']
|
||||
* @var $data['payment_hash']
|
||||
*
|
||||
* @param array $data variables required to build payment page
|
||||
* @return view Gateway and payment method specific view
|
||||
@ -163,10 +164,9 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
|
||||
}
|
||||
|
||||
$payment = $this->createPayment($response->getData());
|
||||
|
||||
$this->attachInvoices($payment, $request->input('hashed_ids'));
|
||||
|
||||
$payment->service()->UpdateInvoicePayment();
|
||||
$payment_hash = PaymentHash::whereRaw("BINARY `hash`= ?", [$request->input('payment_hash')])->firstOrFail();
|
||||
$this->attachInvoices($payment, $payment_hash);
|
||||
$payment->service()->updateInvoicePayment($payment_hash);
|
||||
|
||||
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
||||
|
||||
@ -194,7 +194,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
$url = $this->client->company->domain() . "/client/payments/process/response";
|
||||
$url .= "?company_gateway_id={$this->company_gateway->id}&gateway_type_id=" . GatewayType::PAYPAL;
|
||||
$url .= "&hashed_ids=" . implode(",", $input['hashed_ids']);
|
||||
$url .= "&payment_hash=" . $input['payment_hash'];
|
||||
$url .= "&amount=" . $input['amount'];
|
||||
$url .= "&fee=" . $input['fee'];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user