Fixes for PPCP

This commit is contained in:
David Bomba 2023-11-06 23:31:48 +11:00
parent 9212b71b8a
commit a09b8619d5

View File

@ -196,7 +196,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
private function checkPaymentsReceivable(): self
{
if($this->company_gateway->getConfigField('status') != 'active'){
if($this->company_gateway->getConfigField('status') != 'activated'){
if (class_exists(\Modules\Admin\Services\PayPal\PayPalService::class)) {
$pp = new \Modules\Admin\Services\PayPal\PayPalService($this->company_gateway->company, $this->company_gateway->user);
@ -205,7 +205,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
$this->company_gateway = $this->company_gateway->fresh();
$config = $this->company_gateway->getConfig();
if($config->status == 'active')
if($config->status == 'activated')
return $this;
}
@ -232,6 +232,8 @@ class PayPalPPCPPaymentDriver extends BaseDriver
$data['gateway_type_id'] = $this->gateway_type_id;
$data['merchantId'] = $this->company_gateway->getConfigField('merchantId');
// nlog($data['merchantId']);
return render('gateways.paypal.ppcp.pay', $data);
}
@ -313,6 +315,7 @@ class PayPalPPCPPaymentDriver extends BaseDriver
})->implode("\n");
$order = [
"intent" => "CAPTURE",
"payer" => [
"name" => [
@ -333,6 +336,12 @@ class PayPalPPCPPaymentDriver extends BaseDriver
[
"description" =>ctrans('texts.invoice_number').'# '.$invoice->number,
"invoice_id" => $invoice->number,
"payee" => [
"merchant_id" => $this->company_gateway->getConfigField('merchantId'),
],
"payment_instruction" => [
"disbursement_mode" => "INSTANT",
],
"amount" => [
"value" => (string)$data['amount_with_fee'],
"currency_code"=> $this->client->currency()->code,
@ -354,18 +363,11 @@ class PayPalPPCPPaymentDriver extends BaseDriver
],
],
],
]
],
]
];
$data['payee'] = [
"merchant_id" => $this->company_gateway->getConfigField('merchantId'),
[
"payment_instruction" => [
"disbursement_mode" => "INSTANT",
],
],
];
nlog($order);
$r = $this->gatewayRequest('/v2/checkout/orders', 'post', $order);