Skip to content

Commit

Permalink
Merge 27185a5 into c23c3ce
Browse files Browse the repository at this point in the history
  • Loading branch information
paypay-ayas committed Sep 28, 2020
2 parents c23c3ce + 27185a5 commit f7ab2a1
Show file tree
Hide file tree
Showing 20 changed files with 471 additions and 125 deletions.
20 changes: 20 additions & 0 deletions mock/mappings/PendingPaymentCancel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"request": {
"method": "DELETE",
"urlPattern": "^\\/v1\\/requestOrder\\/.*[0-9a-zA-Z].*$"
},
"response": {
"status": 201,
"headers": {
"Content-Type": "application/json"
},
"jsonBody": {
"resultInfo": {
"code": "REQUEST_ACCEPTED",
"message": "Request accepted",
"codeId": "08100001"
},
"data": null
}
}
}
30 changes: 30 additions & 0 deletions mock/mappings/PendingPaymentCreate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"request": {
"method": "POST",
"url": "/v1/requestOrder"
},
"response": {
"status": 201,
"headers": {
"Content-Type": "application/json"
},
"jsonBody": {
"resultInfo": {
"code": "SUCCESS",
"message": "Success",
"codeId": "08100001"
},
"data": {
"merchantPaymentId": "TESTMERCH_PAY_ID5f55c201d6359",
"userAuthorizationId": "SAME-USER-AUTH-ID-PROVIDED_BY_YOU",
"amount": {
"amount": 12,
"currency": "JPY"
},
"orderItems": [],
"expiryDate": 1599477346,
"requestedAt": 1599455745
}
}
}
}
36 changes: 36 additions & 0 deletions mock/mappings/PendingPaymentDetails.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"request": {
"method": "GET",
"urlPattern": "^\\/v1\\/requestOrder\\/.*[0-9a-zA-Z].*$"
},
"response": {
"status": 201,
"headers": {
"Content-Type": "application/json"
},
"jsonBody": {
"resultInfo": {
"code": "SUCCESS",
"message": "Success",
"codeId": "08100001"
},
"data": {
"merchantPaymentId": "MERCHANT_PAYMENT_IDENTIFIER",
"userAuthorizationId": "USER_AUTHORIZATION",
"amount": {
"amount": 15,
"currency": "JPY"
},
"orderItems": [],
"status": "COMPLETED",
"requestedAt": 1601281573,
"refunds": {
"data": []
},
"expiryDate": 1601303174,
"paymentId": "PAYPAY_PAYMENT_IDENTIFIER",
"acceptedAt": 1601281610
}
}
}
}
31 changes: 31 additions & 0 deletions mock/mappings/PendingPaymentRefundCreate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"request": {
"method": "POST",
"url": "/v1/requestOrder/refunds"
},
"response": {
"status": 201,
"headers": {
"Content-Type": "application/json"
},
"jsonBody": {
"resultInfo": {
"code": "SUCCESS",
"message": "Success",
"codeId": "08100001"
},
"data": {
"status": "CREATED",
"acceptedAt": 1601280078,
"merchantRefundId": "TESTREFUNDID",
"paymentId": "PAYPAY-PAYMENTID",
"amount": {
"amount": 2,
"currency": "JPY"
},
"requestedAt": 1601280078,
"assumeMerchant": "YOURMERCHANTID"
}
}
}
}
2 changes: 1 addition & 1 deletion mock/mappings/createPayment.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"request": {
"method": "POST",
"url": "/v2/payments"
"urlPath": "/v2/payments"
},
"response": {
"status": 201,
Expand Down
71 changes: 36 additions & 35 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit colors="true">
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-php" target="./build/cov/clover.xml"/>
</logging>
<testsuites>
<testsuite name="Core Classes">
<file> tests/CoreClassesTest.php</file>
</testsuite>
<testsuite name="Payloads">
<file> tests/PayloadsTest.php</file>
</testsuite>
<testsuite name="QR Code">
<file> tests/QrTest.php</file>
</testsuite>
<testsuite name="Payments">
<file> tests/PaymentTest.php</file>
<file> tests/PreAuthTest.php</file>
<file> tests/ContinuousPaymentTest.php</file>
<file> tests/RefundTest.php</file>
</testsuite>
<testsuite name="User">
<file>tests/PipelinedAccountLinkTest.php</file>
<file> tests/UserTest.php</file>
<file> tests/WalletTest.php </file>
</testsuite>
<testsuite name="Housekeeping">
<file> tests/ZCleanupTest.php</file>
</testsuite>
</testsuites>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<php outputFile="./build/cov/clover.xml"/>
</report>
</coverage>
<logging/>
<testsuites>
<testsuite name="Core Classes">
<file> tests/CoreClassesTest.php</file>
</testsuite>
<testsuite name="Payloads">
<file> tests/PayloadsTest.php</file>
</testsuite>
<testsuite name="QR Code">
<file> tests/QrTest.php</file>
</testsuite>
<testsuite name="Payments">
<file> tests/PaymentTest.php</file>
<file> tests/PreAuthTest.php</file>
<file> tests/PendingPaymentTest.php</file>
<file> tests/ContinuousPaymentTest.php</file>
<file> tests/RefundTest.php</file>
</testsuite>
<testsuite name="User">
<file>tests/PipelinedAccountLinkTest.php</file>
<file> tests/UserTest.php</file>
<file> tests/WalletTest.php </file>
</testsuite>
<testsuite name="Housekeeping">
<file> tests/ZCleanupTest.php</file>
</testsuite>
</testsuites>
</phpunit>
38 changes: 38 additions & 0 deletions phpunit.xml.dist.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit colors="true">
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-php" target="./build/cov/clover.xml"/>
</logging>
<testsuites>
<testsuite name="Core Classes">
<file> tests/CoreClassesTest.php</file>
</testsuite>
<testsuite name="Payloads">
<file> tests/PayloadsTest.php</file>
</testsuite>
<testsuite name="QR Code">
<file> tests/QrTest.php</file>
</testsuite>
<testsuite name="Payments">
<file> tests/PaymentTest.php</file>
<file> tests/PreAuthTest.php</file>
<file> tests/PendingPaymentTest.php</file>
<file> tests/ContinuousPaymentTest.php</file>
<file> tests/RefundTest.php</file>
</testsuite>
<testsuite name="User">
<file>tests/PipelinedAccountLinkTest.php</file>
<file> tests/UserTest.php</file>
<file> tests/WalletTest.php </file>
</testsuite>
<testsuite name="Housekeeping">
<file> tests/ZCleanupTest.php</file>
</testsuite>
</testsuites>
</phpunit>
15 changes: 3 additions & 12 deletions src/Controllers/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ public function createQRCode($payload)
$data = $payload->serialize();
$endpoint = '/v2' . $this->main()->GetEndpoint('CODE');
$options = $this->HmacCallOpts('POST', $endpoint, 'application/json;charset=UTF-8;', $data);
$mid = $this->main()->GetMid();
if ($mid) {
$options["HEADERS"]['X-ASSUME-MERCHANT'] = $mid;
}

$options['TIMEOUT'] = 30;

if ($data) {
Expand All @@ -56,10 +53,7 @@ public function getPaymentDetails($merchantPaymentId)
$endpoint = '/v2' . $this->main()->GetEndpoint('CODE') . $main->GetEndpoint('PAYMENT') . "/$merchantPaymentId";
$url = $this->api_url . $main->GetEndpoint('CODE') . $main->GetEndpoint('PAYMENT') . "/$merchantPaymentId";
$options = $this->HmacCallOpts('GET', $endpoint);
$mid = $this->main()->GetMid();
if ($mid) {
$options["HEADERS"]['X-ASSUME-MERCHANT'] = $mid;
}

return $this->doCall('get',$url,[],$options);
}

Expand All @@ -74,10 +68,7 @@ public function deleteQRCode($codeId)
{
$endpoint = '/v2' . $this->main()->GetEndpoint('CODE') . "/$codeId";
$options = $this->HmacCallOpts('DELETE', $endpoint);
$mid = $this->main()->GetMid();
if ($mid) {
$options["HEADERS"]['X-ASSUME-MERCHANT'] = $mid;
}

$url = $this->api_url . $this->main()->GetEndpoint('CODE') . "/$codeId";
return $this->doCall('delete',$url,[],$options);
}
Expand Down
Loading

0 comments on commit f7ab2a1

Please sign in to comment.