Skip to content

Commit

Permalink
get payment info
Browse files Browse the repository at this point in the history
  • Loading branch information
recca0120 committed Nov 14, 2023
1 parent 80ae237 commit da31fc5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Omnipay\MyCash\Message\CompletePurchaseRequest;
use Omnipay\MyCash\Message\FetchTransactionRequest;
use Omnipay\MyCash\Message\PurchaseRequest;
use Omnipay\MyCash\Message\ReceiveTransactionInfoRequest;
use Omnipay\MyCash\Message\GetPaymentInfoRequest;
use Omnipay\MyCash\Traits\HasMyCash;

/**
Expand Down Expand Up @@ -39,7 +39,7 @@ public function purchase(array $options = [])
public function completePurchase(array $options = [])
{
if ($this->httpRequest->request->get('RtnCode') === '5') {
return $this->receiveTransactionInfo($options);
return $this->getPaymentInfo($options);
}

return $this->createRequest(CompletePurchaseRequest::class, $options);
Expand All @@ -48,15 +48,15 @@ public function completePurchase(array $options = [])
public function acceptNotification(array $options = [])
{
if ($this->httpRequest->request->get('RtnCode') === '5') {
return $this->receiveTransactionInfo($options);
return $this->getPaymentInfo($options);
}

return $this->createRequest(AcceptNotificationRequest::class, $options);
}

public function receiveTransactionInfo(array $options = [])
public function getPaymentInfo(array $options = [])
{
return $this->createRequest(ReceiveTransactionInfoRequest::class, $options);
return $this->createRequest(GetPaymentInfoRequest::class, $options);
}

public function fetchTransaction(array $options = [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Omnipay\Common\Message\AbstractRequest;
use Omnipay\MyCash\Traits\HasMyCash;

class ReceiveTransactionInfoRequest extends AbstractRequest
class GetPaymentInfoRequest extends AbstractRequest
{
use HasMyCash;

Expand All @@ -28,10 +28,10 @@ public function getData()

/**
* @param array $data
* @return ReceiveTransactionInfoResponse
* @return GetPaymentInfoResponse
*/
public function sendData($data)
{
return $this->response = new ReceiveTransactionInfoResponse($this, $data);
return $this->response = new GetPaymentInfoResponse($this, $data);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Omnipay\MyCash\Message;

class ReceiveTransactionInfoResponse extends CompletePurchaseResponse
class GetPaymentInfoResponse extends CompletePurchaseResponse
{
/**
* @return bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Omnipay\MyCash\Tests\Message;

use Omnipay\MyCash\Message\ReceiveTransactionInfoRequest;
use Omnipay\MyCash\Message\GetPaymentInfoRequest;
use Omnipay\Tests\TestCase;

class ReceiveTransactionInfoRequestTest extends TestCase
class GetPaymentInfoRequestTest extends TestCase
{
private $initialize = [
'HashKey' => 'FEFRGFEFWEF', // 廠商 HashKey(由易沛提供)
Expand All @@ -30,7 +30,7 @@ public function testATMReceiveTransactionInfoRequest(): void
];

$this->getHttpRequest()->request->add($options);
$request = new ReceiveTransactionInfoRequest($this->getHttpClient(), $this->getHttpRequest());
$request = new GetPaymentInfoRequest($this->getHttpClient(), $this->getHttpRequest());
$request->initialize($this->initialize);

$response = $request->send();
Expand Down Expand Up @@ -66,7 +66,7 @@ public function testCVSReceiveTransactionInfoRequest(): void
];

$this->getHttpRequest()->request->add($options);
$request = new ReceiveTransactionInfoRequest($this->getHttpClient(), $this->getHttpRequest());
$request = new GetPaymentInfoRequest($this->getHttpClient(), $this->getHttpRequest());
$request->initialize($this->initialize);

$response = $request->send();
Expand Down

0 comments on commit da31fc5

Please sign in to comment.