-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joe
committed
Dec 13, 2017
1 parent
df82001
commit cd3d31f
Showing
7 changed files
with
288 additions
and
136 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
|
||
/** | ||
* 交易确认 | ||
*/ | ||
namespace Omnipay\MyCard\Message; | ||
|
||
|
||
class ConfirmRequest extends AbstractRequest | ||
{ | ||
|
||
public function getData() | ||
{ | ||
$endpoint = $this->getEndpoint('b2b') . '/MyBillingPay/api/PaymentConfirm'; | ||
$requestData = [ | ||
'AuthCode' => $this->getToken() | ||
]; | ||
$response = $this->httpClient->post($endpoint, null, $requestData)->send(); | ||
$data = json_decode($response->getBody(), true); | ||
return $data; | ||
} | ||
|
||
|
||
public function sendData($data) | ||
{ | ||
return new ConfirmResponse($this, $data); | ||
} | ||
|
||
} |
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,54 @@ | ||
<?php | ||
|
||
namespace Omnipay\MyCard\Message; | ||
|
||
|
||
/* | ||
* | ||
* 确认返回格式: | ||
* array[ | ||
* "ReturnCode" => "MBP006" | ||
* "ReturnMsg" => "查無授權交易,交易狀態可能不符合" | ||
* "FacTradeSeq" => "" | ||
* "TradeSeq" => "" | ||
* "MyCardTradeNo" => null | ||
* "SerialId" => "" | ||
* ] | ||
* | ||
*/ | ||
use Omnipay\Common\Message\AbstractResponse; | ||
|
||
class ConfirmResponse extends AbstractResponse | ||
{ | ||
|
||
// 二次确认会失败 ReturnCode=MBP006 | ||
public function isSuccessful() | ||
{ | ||
return ($this->getData()['ReturnCode'] == 1) ? true : false; | ||
} | ||
|
||
|
||
public function isPaid() | ||
{ | ||
return $this->isSuccessful(); | ||
} | ||
|
||
|
||
public function getTransactionId() | ||
{ | ||
return $this->getData()['FacTradeSeq']; | ||
} | ||
|
||
|
||
public function getCard() | ||
{ | ||
return $this->getData()['MyCardTradeNo']; | ||
} | ||
|
||
|
||
public function getMessage() | ||
{ | ||
return $this->getData()['ReturnMsg']; | ||
} | ||
|
||
} |
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
Oops, something went wrong.