Fixes for square autobill

This commit is contained in:
David Bomba 2023-10-16 07:25:47 +11:00
parent bf93589607
commit 55f71a27c7
2 changed files with 9 additions and 3 deletions

View File

@ -134,8 +134,14 @@ class SquareWebhook implements ShouldQueue
nlog("Searching by payment hash");
$payment_hash_id = $apiResponse->getPayment()->getReferenceId() ?? false;
$square_payment = $apiResponse->getPayment()->jsonSerialize();
$body = json_decode($apiResponse->getBody());
$payment_hash_id = $body->payment->reference_id ?? false;
$square_payment = $body->payment ?? false;
if(!$payment_hash_id)
return;
$payment_hash = PaymentHash::query()->where('hash', $payment_hash_id)->firstOrFail();
$payment_hash->data = array_merge((array) $payment_hash->data, (array)$square_payment);

View File

@ -120,7 +120,7 @@ class AutoBillInvoice extends AbstractService
/* Build payment hash */
$payment_hash = PaymentHash::create([
'hash' => Str::random(64),
'hash' => Str::random(32),
'data' => [
'amount_with_fee' => $amount + $fee,
'invoices' => [