Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #10 from comicrelief/GP-657-notification-card-type
Browse files Browse the repository at this point in the history
GP-657 - Notification card type
  • Loading branch information
ayanozturk authored Sep 1, 2017
2 parents c530ede + 3c27417 commit 418d808
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Omnipay/WorldpayCGHosted/Message/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ public function isValid()
return ($this->originIsValid() && $this->hasStatus());
}

/**
* Gets the card type code in Worldpay format (e.g. 'ECMC-SSL') if available.
*
* @return string|null
*/
public function getCardType()
{
if (empty($this->getOrder()->payment->paymentMethod)) {
return null;
}

return $this->getOrder()->payment->paymentMethod->__toString();
}

/**
* Gets the body of the response your app should provide to the Worldpay bot for this request.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function testAuthorisedValid()
$this->assertEquals('AUTHORISED', $notification->getStatus());
$this->assertInternalType('string', $notification->getTransactionId());
$this->assertEquals('11001100-0000-0000-0000-000011110101', $notification->getTransactionId());
$this->assertEquals('ECMC-SSL', $notification->getCardType());

$this->assertEquals('[OK]', $notification->getResponseBody());
$this->assertEquals(200, $notification->getResponseStatusCode());
Expand Down

0 comments on commit 418d808

Please sign in to comment.