Skip to content

Commit

Permalink
Merge pull request #53 from paypay/feature/PP-58995
Browse files Browse the repository at this point in the history
Update pending payment refund API
  • Loading branch information
Shreyansh Pandey committed Jan 21, 2021
2 parents f090357 + bdb774b commit 2e8e012
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,28 @@ jobs:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
echo repo_token: ${COVERALLS_REPO_TOKEN} > ./.coveralls.yml
- name: Install dependencies
run: |
pip install pytest
pip install pytest
pip install responses
pip install pytest-cov
pip install coveralls
pip install requests
pip install pyjwt
pip install uuid
- name: Before script
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: test script
run: pytest --cov=tests/ --cov-report xml

- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls
run: coveralls --service=github

- name: Upload to CoPilot
run: bash <(curl -s https://copilot.blackducksoftware.com/ci/githubactions/scripts/upload)
Expand Down
2 changes: 1 addition & 1 deletion paypayopa/constants/api_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class API_NAMES(object):
CREATE_REQUEST_ORDER = "v1_createRequestOrder"
GET_REQUEST_ORDER = "v1_getRequestOrder"
CANCEL_REQUEST_ORDER = "v1_cancelRequestOrder"
REFUND_REQUEST_ORDER = "v1_createRequestOrderRefund"
REFUND_REQUEST_ORDER = "v2_createRefundPayment"
GET_SECURE_USER_PROFILE = "v2_getSecureUserProfile"
CHECK_BALANCE = "v2_checkWalletBalance"
GET_USER_AUTH_STATUS = "v2_userAuthStatus"
Expand Down
1 change: 1 addition & 0 deletions paypayopa/constants/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ class URL(object):
ACCOUNT_LINK = "/v1/qr/sessions"
PENDING_PAYMENT = "/v1/requestOrder"
USER_AUTH = "/v2/user/authorizations"
REFUNDS = "/v2/refunds"
6 changes: 3 additions & 3 deletions paypayopa/resources/pending.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ def cancel_payment(self, id, **kwargs):
return self.delete(None, url, None, api_id=API_NAMES.CANCEL_REQUEST_ORDER, **kwargs)

def refund_payment(self, data={}, **kwargs):
url = "{}/{}".format(self.base_url, 'refunds')
if "requestedAt" not in data:
data['requestedAt'] = datetime.datetime.now().second
url = "{}".format(URL.REFUNDS)
if "merchantPaymentId" not in data:
raise ValueError("\x1b[31m MISSING REQUEST PARAMS "
"\x1b[0m for merchantPaymentId")
if "requestedAt" not in data:
data['requestedAt'] = datetime.datetime.now().second
if "paymentId" not in data:
raise ValueError("\x1b[31m MISSING REQUEST PARAMS "
"\x1b[0m for userAuthorizationId")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_refund_request_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class TestRefundRequestOrder(ClientTestCase):

def setUp(self):
super(TestRefundRequestOrder, self).setUp()
self.base_url = '{}/requestOrder/refunds/'.format(self.base_url)
self.base_url = '{}/v2/refunds/'.format(self.base_url)

@responses.activate
def test_refund_request_order(self):
"""Test refund request order."""
init = mock_file('refund_request_order_payload')
result = mock_file('refund_request_order_response')
url = "https://stg-api.sandbox.paypay.ne.jp/v1/requestOrder/refunds"
url = "https://stg-api.sandbox.paypay.ne.jp/v2/refunds"
responses.add(responses.POST, url, status=200, body=json.dumps(result))
self.assertEqual(self.client.Pending.refund_payment(init), result)

0 comments on commit 2e8e012

Please sign in to comment.