Skip to content

Commit

Permalink
refactor: change OffSiteGatewayWebhookNotification properties
Browse files Browse the repository at this point in the history
  • Loading branch information
glaubersilva committed Aug 31, 2024
1 parent 90c4420 commit e2bd1b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,34 @@ class OffSiteGatewayWebhookNotification
/**
* @var string
*/
public $notificationType;
public $gatewayNotificationType;

/**
* @var string
*/
public $paymentStatus;
public $gatewayPaymentStatus;

/**
* @var string
*/
public $merchantPaymentId;
public $gatewayPaymentId;

/**
* @var string
*/
public $gatewayPaymentId;
public $merchantPaymentId;

/**
* @unreleased
*/
public static function fromRequest(array $request): OffSiteGatewayWebhookNotification
{
$self = new self();

$self->notificationType = $request['notification_type'] ?? '';
$self->gatewayNotificationType = $request['notification_type'] ?? '';
$self->gatewayPaymentStatus = $request['payment_status'] ?? '';
$self->gatewayPaymentId = $request['payment_id'] ?? '';
$self->merchantPaymentId = $request['merchant_payment_id'] ?? '';

return $self;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __invoke(OffSiteGatewayWebhookNotification $webhookNotification)
return;
}

switch (strtolower($webhookNotification->paymentStatus)) {
switch (strtolower($webhookNotification->gatewayPaymentStatus)) {
case 'complete':
AsBackgroundJobs::enqueueAsyncAction(
'givewp_off-site_gateway_sample_event_donation_completed',
Expand Down

0 comments on commit e2bd1b3

Please sign in to comment.