diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index c865eba9da56..108295c318a8 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -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())); diff --git a/app/PaymentDrivers/PayPalExpressPaymentDriver.php b/app/PaymentDrivers/PayPalExpressPaymentDriver.php index 4b4808389a0d..7a0d0a11c8db 100644 --- a/app/PaymentDrivers/PayPalExpressPaymentDriver.php +++ b/app/PaymentDrivers/PayPalExpressPaymentDriver.php @@ -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'];