Skip to content

Commit

Permalink
Merge c032c30 into 53aa137
Browse files Browse the repository at this point in the history
  • Loading branch information
ashraf-km committed Dec 23, 2020
2 parents 53aa137 + c032c30 commit e5fba4f
Show file tree
Hide file tree
Showing 45 changed files with 945 additions and 3 deletions.
3 changes: 2 additions & 1 deletion paypayopa/resources/code.py
Expand Up @@ -3,6 +3,7 @@
from ..constants.api_list import API_NAMES
import datetime


class Code(Resource):
def __init__(self, client=None):
super(Code, self).__init__(client)
Expand Down Expand Up @@ -44,7 +45,7 @@ def create_qr_code(self, data=None, **kwargs):
def get_payment_details(self, id, **kwargs):
url = "{}/{}/{}".format(self.base_url, 'payments', id)
if id is None:
raise ValueError("\x1b[31m MISSING REQUEST PARAMS"
raise ValueError("\x1b[31m MISSING REQUESTS PARAMS"
" \x1b[0m for merchantPaymentId")
return self.fetch(None, url, None, api_id=API_NAMES.GET_QR_PAYMENT, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion paypayopa/resources/preauth.py
Expand Up @@ -31,4 +31,4 @@ def pre_authorize_create(self, data={}, **kwargs):
if "currency" not in data["amount"]:
raise ValueError("\x1b[31m MISSING REQUEST PARAMS"
" \x1b[0m for currency")
return self.post_url(url, data, api_id=API_NAMES.PREAUTHORIZE_PAYMENT **kwargs)
return self.post_url(url, data, api_id=API_NAMES.PREAUTHORIZE_PAYMENT, **kwargs)
2 changes: 1 addition & 1 deletion paypayopa/resources/user.py
Expand Up @@ -23,4 +23,4 @@ def unlink_user_athorization(self, id=None, **kwargs):
raise ValueError("\x1b[31m MISSING REQUEST PARAMS"
" \x1b[0m for codeId")
url = "{}/{}".format(self.base_url, id)
return self.delete(None, url, api_id=API_NAMES.UNLINK_USER **kwargs)
return self.delete(None, url, api_id=API_NAMES.UNLINK_USER, **kwargs)
7 changes: 7 additions & 0 deletions tests/mocks/cancel_payment.json
@@ -0,0 +1,7 @@
{
"resultInfo": {
"code": "fake_code",
"message": "string",
"codeId": "fake_codeId"
}
}
7 changes: 7 additions & 0 deletions tests/mocks/cancel_request_order_response.json
@@ -0,0 +1,7 @@
{
"resultInfo": {
"code": "string",
"message": "string",
"codeId": "string"
}
}
10 changes: 10 additions & 0 deletions tests/mocks/capture_payment_payload.json
@@ -0,0 +1,10 @@
{
"merchantPaymentId": "string",
"amount": {
"amount": 0,
"currency": "JPY"
},
"merchantCaptureId": "string",
"requestedAt": 0,
"orderDescription": "string"
}
26 changes: 26 additions & 0 deletions tests/mocks/capture_payment_response.json
@@ -0,0 +1,26 @@
{
"resultInfo": {
"code": "string",
"message": "string",
"codeId": "string"
},
"data": {
"paymentId": "string",
"status": "COMPLETED",
"acceptedAt": 0,
"refunds": {},
"captures": {},
"merchantPaymentId": "string",
"userAuthorizationId": "string",
"amount": {},
"requestedAt": 0,
"expiresAt": null,
"storeId": "string",
"terminalId": "string",
"orderReceiptNumber": "string",
"orderDescription": "string",
"orderItems": [],
"metadata": {},
"assumeMerchant": "string"
}
}
26 changes: 26 additions & 0 deletions tests/mocks/create_continues_payment_payload.json
@@ -0,0 +1,26 @@
{
"merchantPaymentId": "fake_merchantPaymentId",
"userAuthorizationId": "fake_userAuthorizationId",
"amount": {
"amount": 0,
"currency": "JPY"
},
"requestedAt": 0,
"storeId": "string",
"terminalId": "string",
"orderReceiptNumber": "string",
"orderDescription": "string",
"orderItems": [
{
"name": "string",
"category": "string",
"quantity": 1,
"productId": "string",
"unitPrice": {
"amount": 0,
"currency": "JPY"
}
}
],
"metadata": {}
}
49 changes: 49 additions & 0 deletions tests/mocks/create_continues_payment_response.json
@@ -0,0 +1,49 @@
{
"resultInfo": {
"code": "string",
"message": "string",
"codeId": "string"
},
"data": {
"paymentId": "string",
"status": "CREATED",
"acceptedAt": 0,
"refunds": {
"data": [
{
"status": "CREATED",
"acceptedAt": 0,
"merchantRefundId": "string",
"paymentId": "string",
"amount": {},
"requestedAt": 0,
"reason": "string"
}
]
},
"merchantPaymentId": "string",
"userAuthorizationId": "string",
"amount": {
"amount": 0,
"currency": "JPY"
},
"requestedAt": 0,
"storeId": "string",
"terminalId": "string",
"orderReceiptNumber": "string",
"orderDescription": "string",
"orderItems": [
{
"name": "string",
"category": "string",
"quantity": 1,
"productId": "string",
"unitPrice": {
"amount": 0,
"currency": "JPY"
}
}
],
"metadata": {}
}
}
27 changes: 27 additions & 0 deletions tests/mocks/create_payment_payload.json
@@ -0,0 +1,27 @@
{
"merchantPaymentId": "string",
"userAuthorizationId": "string",
"amount": {
"amount": 0,
"currency": "JPY"
},
"requestedAt": 0,
"storeId": "string",
"terminalId": "string",
"orderReceiptNumber": "string",
"orderDescription": "string",
"orderItems": [
{
"name": "string",
"category": "string",
"quantity": 1,
"productId": "string",
"unitPrice": {
"amount": 0,
"currency": "JPY"
}
}
],
"metadata": {},
"productType": "VIRTUAL_BONUS_INVESTMENT"
}
49 changes: 49 additions & 0 deletions tests/mocks/create_payment_response.json
@@ -0,0 +1,49 @@
{
"resultInfo": {
"code": "string",
"message": "string",
"codeId": "string"
},
"data": {
"paymentId": "string",
"status": "CREATED",
"acceptedAt": 0,
"refunds": {
"data": [
{
"status": "CREATED",
"acceptedAt": 0,
"merchantRefundId": "string",
"paymentId": "string",
"amount": {
"amount": 0,
"currency": "JPY"
},
"requestedAt": 0,
"reason": "string"
}
]
},
"merchantPaymentId": "string",
"userAuthorizationId": "string",
"amount": {
"amount": 0,
"currency": "JPY"
},
"requestedAt": 0,
"storeId": "string",
"terminalId": "string",
"orderReceiptNumber": "string",
"orderDescription": "string",
"orderItems": [
{
"name": "string",
"category": "string",
"quantity": 1,
"productId": "string",
"unitPrice": {}
}
],
"metadata": {}
}
}
7 changes: 7 additions & 0 deletions tests/mocks/delete_qrcode.json
@@ -0,0 +1,7 @@
{
"resultInfo": {
"code": "test_code",
"message": "test message",
"codeId": "test_id"
}
}
27 changes: 27 additions & 0 deletions tests/mocks/get_payment_details.json
@@ -0,0 +1,27 @@
{
"resultInfo": {
"code": "fake_code",
"message": "string",
"codeId": "fake_codeId"
},
"data": {
"paymentId": "string",
"status": "CREATED",
"acceptedAt": 0,
"refunds": {},
"captures": {},
"revert": {},
"merchantPaymentId": "cb31bcc0-3b6c-46e0-9002-e5c4bb1e3d5f",
"userAuthorizationId": "string",
"amount": {},
"requestedAt": 0,
"expiresAt": null,
"canceledAt": null,
"storeId": "string",
"terminalId": "string",
"orderReceiptNumber": "string",
"orderDescription": "string",
"orderItems": [],
"metadata": {}
}
}
53 changes: 53 additions & 0 deletions tests/mocks/get_request_order_response.json
@@ -0,0 +1,53 @@
{
"resultInfo": {
"code": "string",
"message": "string",
"codeId": "string"
},
"data": {
"paymentId": "string",
"status": "CREATED",
"acceptedAt": 0,
"refunds": {
"data": [
{
"status": "CREATED",
"acceptedAt": 0,
"merchantRefundId": "string",
"paymentId": "string",
"amount": {
"amount": 0,
"currency": "JPY"
},
"requestedAt": 0,
"reason": "string"
}
]
},
"merchantPaymentId": "string",
"userAuthorizationId": "string",
"amount": {
"amount": 0,
"currency": "JPY"
},
"requestedAt": 0,
"expiryDate": null,
"storeId": "string",
"terminalId": "string",
"orderReceiptNumber": "string",
"orderDescription": "string",
"orderItems": [
{
"name": "string",
"category": "string",
"quantity": 1,
"productId": "string",
"unitPrice": {
"amount": 0,
"currency": "JPY"
}
}
],
"metadata": {}
}
}
17 changes: 17 additions & 0 deletions tests/mocks/get_user_auth_status.json
@@ -0,0 +1,17 @@
{
"resultInfo": {
"code": "string",
"message": "string",
"codeId": "string"
},
"data": {
"userAuthorizationId": "string",
"referenceIds": [],
"status": "ACTIVE",
"scopes": [
"preauth_capture_native"
],
"expireAt": 0,
"issuedAt": 0
}
}
27 changes: 27 additions & 0 deletions tests/mocks/preauth_payload.json
@@ -0,0 +1,27 @@
{
"merchantPaymentId": "string",
"userAuthorizationId": "string",
"amount": {
"amount": 0,
"currency": "JPY"
},
"requestedAt": 0,
"expiresAt": 1234567890,
"storeId": "string",
"terminalId": "string",
"orderReceiptNumber": "string",
"orderDescription": "string",
"orderItems": [
{
"name": "string",
"category": "string",
"quantity": 1,
"productId": "string",
"unitPrice": {
"amount": 0,
"currency": "JPY"
}
}
],
"metadata": {}
}

0 comments on commit e5fba4f

Please sign in to comment.