325 lines
12 KiB
PHP
Executable File
325 lines
12 KiB
PHP
Executable File
<?php
|
|
|
|
namespace app\controller\api;
|
|
|
|
use Guzzle\Http\Exception\RequestException;
|
|
use GuzzleHttp\Client;
|
|
use GuzzleHttp\Exception\GuzzleException;
|
|
use think\App;
|
|
use GuzzleHttp\Psr7\Request;
|
|
|
|
class Ceshi
|
|
{
|
|
public function Merchant_reconciliation_download()
|
|
{
|
|
$headers = [
|
|
'Content-Type' => 'application/json',
|
|
'Accept' => '*/*',
|
|
'Host' => '127.0.0.1:23552',
|
|
'Connection' => 'keep-alive'
|
|
];
|
|
$body = '{
|
|
"header": {
|
|
"appId": "000000000010012",
|
|
"appSecret": "8c76d098-ce22-4df8-a01d-ea6f5502e5ec",
|
|
"openEPubK": "3A743B476533D137EAA130F266501CAAE6D0870B1CAF0934D1CA5566F90B763F5B11C4A57B402C102C956ADF0DFDA3BD91F2843C648EAF159A9B08C0C8ACF541",
|
|
"appDPriK": "7D0B1F1BAFAE24436AD322EF35A6784B264700B9402C33F9CA2C6BB7FE325AF9",
|
|
"openVPubK": "7EAFB55A843DCBB33E07E4E59D3AF14216768CC0C8055985633AC753E29F9A5C07586CDBC9806CD31F66B17B12B07193B3C471C3A707C07E793D42B676AF80B1",
|
|
"appSPriK": "E8E0A7F49E2EC0E0C45352BDD4D8579FAC73A258FEDFF919B334DA2103EB32B7",
|
|
"httpDomainName": "https://open-test.scrcu.com:9051/open-gate",
|
|
"apiUrl": "/onlinepay/OPC321560202000200000100",
|
|
"version": "1.0.0"
|
|
},
|
|
"body": {
|
|
"mchtNo": "129765100270890",
|
|
"settleDate": "20200820",
|
|
"reqTime": "20200816153647",
|
|
"reqSsn": "c7c12347878pca8b5555d8d3630553as"
|
|
}
|
|
}';
|
|
$client = new Client(['base_uri' => 'http://127.0.0.1:23552']);
|
|
$request = new Request('POST', 'http://127.0.0.1:23552/sdk/doApi', $headers, $body);
|
|
try {
|
|
$res = $client->send($request);
|
|
} catch (GuzzleException $e) {
|
|
halt($e);
|
|
}
|
|
return $res->getBody()->getContents();
|
|
}
|
|
public function Pay()
|
|
{
|
|
$headers = [
|
|
'Content-Type' => 'application/json',
|
|
'Accept' => '*/*',
|
|
'Host' => '127.0.0.1:23552',
|
|
'Connection' => 'keep-alive'
|
|
];
|
|
$body = '{
|
|
"header": {
|
|
"appId": "000000000010012",
|
|
"appSecret": "8c76d098-ce22-4df8-a01d-ea6f5502e5ec",
|
|
"openEPubK": "3A743B476533D137EAA130F266501CAAE6D0870B1CAF0934D1CA5566F90B763F5B11C4A57B402C102C956ADF0DFDA3BD91F2843C648EAF159A9B08C0C8ACF541",
|
|
"appDPriK": "7D0B1F1BAFAE24436AD322EF35A6784B264700B9402C33F9CA2C6BB7FE325AF9",
|
|
"openVPubK": "7EAFB55A843DCBB33E07E4E59D3AF14216768CC0C8055985633AC753E29F9A5C07586CDBC9806CD31F66B17B12B07193B3C471C3A707C07E793D42B676AF80B1",
|
|
"appSPriK": "E8E0A7F49E2EC0E0C45352BDD4D8579FAC73A258FEDFF919B334DA2103EB32B7",
|
|
"httpDomainName": "https://open-test.scrcu.com:9051/open-gate",
|
|
"apiUrl": "/onlinepay/OPC321560202000200000500",
|
|
"version" :"1.0.0"
|
|
|
|
},
|
|
"body": {
|
|
"charset": "UTF-8",
|
|
"orderType": "01",
|
|
"orderNumber": "f7c646fd1d8pca8b5555d8d363075392",
|
|
"orderCurrency": "01",
|
|
"subject": "测试商品",
|
|
"channel": "02",
|
|
"orderSendTime": "20200713093647",
|
|
"orderAmt": "10",
|
|
"version": "1.0.0",
|
|
"payAmt": "10",
|
|
"backEndUrl": "http://www.testpay.com/backEndU",
|
|
"frontEndUrl": "http://www.testpay.com/frontEndUrl",
|
|
"merId": "129765100270890",
|
|
"orderDetailList": {
|
|
"payType": "",
|
|
"merLst": [
|
|
{
|
|
"subOrderAmt": "10",
|
|
"orderNumber": "f7c646fd1d8pca8b5555d8d363075392",
|
|
"merId": "129765100270890",
|
|
"subPayAmt": "10",
|
|
"autoSettleFlag": "0",
|
|
"goodsInfo": [
|
|
{
|
|
"goodsSubject": "测试商品",
|
|
"goodsPrice": "10",
|
|
"goodsUnit": "斤",
|
|
"goodsNum": "1",
|
|
"goodsTotalAmt": "10",
|
|
"goodsSpec": "10"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"orderAmt": "10",
|
|
"payAmt": "10"
|
|
}
|
|
}
|
|
}';
|
|
$client = new Client(['base_uri' => 'http://127.0.0.1:23552']);
|
|
$request = new Request('POST', 'http://127.0.0.1:23552/sdk/doApi', $headers, $body);
|
|
try {
|
|
$res = $client->send($request);
|
|
} catch (GuzzleException $e) {
|
|
halt($e);
|
|
}
|
|
return $res->getBody()->getContents();
|
|
}
|
|
public function SettlementQuery()
|
|
{
|
|
$headers = [
|
|
'Content-Type' => 'application/json',
|
|
'Accept' => '*/*',
|
|
'Host' => '127.0.0.1:23552',
|
|
'Connection' => 'keep-alive'
|
|
];
|
|
$body = '{
|
|
"header": {
|
|
"appId": "000000000010012",
|
|
"appSecret": "8c76d098-ce22-4df8-a01d-ea6f5502e5ec",
|
|
"openEPubK": "3A743B476533D137EAA130F266501CAAE6D0870B1CAF0934D1CA5566F90B763F5B11C4A57B402C102C956ADF0DFDA3BD91F2843C648EAF159A9B08C0C8ACF541",
|
|
"appDPriK": "7D0B1F1BAFAE24436AD322EF35A6784B264700B9402C33F9CA2C6BB7FE325AF9",
|
|
"openVPubK": "7EAFB55A843DCBB33E07E4E59D3AF14216768CC0C8055985633AC753E29F9A5C07586CDBC9806CD31F66B17B12B07193B3C471C3A707C07E793D42B676AF80B1",
|
|
"appSPriK": "E8E0A7F49E2EC0E0C45352BDD4D8579FAC73A258FEDFF919B334DA2103EB32B7",
|
|
"httpDomainName": "https://open-test.scrcu.com:9051/open-gate",
|
|
"apiUrl": "/onlinepay/OPC321560202000200000200",
|
|
"version" :"1.0.0"
|
|
|
|
},
|
|
"body": {
|
|
"charset": "UTF-8",
|
|
"orderNumber": "f7jugi1dlhna8b5555d8d363075392",
|
|
"subOrderNumber":"f7jugi1dlhna8b5555d8d363075392",
|
|
"settleMerNo":"129765100270890",
|
|
"merId":"129765100270890",
|
|
"version":"V5.0.0"
|
|
|
|
}
|
|
}';
|
|
$client = new Client(['base_uri' => 'http://127.0.0.1:23552']);
|
|
$request = new Request('POST', 'http://127.0.0.1:23552/sdk/doApi', $headers, $body);
|
|
try {
|
|
$res = $client->send($request);
|
|
} catch (GuzzleException $e) {
|
|
halt($e);
|
|
}
|
|
return $res->getBody()->getContents();
|
|
}
|
|
|
|
public function OrderClosure()
|
|
{
|
|
$headers = [
|
|
'Content-Type' => 'application/json',
|
|
'Accept' => '*/*',
|
|
'Host' => '127.0.0.1:23552',
|
|
'Connection' => 'keep-alive'
|
|
];
|
|
$body = '{
|
|
"header": {
|
|
"appId": "000000000010012",
|
|
"appSecret": "8c76d098-ce22-4df8-a01d-ea6f5502e5ec",
|
|
"openEPubK": "3A743B476533D137EAA130F266501CAAE6D0870B1CAF0934D1CA5566F90B763F5B11C4A57B402C102C956ADF0DFDA3BD91F2843C648EAF159A9B08C0C8ACF541",
|
|
"appDPriK": "7D0B1F1BAFAE24436AD322EF35A6784B264700B9402C33F9CA2C6BB7FE325AF9",
|
|
"openVPubK": "7EAFB55A843DCBB33E07E4E59D3AF14216768CC0C8055985633AC753E29F9A5C07586CDBC9806CD31F66B17B12B07193B3C471C3A707C07E793D42B676AF80B1",
|
|
"appSPriK": "E8E0A7F49E2EC0E0C45352BDD4D8579FAC73A258FEDFF919B334DA2103EB32B7",
|
|
"httpDomainName": "https://open-test.scrcu.com:9051/open-gate",
|
|
"apiUrl": "/onlinepay/OPC321560102000200000100",
|
|
"version" :"1.0.0"
|
|
|
|
},
|
|
"body": {
|
|
"orderNumber":"b16808d20c4e4e9eb7224e49756d456f",
|
|
"merId":"129765100278888"
|
|
|
|
}
|
|
}';
|
|
$client = new Client(['base_uri' => 'http://127.0.0.1:23552']);
|
|
$request = new Request('POST', 'http://127.0.0.1:23552/sdk/doApi', $headers, $body);
|
|
try {
|
|
$res = $client->send($request);
|
|
} catch (GuzzleException $e) {
|
|
halt($e);
|
|
}
|
|
return $res->getBody()->getContents();
|
|
}
|
|
|
|
public function OrderQuery()
|
|
{
|
|
$headers = [
|
|
'Content-Type' => 'application/json',
|
|
'Accept' => '*/*',
|
|
'Host' => '127.0.0.1:23552',
|
|
'Connection' => 'keep-alive'
|
|
];
|
|
$body = '{
|
|
"header": {
|
|
"appId": "000000000010012",
|
|
"appSecret": "8c76d098-ce22-4df8-a01d-ea6f5502e5ec",
|
|
"openEPubK": "3A743B476533D137EAA130F266501CAAE6D0870B1CAF0934D1CA5566F90B763F5B11C4A57B402C102C956ADF0DFDA3BD91F2843C648EAF159A9B08C0C8ACF541",
|
|
"appDPriK": "7D0B1F1BAFAE24436AD322EF35A6784B264700B9402C33F9CA2C6BB7FE325AF9",
|
|
"openVPubK": "7EAFB55A843DCBB33E07E4E59D3AF14216768CC0C8055985633AC753E29F9A5C07586CDBC9806CD31F66B17B12B07193B3C471C3A707C07E793D42B676AF80B1",
|
|
"appSPriK": "E8E0A7F49E2EC0E0C45352BDD4D8579FAC73A258FEDFF919B334DA2103EB32B7",
|
|
"httpDomainName": "https://open-test.scrcu.com:9051/open-gate",
|
|
"apiUrl": "/onlinepay/OPC321560202000200000000",
|
|
"version" :"1.0.0"
|
|
|
|
},
|
|
"body": {
|
|
"charset":"UTF-8",
|
|
"orderNumber":"f7c646fd1d8pca8b5555d8d363075393",
|
|
"merId":"129765100270890",
|
|
"version":"v5.0.0",
|
|
"tranType":"04"
|
|
|
|
}
|
|
}';
|
|
$client = new Client(['base_uri' => 'http://127.0.0.1:23552']);
|
|
$request = new Request('POST', 'http://127.0.0.1:23552/sdk/doApi', $headers, $body);
|
|
try {
|
|
$res = $client->send($request);
|
|
} catch (GuzzleException $e) {
|
|
halt($e);
|
|
}
|
|
return $res->getBody()->getContents();
|
|
}
|
|
|
|
public function refund()
|
|
{
|
|
$headers = [
|
|
'Content-Type' => 'application/json',
|
|
'Accept' => '*/*',
|
|
'Host' => '127.0.0.1:23552',
|
|
'Connection' => 'keep-alive'
|
|
];
|
|
$body = '{
|
|
"header": {
|
|
"appId": "000000000010012",
|
|
"appSecret": "8c76d098-ce22-4df8-a01d-ea6f5502e5ec",
|
|
"openEPubK": "3A743B476533D137EAA130F266501CAAE6D0870B1CAF0934D1CA5566F90B763F5B11C4A57B402C102C956ADF0DFDA3BD91F2843C648EAF159A9B08C0C8ACF541",
|
|
"appDPriK": "7D0B1F1BAFAE24436AD322EF35A6784B264700B9402C33F9CA2C6BB7FE325AF9",
|
|
"openVPubK": "7EAFB55A843DCBB33E07E4E59D3AF14216768CC0C8055985633AC753E29F9A5C07586CDBC9806CD31F66B17B12B07193B3C471C3A707C07E793D42B676AF80B1",
|
|
"appSPriK": "E8E0A7F49E2EC0E0C45352BDD4D8579FAC73A258FEDFF919B334DA2103EB32B7",
|
|
"httpDomainName": "https://open-test.scrcu.com:9051/open-gate",
|
|
"apiUrl": "/onlinepay/OPC321560202000200000400",
|
|
"version" :"1.0.0"
|
|
|
|
},
|
|
"body": {
|
|
"charset":"UTF-8",
|
|
"orderNumber":"f7c646mlkd8pca8b5555d8d363075abc",
|
|
"merNo":"129765100270890",
|
|
"channel":"02",
|
|
"oriSubOrderNumber":"f7jugi1d8pca8b5555d8d363075392",
|
|
"merId":"129765100270890",
|
|
"orderSendTime":"20200713093647",
|
|
"orderAmt":"10",
|
|
"oriOrderNumber":"f7jugi1d8pca8b5555d8d363075392",
|
|
"version":"V5.0.0",
|
|
"backEndUrl":"https://www.testpay.com/refund"
|
|
}
|
|
}';
|
|
$client = new Client(['base_uri' => 'http://127.0.0.1:23552']);
|
|
$request = new Request('POST', 'http://127.0.0.1:23552/sdk/doApi', $headers, $body);
|
|
try {
|
|
$res = $client->send($request);
|
|
} catch (GuzzleException $e) {
|
|
halt($e);
|
|
}
|
|
return $res->getBody()->getContents();
|
|
}
|
|
public function NoticeSettlement()
|
|
{
|
|
$headers = [
|
|
'Content-Type' => 'application/json',
|
|
'Accept' => '*/*',
|
|
'Host' => '127.0.0.1:23552',
|
|
'Connection' => 'keep-alive'
|
|
];
|
|
$body = '{
|
|
"header": {
|
|
"appId": "000000000010012",
|
|
"appSecret": "8c76d098-ce22-4df8-a01d-ea6f5502e5ec",
|
|
"openEPubK": "3A743B476533D137EAA130F266501CAAE6D0870B1CAF0934D1CA5566F90B763F5B11C4A57B402C102C956ADF0DFDA3BD91F2843C648EAF159A9B08C0C8ACF541",
|
|
"appDPriK": "7D0B1F1BAFAE24436AD322EF35A6784B264700B9402C33F9CA2C6BB7FE325AF9",
|
|
"openVPubK": "7EAFB55A843DCBB33E07E4E59D3AF14216768CC0C8055985633AC753E29F9A5C07586CDBC9806CD31F66B17B12B07193B3C471C3A707C07E793D42B676AF80B1",
|
|
"appSPriK": "E8E0A7F49E2EC0E0C45352BDD4D8579FAC73A258FEDFF919B334DA2103EB32B7",
|
|
"httpDomainName": "https://open-test.scrcu.com:9051/open-gate",
|
|
"apiUrl": "/onlinepay/OPC321560202000200000400",
|
|
"version" :"1.0.0"
|
|
|
|
},
|
|
"body": {
|
|
"charset":"UTF-8",
|
|
"orderNumber":"f7c646mlkd8pca8b5555d8d363075abc",
|
|
"merNo":"129765100270890",
|
|
"channel":"02",
|
|
"oriSubOrderNumber":"f7jugi1d8pca8b5555d8d363075392",
|
|
"merId":"129765100270890",
|
|
"orderSendTime":"20200713093647",
|
|
"orderAmt":"10",
|
|
"oriOrderNumber":"f7jugi1d8pca8b5555d8d363075392",
|
|
"version":"V5.0.0",
|
|
"backEndUrl":"https://www.testpay.com/refund"
|
|
}
|
|
}';
|
|
$client = new Client(['base_uri' => 'http://127.0.0.1:23552']);
|
|
$request = new Request('POST', 'http://127.0.0.1:23552/sdk/doApi', $headers, $body);
|
|
try {
|
|
$res = $client->send($request);
|
|
} catch (GuzzleException $e) {
|
|
halt($e);
|
|
}
|
|
return $res->getBody()->getContents();
|
|
}
|
|
} |