mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Clean up for password resets
This commit is contained in:
parent
abc3cc5897
commit
81385e4857
@ -69,6 +69,9 @@ class UpdateCalculatedFields
|
||||
$project->save();
|
||||
});
|
||||
|
||||
//Clean password resets table
|
||||
\DB::connection($db)->table('password_resets')->where('created_at', '<', now()->subHour())->delete();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +292,32 @@ class PayPalPPCPPaymentDriver extends BaseDriver
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
$r = $this->gatewayRequest("/v2/checkout/orders/{$orderID}/capture", 'post', ['body' => '']);
|
||||
} catch(\Exception $e) {
|
||||
|
||||
//Rescue for duplicate invoice_id
|
||||
if(stripos($e->getMessage(), 'DUPLICATE_INVOICE_ID') !== false) {
|
||||
|
||||
|
||||
$_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' => '']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$response = $r;
|
||||
|
||||
|
@ -18,6 +18,7 @@ use App\Models\Invoice;
|
||||
use App\Models\SystemLog;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\PaymentType;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Jobs\Util\SystemLogger;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Exceptions\PaymentFailed;
|
||||
@ -212,6 +213,7 @@ class PayPalRestPaymentDriver extends BaseDriver
|
||||
$request['gateway_response'] = str_replace("Error: ", "", $request['gateway_response']);
|
||||
$response = json_decode($request['gateway_response'], true);
|
||||
|
||||
nlog($response);
|
||||
//capture
|
||||
$orderID = $response['orderID'];
|
||||
|
||||
@ -235,7 +237,33 @@ class PayPalRestPaymentDriver extends BaseDriver
|
||||
|
||||
}
|
||||
|
||||
try{
|
||||
$r = $this->gatewayRequest("/v2/checkout/orders/{$orderID}/capture", 'post', ['body' => '']);
|
||||
}
|
||||
catch(\Exception $e) {
|
||||
|
||||
//Rescue for duplicate invoice_id
|
||||
if(stripos($e->getMessage(), 'DUPLICATE_INVOICE_ID') !== false){
|
||||
|
||||
|
||||
$_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' => '']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$response = $r;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user