mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for type
This commit is contained in:
parent
796fbc6a6f
commit
b805bba375
@ -167,7 +167,8 @@ class Nordigen
|
|||||||
$mo->email_template_body = 'nordigen_requisition_body';
|
$mo->email_template_body = 'nordigen_requisition_body';
|
||||||
$mo->email_template_subject = 'nordigen_requisition_subject';
|
$mo->email_template_subject = 'nordigen_requisition_subject';
|
||||||
|
|
||||||
Email::dispatch($mo, $bank_integration->company);if(
|
Email::dispatch($mo, $bank_integration->company);
|
||||||
|
|
||||||
Cache::put($cache_key, true, 60 * 60 * 24);
|
Cache::put($cache_key, true, 60 * 60 * 24);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -303,6 +303,8 @@ class PayPalPPCPPaymentDriver extends PayPalBasePaymentDriver
|
|||||||
|
|
||||||
$r = $this->gatewayRequest('/v2/checkout/orders', 'post', $order);
|
$r = $this->gatewayRequest('/v2/checkout/orders', 'post', $order);
|
||||||
|
|
||||||
|
$this->payment_hash->withData("orderID", $r->json()['id']);
|
||||||
|
|
||||||
return $r->json()['id'];
|
return $r->json()['id'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,12 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
|||||||
return $this->processTokenPayment($request, $response);
|
return $this->processTokenPayment($request, $response);
|
||||||
|
|
||||||
//capture
|
//capture
|
||||||
|
|
||||||
|
if(!isset($response['orderID']) && isset($response['name']) && $response['name'] == "UNPROCESSABLE_ENTITY"){
|
||||||
|
$this->handleDuplicateInvoiceId($this->payment_hash->data->orderID);
|
||||||
|
$response['orderID'] = $this->payment_hash->data->orderID;
|
||||||
|
}
|
||||||
|
|
||||||
$orderID = $response['orderID'];
|
$orderID = $response['orderID'];
|
||||||
|
|
||||||
if($this->company_gateway->require_shipping_address) {
|
if($this->company_gateway->require_shipping_address) {
|
||||||
@ -109,21 +115,8 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
|||||||
//Rescue for duplicate invoice_id
|
//Rescue for duplicate invoice_id
|
||||||
if(stripos($e->getMessage(), 'DUPLICATE_INVOICE_ID') !== false){
|
if(stripos($e->getMessage(), 'DUPLICATE_INVOICE_ID') !== false){
|
||||||
|
|
||||||
|
|
||||||
$_invoice = collect($this->payment_hash->data->invoices)->first();
|
$r = $this->handleDuplicateInvoiceId($orderID);
|
||||||
$invoice = Invoice::withTrashed()->find($this->decodePrimaryKey($_invoice->invoice_id));
|
|
||||||
$new_invoice_number = $invoice->number."_".Str::random(5);
|
|
||||||
|
|
||||||
$update_data =
|
|
||||||
[[
|
|
||||||
"op" => "replace",
|
|
||||||
"path" => "/purchase_units/@reference_id=='default'/invoice_id",
|
|
||||||
"value" => $new_invoice_number,
|
|
||||||
]];
|
|
||||||
|
|
||||||
$r = $this->gatewayRequest("/v2/checkout/orders/{$orderID}", 'patch', $update_data);
|
|
||||||
|
|
||||||
$r = $this->gatewayRequest("/v2/checkout/orders/{$orderID}/capture", 'post', ['body' => '']);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +155,27 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function handleDuplicateInvoiceId(string $orderID)
|
||||||
|
{
|
||||||
|
|
||||||
|
$_invoice = collect($this->payment_hash->data->invoices)->first();
|
||||||
|
$invoice = Invoice::withTrashed()->find($this->decodePrimaryKey($_invoice->invoice_id));
|
||||||
|
$new_invoice_number = $invoice->number."_".Str::random(5);
|
||||||
|
|
||||||
|
$update_data =
|
||||||
|
[[
|
||||||
|
"op" => "replace",
|
||||||
|
"path" => "/purchase_units/@reference_id=='default'/invoice_id",
|
||||||
|
"value" => $new_invoice_number,
|
||||||
|
]];
|
||||||
|
|
||||||
|
$r = $this->gatewayRequest("/v2/checkout/orders/{$orderID}", 'patch', $update_data);
|
||||||
|
|
||||||
|
$r = $this->gatewayRequest("/v2/checkout/orders/{$orderID}/capture", 'post', ['body' => '']);
|
||||||
|
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
private function createNinjaPayment($request, $response) {
|
private function createNinjaPayment($request, $response) {
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@ -273,6 +287,9 @@ class PayPalRestPaymentDriver extends PayPalBasePaymentDriver
|
|||||||
$r = $this->gatewayRequest('/v2/checkout/orders', 'post', $order);
|
$r = $this->gatewayRequest('/v2/checkout/orders', 'post', $order);
|
||||||
|
|
||||||
nlog($r->json());
|
nlog($r->json());
|
||||||
|
|
||||||
|
$this->payment_hash->withData("orderID", $r->json()['id']);
|
||||||
|
|
||||||
return $r->json()['id'];
|
return $r->json()['id'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user