Add square webhook tests

This commit is contained in:
David Bomba 2023-08-20 19:20:12 +10:00
parent dfb19f9d4a
commit fdd9501af6
2 changed files with 22 additions and 1 deletions

View File

@ -272,7 +272,7 @@ class SquareWebhook implements ShouldQueue
}
else{
nlog("Square Webhook - Payment not found: $payment_reference");
nlog("Square Webhook - Payment not found: {$payment_reference}");
nlog($apiResponse->getErrors());
return null;
}

View File

@ -386,6 +386,27 @@ class SquarePaymentDriver extends BaseDriver
}
public function testWebhook()
{
$this->init();
$body = new \Square\Models\TestWebhookSubscriptionRequest();
$body->setEventType('payment.created');
//getsubscriptionid here
$api_response = $this->square->getWebhookSubscriptionsApi()->testWebhookSubscription('subscription_id0', $body);
if ($api_response->isSuccess()) {
$result = $api_response->getResult();
nlog($result);
} else {
$errors = $api_response->getErrors();
nlog($errors);
}
}
public function convertAmount($amount)
{
$precision = $this->client->currency()->precision;