Minor adjustments for mollie payment driver

This commit is contained in:
David Bomba 2022-01-09 13:34:23 +11:00
parent f6f9bccdb4
commit 762f6d4b2e
2 changed files with 9 additions and 2 deletions

View File

@ -27,8 +27,6 @@ class PaymentWebhookRequest extends Request
public function authorize() public function authorize()
{ {
MultiDB::findAndSetDbByCompanyKey($this->company_key);
return true; return true;
} }
@ -47,6 +45,8 @@ class PaymentWebhookRequest extends Request
*/ */
public function getCompanyGateway() public function getCompanyGateway()
{ {
MultiDB::findAndSetDbByCompanyKey($this->company_key);
return CompanyGateway::withTrashed()->findOrFail($this->decodePrimaryKey($this->company_gateway_id)); return CompanyGateway::withTrashed()->findOrFail($this->decodePrimaryKey($this->company_gateway_id));
} }
@ -59,6 +59,9 @@ class PaymentWebhookRequest extends Request
public function getPaymentHash() public function getPaymentHash()
{ {
if ($this->query('hash')) { if ($this->query('hash')) {
MultiDB::findAndSetDbByCompanyKey($this->company_key);
return PaymentHash::where('hash', $this->query('hash'))->firstOrFail(); return PaymentHash::where('hash', $this->query('hash'))->firstOrFail();
} }
@ -72,6 +75,8 @@ class PaymentWebhookRequest extends Request
*/ */
public function getCompany(): ?Company public function getCompany(): ?Company
{ {
MultiDB::findAndSetDbByCompanyKey($this->company_key);
return Company::where('company_key', $this->company_key)->firstOrFail(); return Company::where('company_key', $this->company_key)->firstOrFail();
} }
} }

View File

@ -304,6 +304,8 @@ class MolliePaymentDriver extends BaseDriver
'paid' => Payment::STATUS_COMPLETED, 'paid' => Payment::STATUS_COMPLETED,
]; ];
nlog($request->id);
try { try {
$payment = $this->gateway->payments->get($request->id); $payment = $this->gateway->payments->get($request->id);
$record = Payment::withTrashed()->where('transaction_reference', $request->id)->first(); $record = Payment::withTrashed()->where('transaction_reference', $request->id)->first();