This repository has been archived by the owner on Feb 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added user fields, added inquire request, and fixed bugs
- Loading branch information
jmauzyk
committed
Apr 20, 2021
1 parent
217833a
commit 90ad377
Showing
8 changed files
with
92 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Omnipay\Cardconnect\Message; | ||
|
||
class InquireRequest extends AbstractRequest | ||
{ | ||
public function getData() | ||
{ | ||
$this->validate('transactionReference'); | ||
$data = [ | ||
'merchid' => $this->getMerchantId(), | ||
'retref' => $this->getTransactionReference() | ||
]; | ||
return $data; | ||
} | ||
|
||
public function sendData($data) | ||
{ | ||
$authString = $this->getApiUsername() . ':' . $this->getApiPassword(); | ||
$headers = ['Authorization' => 'Basic ' . base64_encode($authString)]; | ||
$httpResponse = $this->httpClient->request('GET', $this->getEndpoint($data), $headers); | ||
return $this->createResponse($httpResponse); | ||
} | ||
|
||
public function getEndpoint($data) | ||
{ | ||
$path = $data['retref'] . '/' . $data['merchid']; | ||
return $this->getEndpointBase() . '/inquire/' . $path; | ||
} | ||
|
||
protected function createResponse($data) | ||
{ | ||
$jsonData = json_decode($data->getBody()->getContents(), true); | ||
return $this->response = new InquireResponse($this, $jsonData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Omnipay\Cardconnect\Message; | ||
|
||
use Omnipay\Common\Message\AbstractResponse; | ||
|
||
/** | ||
* Get Card Response | ||
* | ||
* This is the response class for CardConnect get card requests. | ||
* | ||
* @see \Omnipay\Cardconnect\Gateway | ||
*/ | ||
class InquireResponse extends AbstractResponse | ||
{ | ||
public function isSuccessful() | ||
{ | ||
return count($this->data) && !isset($this->data['respcode']); | ||
} | ||
|
||
public function getMessage() | ||
{ | ||
return isset($this->data['resptext']) ? $this->data['resptext'] : null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters