From 066f72156cfef6ebce393118863f64844b6bbe7b Mon Sep 17 00:00:00 2001 From: "javeeth.basha" Date: Tue, 22 Feb 2022 16:15:41 +0530 Subject: [PATCH 01/64] semgrep integration --- .github/workflows/security.yml | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/security.yml diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml new file mode 100644 index 00000000..3e35981b --- /dev/null +++ b/.github/workflows/security.yml @@ -0,0 +1,51 @@ +name: SecurityChecks +on: + pull_request: {} + push: + branches: ["master", "semgrep_integration"] + schedule: + - cron: '30 20 * * *' +jobs: + semgrep: + name: Scan + runs-on: [ubuntu-latest] # nosemgrep : semgrep.dev/s/swati31196:github_provided_runner + steps: + - uses: actions/checkout@v2 + - uses: returntocorp/semgrep-action@v1 + with: + publishToken: ${{ secrets.SEMGREP_APP_TOKEN }} + publishDeployment: 339 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + workflow_status: + runs-on: [ ubuntu-latest ] # nosemgrep : semgrep.dev/s/swati31196:github_provided_runner + name: Update Status Check + needs: [ semgrep ] + if: always() + env: + githubCommit: ${{ github.event.pull_request.head.sha }} + steps: + - name: Set github commit id + run: | + if [ "${{ github.event_name }}" = "push" ] || [ "${{ github.event_name }}" = "schedule" ]; then + echo "githubCommit=${{ github.sha }}" >> $GITHUB_ENV + fi + exit 0 + - name: Failed + id: failed + if: (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) && github.ref != 'refs/heads/master' + run: | + echo 'Failing the workflow for github security status check.' + curl -X POST -H "Content-Type: application/json" -H "Authorization: token ${{ github.token }}" \ + -d '{ "state" : "failure" , "context" : "github/security-status-check" , "description" : "github/security-status-check", "target_url" : "https://github.com/${{ github.repository }}" }' \ + https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.githubCommit }} + exit 1 + - name: Success + if: steps.failed.conclusion == 'skipped' || github.ref != 'refs/heads/master' + run: | + echo 'Status check has passed!' + curl -X POST -H "Content-Type: application/json" -H "Authorization: token ${{ github.token }}" \ + -d '{ "state" : "success" , "context" : "github/security-status-check" , "description" : "github/security-status-check", "target_url" : "https://github.com/${{ github.repository }}" }' \ + https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.githubCommit }} + exit 0 From f2ff14ae8f2e22aecda0888ea841b99350f33776 Mon Sep 17 00:00:00 2001 From: thotakartheek004 Date: Mon, 7 Mar 2022 17:13:56 +0530 Subject: [PATCH 02/64] changes --- .github/workflows/python.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index eed9b5c9..617c42f6 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -13,8 +13,7 @@ on: jobs: deploy: - - runs-on: ubuntu-latest + runs-on: [self-hosted] strategy: max-parallel: 4 matrix: @@ -30,4 +29,4 @@ jobs: pip install responses python3 setup.py install - name: Run Tests - run: python3 -m unittest \ No newline at end of file + run: python3 -m unittest From d69ba9f36a4e5671e05ebf15fca36738429f0743 Mon Sep 17 00:00:00 2001 From: thotakartheek004 Date: Mon, 7 Mar 2022 17:18:19 +0530 Subject: [PATCH 03/64] nosemgrep --- razorpay/resources/payment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/razorpay/resources/payment.py b/razorpay/resources/payment.py index 93a448d2..07195143 100644 --- a/razorpay/resources/payment.py +++ b/razorpay/resources/payment.py @@ -34,7 +34,7 @@ def fetch(self, payment_id, data={}, **kwargs): """ return super(Payment, self).fetch(payment_id, data, **kwargs) - def capture(self, payment_id, amount, data={}, **kwargs): + def capture(self, payment_id, amount, data={}, **kwargs): # nosemgrep : python.lang.correctness.common-mistakes.default-mutable-dict.default-mutable-dict """" Capture Payment for given Id @@ -49,7 +49,7 @@ def capture(self, payment_id, amount, data={}, **kwargs): data['amount'] = amount return self.post_url(url, data, **kwargs) - def refund(self, payment_id, amount, data={}, **kwargs): # pragma: no cover + def refund(self, payment_id, amount, data={}, **kwargs): # pragma: no cover # nosemgrep : python.lang.correctness.common-mistakes.default-mutable-dict.default-mutable-dict """" Refund Payment for given Id From fff98391b83334740a6115e475d162b832059031 Mon Sep 17 00:00:00 2001 From: thotakartheek004 Date: Mon, 7 Mar 2022 17:25:06 +0530 Subject: [PATCH 04/64] nosemgrep --- razorpay/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/razorpay/client.py b/razorpay/client.py index ba9ad28b..91e1d573 100644 --- a/razorpay/client.py +++ b/razorpay/client.py @@ -83,7 +83,7 @@ def _update_user_agent_header(self, options): def _get_version(self): version = "" - try: + try: # nosemgrep : gitlab.bandit.B110 version = pkg_resources.require("razorpay")[0].version except DistributionNotFound: # pragma: no cover pass From 6d7f4fa089f2b3d36e2c73aebe10a9c4a2b30a55 Mon Sep 17 00:00:00 2001 From: thotakartheek004 Date: Mon, 7 Mar 2022 17:25:54 +0530 Subject: [PATCH 05/64] nosemgrep --- razorpay/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/razorpay/client.py b/razorpay/client.py index 91e1d573..f835e139 100644 --- a/razorpay/client.py +++ b/razorpay/client.py @@ -137,7 +137,7 @@ def request(self, method, path, **options): raise BadRequestError(msg) elif str.upper(code) == ERROR_CODE.GATEWAY_ERROR: raise GatewayError(msg) - elif str.upper(code) == ERROR_CODE.SERVER_ERROR: + elif str.upper(code) == ERROR_CODE.SERVER_ERROR: # nosemgrep : python.lang.maintainability.useless-ifelse.useless-if-body raise ServerError(msg) else: raise ServerError(msg) From 83f30132442109eba516bedca84a258901b0f4dd Mon Sep 17 00:00:00 2001 From: thotakartheek004 Date: Mon, 7 Mar 2022 17:28:54 +0530 Subject: [PATCH 06/64] changes --- .github/workflows/python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 617c42f6..00046c0d 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -13,7 +13,7 @@ on: jobs: deploy: - runs-on: [self-hosted] + runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: From 5dcf626aba2c87a4688dee1c03dab5a7e33a7a0b Mon Sep 17 00:00:00 2001 From: thotakartheek004 Date: Mon, 7 Mar 2022 17:29:58 +0530 Subject: [PATCH 07/64] changes --- .github/workflows/python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 00046c0d..6fa7a3b2 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -13,7 +13,7 @@ on: jobs: deploy: - runs-on: ubuntu-latest + runs-on: ubuntu-latest # nosemgrep : semgrep.dev/s/swati31196:github_provided_runner strategy: max-parallel: 4 matrix: From 12b73b780808cf2371a8343d04a0bff36043a0dd Mon Sep 17 00:00:00 2001 From: thotakartheek004 Date: Mon, 7 Mar 2022 17:31:13 +0530 Subject: [PATCH 08/64] changes --- .github/workflows/security.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 3e35981b..6a035cd4 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -2,7 +2,7 @@ name: SecurityChecks on: pull_request: {} push: - branches: ["master", "semgrep_integration"] + branches: ["master"] schedule: - cron: '30 20 * * *' jobs: From a214b8973d52dcfb4761ebc29ed65011097395a0 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 20 May 2022 14:00:22 +0530 Subject: [PATCH 09/64] otp implement --- documents/payment.md | 95 ++++++++++++++++++++++++++++++ razorpay/resources/payment.py | 40 +++++++++++++ tests/mocks/fake_otp_generate.json | 19 ++++++ tests/mocks/fake_otp_resend.json | 7 +++ tests/mocks/fake_otp_submit.json | 5 ++ tests/test_client_payment.py | 45 +++++++++++++- 6 files changed, 209 insertions(+), 2 deletions(-) create mode 100644 tests/mocks/fake_otp_generate.json create mode 100644 tests/mocks/fake_otp_resend.json create mode 100644 tests/mocks/fake_otp_submit.json diff --git a/documents/payment.md b/documents/payment.md index b9addc4a..00c87dab 100644 --- a/documents/payment.md +++ b/documents/payment.md @@ -438,6 +438,101 @@ client.payment.createPaymentJson({ ``` ------------------------------------------------------------------------------------------------------- +### OTP Generate + +```py +client.payment.otpGenerate(paymentId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| paymentId* | integer | Unique identifier of the payment | + +Doc reference [doc](https://razorpay.com/docs/payments/payment-gateway/s2s-integration/json/v2/build-integration/cards/#otp-generation-) + +**Response:**
+ +```json +{ + "razorpay_payment_id": "pay_FVmAstJWfsD3SO", + "next": [ + { + "action": "otp_submit", + "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_submit/ac2d415a8be7595de09a24b41661729fd9028fdc?key_id=" + }, + { + "action": "otp_resend", + "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_resend/json?key_id=" + } + ], + "metadata": { + "issuer": "HDFC", + "network": "MC", + "last4": "1111", + "iin": "411111" + } +} +``` +------------------------------------------------------------------------------------------------------- + +### OTP Submit + +```py +client.payment.otpSubmit(paymentId,{ + "otp": "12345" + }) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| paymentId* | integer | Unique identifier of the payment | +| otp* | string | The customer receives the OTP using their preferred notification medium - SMS or email | + +Doc reference [doc](https://razorpay.com/docs/payments/payment-gateway/s2s-integration/json/v2/build-integration/cards/#response-on-submitting-otp) + +**Response:**
+Success +```json +{ + "razorpay_payment_id": "pay_D5jmY2H6vC7Cy3", + "razorpay_order_id": "order_9A33XWu170gUtm", + "razorpay_signature": "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" +} +``` +------------------------------------------------------------------------------------------------------- + +### OTP Resend + +```py +client.payment.otpResend(paymentId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| paymentId* | integer | Unique identifier of the payment | + +Doc reference [doc](https://razorpay.com/docs/payments/payment-methods/cards/authentication/native-otp/#otp-resend) + +**Response:**
+ +```json +{ + "next": [ + "otp_submit", + "otp_resend" + ], + "razorpay_payment_id": "pay_JWaNvYmrx75sXo" +} +``` + +------------------------------------------------------------------------------------------------------- + **PN: * indicates mandatory fields**

diff --git a/razorpay/resources/payment.py b/razorpay/resources/payment.py index 93a448d2..4cb36c36 100644 --- a/razorpay/resources/payment.py +++ b/razorpay/resources/payment.py @@ -223,3 +223,43 @@ def createRecurring(self, data={}, **kwargs): """ url = "{}/{}/recurring".format(self.base_url,'create') return self.post_url(url, data, **kwargs) + + def otpGenerate(self, payment_id, data={}, **kwargs): + """" + Otp Generate + + Args: + payment_id : Id for which upi transfer entity has to be fetched + + Returns: + Otp Dict which was created + """ + url = "{}/{}/otp_generate".format(self.base_url, payment_id) + return self.post_url(url, data, **kwargs) + + def otpSubmit(self, payment_id, data={}, **kwargs): + """" + Otp Submit + + Args: + payment_id : Id for which upi transfer entity has to be fetched + + Returns: + Otp Dict which was created + """ + url = "{}/{}/otp/submit".format(self.base_url, payment_id) + return self.post_url(url, data, **kwargs) + + def otpResend(self, payment_id, data={}, **kwargs): + """" + Otp Resend + + Args: + payment_id : Id for which upi transfer entity has to be fetched + + Returns: + Otp Dict which was created + """ + url = "{}/{}/otp/resend".format(self.base_url, payment_id) + return self.post_url(url, data, **kwargs) + \ No newline at end of file diff --git a/tests/mocks/fake_otp_generate.json b/tests/mocks/fake_otp_generate.json new file mode 100644 index 00000000..26f14941 --- /dev/null +++ b/tests/mocks/fake_otp_generate.json @@ -0,0 +1,19 @@ +{ + "razorpay_payment_id": "pay_FVmAstJWfsD3SO", + "next": [ + { + "action": "otp_submit", + "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_submit/ac2d415a8be7595de09a24b41661729fd9028fdc?key_id=" + }, + { + "action": "otp_resend", + "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_resend/json?key_id=" + } + ], + "metadata": { + "issuer": "HDFC", + "network": "MC", + "last4": "1111", + "iin": "411111" + } +} diff --git a/tests/mocks/fake_otp_resend.json b/tests/mocks/fake_otp_resend.json new file mode 100644 index 00000000..1cca81f1 --- /dev/null +++ b/tests/mocks/fake_otp_resend.json @@ -0,0 +1,7 @@ +{ + "next": [ + "otp_submit", + "otp_resend" + ], + "razorpay_payment_id": "pay_JWaNvYmrx75sXo" + } \ No newline at end of file diff --git a/tests/mocks/fake_otp_submit.json b/tests/mocks/fake_otp_submit.json new file mode 100644 index 00000000..b13b5b23 --- /dev/null +++ b/tests/mocks/fake_otp_submit.json @@ -0,0 +1,5 @@ +{ + "razorpay_payment_id": "pay_D5jmY2H6vC7Cy3", + "razorpay_order_id": "order_9A33XWu170gUtm", + "razorpay_signature": "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" +} diff --git a/tests/test_client_payment.py b/tests/test_client_payment.py index 794ccad0..0440f94f 100644 --- a/tests/test_client_payment.py +++ b/tests/test_client_payment.py @@ -196,8 +196,9 @@ def test_payment_json(self): responses.add(responses.POST, url, status=200, body=json.dumps(result), match_querystring=True) self.assertEqual(self.client.payment.createPaymentJson(param), result) - - def createRecurring(self): + + @responses.activate + def test_createRecurring(self): init = mock_file('init_create_recurring') result = mock_file('fake_create_recurring') url = "{}/{}/recurring".format(self.base_url,'create') @@ -208,3 +209,43 @@ def createRecurring(self): match_querystring=True) self.assertEqual(self.client.payment.createRecurring(init), result) + + @responses.activate + def test_otpGenerate(self): + result = mock_file('fake_otp_generate') + url = "{}/{}/otp_generate".format(self.base_url,'dummy_id') + responses.add(responses.POST, + url, + status=200, + body=json.dumps(result), + match_querystring=True) + + self.assertEqual(self.client.payment.otpGenerate('dummy_id'), result) + + @responses.activate + def test_otpSubmit(self): + param = { + "otp": "123456" + } + + result = mock_file('fake_otp_submit') + url = "{}/{}/otp/submit".format(self.base_url,'dummy_id') + responses.add(responses.POST, + url, + status=200, + body=json.dumps(result), + match_querystring=True) + + self.assertEqual(self.client.payment.otpSubmit('dummy_id',param), result) + + @responses.activate + def test_otpResend(self): + result = mock_file('fake_otp_resend') + url = "{}/{}/otp/resend".format(self.base_url,'dummy_id') + responses.add(responses.POST, + url, + status=200, + body=json.dumps(result), + match_querystring=True) + + self.assertEqual(self.client.payment.otpResend('dummy_id'), result) \ No newline at end of file From 35fb1251ee3bf06154d2ecbea3ecee8a12109ac1 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Tue, 14 Jun 2022 11:28:52 +0530 Subject: [PATCH 10/64] customer doc correction --- documents/customer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documents/customer.md b/documents/customer.md index a2ec5716..157ac127 100644 --- a/documents/customer.md +++ b/documents/customer.md @@ -90,8 +90,8 @@ client.customer.all(options) | Name | Type | Description | |---------------|-------------|---------------------------------------------| -| count | integer | number of payments to fetch (default: 10) | -| skip | integer | number of payments to be skipped (default: 0) | +| count | integer | number of customers to fetch (default: 10) | +| skip | integer | number of customers to be skipped (default: 0) | **Response:** ```json From 27eb2edadc83f9012ca66cd421e25ef533816409 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Tue, 14 Jun 2022 13:09:01 +0530 Subject: [PATCH 11/64] order doc correction --- documents/order.md | 98 +++++++++++++++++++++++++++------------------- 1 file changed, 58 insertions(+), 40 deletions(-) diff --git a/documents/order.md b/documents/order.md index 24ddfbe5..9cdb3bab 100644 --- a/documents/order.md +++ b/documents/order.md @@ -61,6 +61,9 @@ client.order.all(option) | skip | integer | number of orders to be skipped (default: 0) | | authorized | boolean | Orders for which orders are currently in authorized state. | | receipt | string | Orders with the provided value for receipt. | +| expand[] | string | Used to retrieve additional information about the payment. Possible value is `payments`,`payments.card`,`transfers` or `virtual_account` | +| authorized | boolean | Possible value is `0` or `1` | + **Response:** @@ -103,17 +106,21 @@ client.order.fetch(orderId) ```json { - "id":"order_DaaS6LOUAASb7Y", - "entity":"order", - "amount":2200, - "amount_paid":0, - "amount_due":2200, - "currency":"INR", - "receipt":"Receipt #211", - "status":"attempted", - "attempts":1, - "notes":[], - "created_at":1572505143 + "id": "order_Jc81IZnaXSMLFh", + "entity": "order", + "amount": 50000, + "amount_paid": 50000, + "amount_due": 0, + "currency": "INR", + "receipt": null, + "offer_id": null, + "status": "paid", + "attempts": 1, + "notes": { + "notes_key_1": "value1", + "notes_key_2": "value2" + }, + "created_at": 1654064215 } ``` ------------------------------------------------------------------------------------------------------- @@ -121,7 +128,7 @@ client.order.fetch(orderId) ### Fetch payments for an order ```py -client.order.payment(orderId) +client.order.payments(orderId) ``` **Parameters** @@ -132,35 +139,46 @@ client.order.payment(orderId) **Response:** ```json { - "entity":"collection", - "count":1, - "items":[ + "entity": "collection", + "count": 1, + "items": [ { - "id":"pay_DaaSOvhgcOfzgR", - "entity":"payment", - "amount":2200, - "currency":"INR", - "status":"captured", - "order_id":"order_DaaS6LOUAASb7Y", - "invoice_id":null, - "international":false, - "method":"card", - "amount_refunded":0, - "refund_status":null, - "captured":true, - "description":"Beans in every imaginable flavour", - "card_id":"card_DZon6fd8J3IcA2", - "bank":null, - "wallet":null, - "vpa":null, - "email":"gaurav.kumar@example.com", - "contact":"+919999999988", - "notes":[], - "fee":44, - "tax":0, - "error_code":null, - "error_description":null, - "created_at":1572505160 + "id": "pay_Jc81alhu5LmAUI", + "entity": "payment", + "amount": 50000, + "currency": "INR", + "status": "captured", + "order_id": "order_Jc81IZnaXSMLFh", + "invoice_id": "inv_Jc81IWvxf4TT1F", + "international": false, + "method": "upi", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": "Order # 2", + "card_id": null, + "bank": null, + "wallet": null, + "vpa": "success@razorpay", + "email": "sofiya.shaikh2@razorpay.com", + "contact": "+919702219003", + "customer_id": "cust_JR4BVKjKyJ7enk", + "token_id": "token_Jc81b6OBfodoi6", + "notes": { + "opencart_order_id": "2" + }, + "fee": 1180, + "tax": 180, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": { + "rrn": "001000100002", + "upi_transaction_id": "npci_txn_id_for_Jc81alhu5LmAUI" + }, + "created_at": 1654064232 } ] } From ecd194f4d065f3b68fd95dd760e14199ee6d75ac Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Tue, 14 Jun 2022 13:23:38 +0530 Subject: [PATCH 12/64] fund doc correction --- documents/fund.md | 74 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/documents/fund.md b/documents/fund.md index 6b8f1228..c6d6d6ed 100644 --- a/documents/fund.md +++ b/documents/fund.md @@ -24,18 +24,20 @@ client.fund_account.create({ **Response:** ```json { - "id":"fa_Aa00000000001", - "entity":"fund_account", - "customer_id":"cust_Aa000000000001", - "account_type":"bank_account", - "bank_account":{ - "name":"Gaurav Kumar", - "account_number":"11214311215411", - "ifsc":"HDFC0000053", - "bank_name":"HDFC Bank" + "id": "fa_JexSeA2SS1S19D", + "entity": "fund_account", + "customer_id": "cust_JdumbHq5F3kKu6", + "account_type": "bank_account", + "bank_account": { + "ifsc": "HDFC0000053", + "bank_name": "HDFC Bank", + "name": "Gaurav Kumar", + "notes": [], + "account_number": "11214311215411" }, - "active":true, - "created_at":1543650891 + "batch_id": null, + "active": true, + "created_at": 1654682051 } ``` ------------------------------------------------------------------------------------------------------- @@ -43,7 +45,7 @@ client.fund_account.create({ ### Fetch all fund accounts ```py -client.fund_account.fetch(customerId) +client.fund_account.all({"customer_id":customerId}) ``` **Parameters:** @@ -55,18 +57,42 @@ client.fund_account.fetch(customerId) **Response:** ```json { - "id":"fa_Aa00000000001", - "entity":"fund_account", - "customer_id":"cust_Aa000000000001", - "account_type":"bank_account", - "bank_account":{ - "name":"Gaurav Kumar", - "account_number":"11214311215411", - "ifsc":"HDFC0000053", - "bank_name":"HDFC Bank" - }, - "active":true, - "created_at":1543650891 + "entity": "collection", + "count": 2, + "items": [ + { + "id": "fa_JcXaLomo4ck5IY", + "entity": "fund_account", + "customer_id": "cust_JZse2vlC5nK9AQ", + "account_type": "bank_account", + "bank_account": { + "ifsc": "HDFC0000053", + "bank_name": "HDFC Bank", + "name": "Gaurav Kumar", + "notes": [], + "account_number": "11214311215411" + }, + "batch_id": null, + "active": true, + "created_at": 1654154246 + }, + { + "id": "fa_JcXYtecLkhW74k", + "entity": "fund_account", + "customer_id": "cust_JZse2vlC5nK9AQ", + "account_type": "bank_account", + "bank_account": { + "ifsc": "HDFC0000053", + "bank_name": "HDFC Bank", + "name": "Gaurav Kumar", + "notes": [], + "account_number": "11214311215411" + }, + "batch_id": null, + "active": true, + "created_at": 1654154163 + } + ] } ``` ------------------------------------------------------------------------------------------------------- From 6b0c8c1423044cb4b38cb73886946935316c4aa0 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Tue, 14 Jun 2022 17:42:07 +0530 Subject: [PATCH 13/64] token doc correction --- documents/token.md | 154 ++++++++++++++++++++++++--------------------- 1 file changed, 83 insertions(+), 71 deletions(-) diff --git a/documents/token.md b/documents/token.md index 25aa91e9..ccf4cf1b 100644 --- a/documents/token.md +++ b/documents/token.md @@ -70,47 +70,50 @@ client.token.all(customerId) **Response:** ```json { - "entity":"collection", - "count":1, - "items":[ - { - "id":"token_HouA2OQR5Z2jTL", - "entity":"token", - "token":"2JPRk664pZHUWG", - "bank":null, - "wallet":null, - "method":"card", - "card":{ - "entity":"card", - "name":"Gaurav Kumar", - "last4":"8950", - "network":"Visa", - "type":"credit", - "issuer":"STCB", - "international":false, - "emi":false, - "sub_type":"consumer", - "expiry_month":12, - "expiry_year":2021, - "flows":{ - "otp":true, - "recurring":true - } - }, - "recurring":true, - "recurring_details":{ - "status":"confirmed", - "failure_reason":null - }, - "auth_type":null, - "mrn":null, - "used_at":1629779657, - "created_at":1629779657, - "expired_at":1640975399, - "dcc_enabled":false, - "billing_address":null - } - ] + "entity": "collection", + "count": 1, + "items": [ + { + "id": "token_JIskPHR6HnypUV", + "entity": "token", + "token": "14LDXyJ1q4MKge", + "bank": null, + "wallet": null, + "method": "card", + "card": { + "entity": "card", + "name": "ankit", + "last4": "4366", + "network": "Visa", + "type": "credit", + "issuer": "UTIB", + "international": false, + "emi": true, + "sub_type": "consumer", + "token_iin": null, + "expiry_month": 12, + "expiry_year": 2022, + "flows": { + "otp": true, + "recurring": true + } + }, + "recurring": true, + "recurring_details": { + "status": "confirmed", + "failure_reason": null + }, + "auth_type": null, + "mrn": null, + "used_at": 1649861969, + "created_at": 1649861969, + "expired_at": 1672511399, + "status": null, + "notes": [], + "dcc_enabled": false, + "compliant_with_tokenisation_guidelines": false + } + ] } ``` ------------------------------------------------------------------------------------------------------- @@ -130,35 +133,44 @@ client.token.fetch(customerId, tokenId) **Response:** ```json { - "id": "token_Hxe0skTXLeg9pF", - "entity": "token", - "token": "F85BgXnGVwcuqV", - "bank": null, - "wallet": null, - "method": "card", - "card": { - "entity": "card", - "name": "ankit", - "last4": "5449", - "network": "MasterCard", - "type": "credit", - "issuer": "UTIB", - "international": false, - "emi": false, - "sub_type": "consumer", - "expiry_month": 12, - "expiry_year": 2024, - "flows": { - "recurring": true - } - }, - "recurring": true, - "auth_type": null, - "mrn": null, - "used_at": 1632976165, - "created_at": 1631687852, - "expired_at": 1634215992, - "dcc_enabled": false + "id": "token_JIskPHR6HnypUV", + "entity": "token", + "token": "14LDXyJ1q4MKge", + "bank": null, + "wallet": null, + "method": "card", + "card": { + "entity": "card", + "name": "ankit", + "last4": "4366", + "network": "Visa", + "type": "credit", + "issuer": "UTIB", + "international": false, + "emi": true, + "sub_type": "consumer", + "token_iin": null, + "expiry_month": 12, + "expiry_year": 2022, + "flows": { + "otp": true, + "recurring": true + } + }, + "recurring": true, + "recurring_details": { + "status": "confirmed", + "failure_reason": null + }, + "auth_type": null, + "mrn": null, + "used_at": 1649861969, + "created_at": 1649861969, + "expired_at": 1672511399, + "status": null, + "notes": [], + "dcc_enabled": false, + "compliant_with_tokenisation_guidelines": false } ``` ------------------------------------------------------------------------------------------------------- @@ -187,4 +199,4 @@ client.token.delete(customerId, tokenId) **PN: * indicates mandatory fields**

-**For reference click [here](https://razorpay.com/docs/api/recurring-payments/upi/tokens/)** \ No newline at end of file +**For reference click [here](https://razorpay.com/docs/api/payments/recurring-payments/upi/tokens/)** \ No newline at end of file From 4744454c6986404765aa9284020efc44f7c15b3f Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Tue, 14 Jun 2022 17:45:22 +0530 Subject: [PATCH 14/64] add fund link param --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2cc9c783..7b1e92ec 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ that both app title and version are strings. - [Token](documents/token.md) +- [Fund](documents/fund.md) + - [Order](documents/order.md) - [Payments](documents/payment.md) From 75792d9f6d838f6da5ba25eb9ea8458656f9793a Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Tue, 14 Jun 2022 18:40:57 +0530 Subject: [PATCH 15/64] payment doc correction --- documents/payment.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/documents/payment.md b/documents/payment.md index b9addc4a..1aae3d30 100644 --- a/documents/payment.md +++ b/documents/payment.md @@ -15,7 +15,7 @@ client.payment.capture(paymentId,{ |-----------|---------|--------------------------------------------------------------------------------| | paymentId* | string | Id of the payment to capture | | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | -| currency | string | The currency of the payment (defaults to INR) | +| currency* | string | The currency of the payment (defaults to INR) | **Response:** ```json @@ -127,6 +127,7 @@ client.payment.fetch(paymentId) | Name | Type | Description | |------------|--------|-----------------------------------| | paymentId* | string | Id of the payment to be retrieved | +| expand[] | string | Used to retrieve additional information about the payment. Possible value is `card`, `offers` or `emi`| **Response:** ```json @@ -259,6 +260,7 @@ client.payment.edit(paymentId,{ "wallet": null, "vpa": null, "email": "testme@acme.com", + "customer_id": "cust_JR4BVKjKyJ7enk", "notes": { "key1": "value1", "key2": "value2" @@ -312,16 +314,17 @@ client.payment.fetchCardDetails(paymentId) **Response:** ```json { - "id": "card_6krZ6bcjoeqyV9", + "id": "card_JXPULjlKqC5j0i", "entity": "card", - "name": "Gaurav", - "last4": "3335", + "name": "gaurav", + "last4": "4366", "network": "Visa", - "type": "debit", - "issuer": "SBIN", + "type": "credit", + "issuer": "UTIB", "international": false, - "emi": null, - "sub_type": "business" + "emi": true, + "sub_type": "consumer", + "token_iin": null } ``` ------------------------------------------------------------------------------------------------------- @@ -329,7 +332,7 @@ client.payment.fetchCardDetails(paymentId) ### Fetch Payment Downtime Details ```py -client.payment.fetchPaymentDowntime() +client.payment.fetchDownTime() ``` **Response:**
For payment downtime response please click [here](https://razorpay.com/docs/api/payments/downtime/#fetch-payment-downtime-details) From dc2ae1f458f2d210731fe9024eecdacc00ef737f Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Thu, 16 Jun 2022 00:30:09 +0530 Subject: [PATCH 16/64] settlement doc correction --- documents/settlement.md | 226 ++++++++++++++-------------------------- 1 file changed, 78 insertions(+), 148 deletions(-) diff --git a/documents/settlement.md b/documents/settlement.md index 693f8a15..5f948cc6 100644 --- a/documents/settlement.md +++ b/documents/settlement.md @@ -65,147 +65,6 @@ client.settlement.fetch(settlementId) ``` ------------------------------------------------------------------------------------------------------- -### Settlement report for a month - -```py -client.settlement.report({ - year: 2020, - month: 9 -}) -``` - -**Parameters:** - -| Name | Type | Description | -|---------------|-------------|---------------------------------------------| -| year* | integer | The year the settlement was received in the `YYYY` format. For example, `2020` | -| month* | integer | The month the settlement was received in the `MM` format. For example, `09` | -| day | integer | The date the settlement was received in the `DD` format. For example, `01` | -| count | integer | number of settlements to fetch (default: 10) | -| skip | integer | number of settlements to be skipped (default: 0) | - -**Response:** -```json -{ - "entity": "collection", - "count": 4, - "items": [ - { - "entity_id": "pay_DEXrnipqTmWVGE", - "type": "payment", - "debit": 0, - "credit": 97100, - "amount": 100000, - "currency": "INR", - "fee": 2900, - "tax": 0, - "on_hold": false, - "settled": true, - "created_at": 1567692556, - "settled_at": 1568176960, - "settlement_id": "setl_DGlQ1Rj8os78Ec", - "posted_at": null, - "credit_type": "default", - "description": "Recurring Payment via Subscription", - "notes": "{}", - "payment_id": null, - "settlement_utr": "1568176960vxp0rj", - "order_id": "order_DEXrnRiR3SNDHA", - "order_receipt": null, - "method": "card", - "card_network": "MasterCard", - "card_issuer": "KARB", - "card_type": "credit", - "dispute_id": null - }, - { - "entity_id": "rfnd_DGRcGzZSLyEdg1", - "type": "refund", - "debit": 242500, - "credit": 0, - "amount": 242500, - "currency": "INR", - "fee": 0, - "tax": 0, - "on_hold": false, - "settled": true, - "created_at": 1568107224, - "settled_at": 1568176960, - "settlement_id": "setl_DGlQ1Rj8os78Ec", - "posted_at": null, - "credit_type": "default", - "description": null, - "notes": "{}", - "payment_id": "pay_DEXq1pACSqFxtS", - "settlement_utr": "1568176960vxp0rj", - "order_id": "order_DEXpmZgffXNvuI", - "order_receipt": null, - "method": "card", - "card_network": "MasterCard", - "card_issuer": "KARB", - "card_type": "credit", - "dispute_id": null - }, - { - "entity_id": "trf_DEUoCEtdsJgvl7", - "type": "transfer", - "debit": 100296, - "credit": 0, - "amount": 100000, - "currency": "INR", - "fee": 296, - "tax": 46, - "on_hold": false, - "settled": true, - "created_at": 1567681786, - "settled_at": 1568176960, - "settlement_id": "setl_DGlQ1Rj8os78Ec", - "posted_at": null, - "credit_type": "default", - "description": null, - "notes": null, - "payment_id": "pay_DEApNNTR6xmqJy", - "settlement_utr": "1568176960vxp0rj", - "order_id": null, - "order_receipt": null, - "method": null, - "card_network": null, - "card_issuer": null, - "card_type": null, - "dispute_id": null - }, - { - "entity_id": "adj_EhcHONhX4ChgNC", - "type": "adjustment", - "debit": 0, - "credit": 1012, - "amount": 1012, - "currency": "INR", - "fee": 0, - "tax": 0, - "on_hold": false, - "settled": true, - "created_at": 1567681786, - "settled_at": 1568176960, - "settlement_id": "setl_DGlQ1Rj8os78Ec", - "posted_at": null, - "description": "test reason", - "notes": null, - "payment_id": null, - "settlement_utr": null, - "order_id": null, - "order_receipt": null, - "method": null, - "card_network": null, - "card_issuer": null, - "card_type": null, - "dispute_id": null - } - ] -} -``` -------------------------------------------------------------------------------------------------------- - ### Settlement recon ```py @@ -222,6 +81,8 @@ client.settlement.report({ | year* | integer | The year the settlement was received in the `YYYY` format. For example, `2020` | | month* | integer | The month the settlement was received in the `MM` format. For example, `09` | | day | integer | The day the settlement was received in the `DD` format. For example, | +| count | integer | Specifies the number of available settlements to be fetched. | +| skip | integer | Specifies the number of available settlements to be skipped when fetching a count. | **Response:** ```json @@ -350,7 +211,7 @@ client.settlement.report({ ```py client.settlement.create_ondemand_settlement({ "amount": 1221, - "settle_full_balance": 0, + "settle_full_balance": false, "description": "Testing", "notes": { "notes_key_1": "Tea, Earl Grey, Hot", @@ -410,6 +271,9 @@ client.settlement.create_ondemand_settlement({ } } ``` + +Create on-demand settlement please click [here](https://razorpay.com/docs/api/settlements/instant/#create-an-instant-settlement) + ------------------------------------------------------------------------------------------------------- ### Fetch all on-demand settlements @@ -421,13 +285,59 @@ client.settlement.fetch_all_ondemand_settlement(options) | Name | Type | Description | |-------|-----------|--------------------------------------------------| -| from | timestamp | timestamp after which the payments were created | -| to | timestamp | timestamp before which the payments were created | -| count | integer | number of payments to fetch (default: 10) | -| skip | integer | number of payments to be skipped (default: 0) | +| from | timestamp | timestamp after which the settlements were created | +| to | timestamp | timestamp before which the settlements were created | +| count | integer | number of settlements to fetch (default: 10) | +| skip | integer | number of settlements to be skipped (default: 0) | **Response:**
-For all on-demand settlements response please click [here](https://razorpay.com/docs/api/settlements/#fetch-all-on-demand-settlements) + +```json +{ + "entity": "collection", + "count": 2, + "items": [ + { + "id": "setlod_FNj7g2YS5J67Rz", + "entity": "settlement.ondemand", + "amount_requested": 200000, + "amount_settled": 199410, + "amount_pending": 0, + "amount_reversed": 0, + "fees": 590, + "tax": 90, + "currency": "INR", + "settle_full_balance": false, + "status": "processed", + "description": "Need this to make vendor payments.", + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1596771429 + }, + { + "id": "setlod_FJOp0jOWlalIvt", + "entity": "settlement.ondemand", + "amount_requested": 300000, + "amount_settled": 299114, + "amount_pending": 0, + "amount_reversed": 0, + "fees": 886, + "tax": 136, + "currency": "INR", + "settle_full_balance": false, + "status": "processed", + "description": "Need this to buy stock.", + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1595826576 + } + ] +} +``` ------------------------------------------------------------------------------------------------------- @@ -444,8 +354,28 @@ client.settlement.fetch_ondemand_settlement_id(settlementId) | settlementId* | string | Settlement Id of the On-demand settlement| **Response:** -For on-demand settlement by ID response please click [here](https://razorpay.com/docs/api/settlements/#fetch-on-demand-settlements-by-id) +```json +{ + "id": "setlod_FNj7g2YS5J67Rz", + "entity": "settlement.ondemand", + "amount_requested": 200000, + "amount_settled": 199410, + "amount_pending": 0, + "amount_reversed": 0, + "fees": 590, + "tax": 90, + "currency": "INR", + "settle_full_balance": false, + "status": "processed", + "description": "Need this to make vendor payments.", + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1596771429 +} +``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** From a4b3cb8800e7e511b88bc623ba066eabda6ca004 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Thu, 16 Jun 2022 01:04:02 +0530 Subject: [PATCH 17/64] refund doc correction --- documents/refund.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documents/refund.md b/documents/refund.md index debdecf6..3620acac 100644 --- a/documents/refund.md +++ b/documents/refund.md @@ -249,7 +249,7 @@ client.refund.fetch(refundId) ### Update the refund ```py -client.refund.edit({ +client.refund.edit(refundId,{ "notes": { "notes_key_1": "Beam me up Scotty.", "notes_key_2": "Engage" From ce6936d14ea19faf116615f089372d79fc1e3953 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 17 Jun 2022 17:58:15 +0530 Subject: [PATCH 18/64] fixed invoice doc --- documents/invoice.md | 107 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 98 insertions(+), 9 deletions(-) diff --git a/documents/invoice.md b/documents/invoice.md index 59fda466..1201be93 100644 --- a/documents/invoice.md +++ b/documents/invoice.md @@ -8,7 +8,7 @@ In this example, an invoice is created using the customer and item details. Here client.invoice.create({ "type": "invoice", "description": "Invoice for the month of January 2020", - "partial_payment": 1, + "partial_payment": true, "customer": { "name": "Gaurav Kumar", "contact": 9999999999, @@ -16,7 +16,7 @@ client.invoice.create({ "billing_address": { "line1": "Ground & 1st Floor, SJR Cyber Laskar", "line2": "Hosur Road", - "zipcode": 560068, + "zipcode": "560068", "city": "Bengaluru", "state": "Karnataka", "country": "in" @@ -24,7 +24,7 @@ client.invoice.create({ "shipping_address": { "line1": "Ground & 1st Floor, SJR Cyber Laskar", "line2": "Hosur Road", - "zipcode": 560068, + "zipcode": "560068", "city": "Bengaluru", "state": "Karnataka", "country": "in" @@ -35,7 +35,7 @@ client.invoice.create({ "name": "Master Cloud Computing in 30 Days", "description": "Book by Ravena Ravenclaw", "amount": 399, - "currency": "USD", + "currency": "USD", "quantity": 1 } ], @@ -52,9 +52,10 @@ client.invoice.create({ |-----------------|---------|------------------------------------------------------------------------------| |type* | string | entity type (here its invoice) | |description | string | A brief description of the invoice. | -|customer_id | string | customer id for which invoice need be raised | -|customer | array | customer details in a array format | -|line_items* | array | Details of the line item that is billed in the invoice. | +|customer_id | string | customer id for which invoice need be raised | +|draft | string | Invoice is created in draft state when value is set to `1` | +| customer* | array | All parameters listed [here](https://razorpay.com/docs/api/payments/invoices/#create-an-invoice) are supported | +| line_items | array | All parameters listed [here](https://razorpay.com/docs/api/payments/invoices/#create-an-invoice) are supported | |expire_by | array | Details of the line item that is billed in the invoice. | |sms_notify | array | Details of the line item that is billed in the invoice. | |email_notify | array | Details of the line item that is billed in the invoice. | @@ -250,10 +251,98 @@ client.invoice.edit(invoiceId,{ | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be fetched | +| line_items | array | All parameters listed [here](https://razorpay.com/docs/api/payments/invoices/#update-an-invoice) are supported | +| notes | array | key value pair | **Response:** -For update invoice response please click [here](https://razorpay.com/docs/api/invoices/#update-an-invoice) - +```json +{ + "id": "inv_DAweOiQ7amIUVd", + "entity": "invoice", + "receipt": "#0961", + "invoice_number": "#0961", + "customer_id": "cust_DAtUWmvpktokrT", + "customer_details": { + "id": "cust_DAtUWmvpktokrT", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9977886633", + "gstin": null, + "billing_address": { + "id": "addr_DAtUWoxgu91obl", + "type": "billing_address", + "primary": true, + "line1": "318 C-Wing, Suyog Co. Housing Society Ltd.", + "line2": "T.P.S Road, Vazira, Borivali", + "zipcode": "400092", + "city": "Mumbai", + "state": "Maharashtra", + "country": "in" + }, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9977886633" + }, + "order_id": null, + "line_items": [ + { + "id": "li_DAweOizsysoJU6", + "item_id": null, + "name": "Book / English August - Updated name and quantity", + "description": "150 points in Quidditch", + "amount": 400, + "unit_amount": 400, + "gross_amount": 400, + "tax_amount": 0, + "taxable_amount": 400, + "net_amount": 400, + "currency": "INR", + "type": "invoice", + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "unit": null, + "quantity": 1, + "taxes": [] + } + ], + "payment_id": null, + "status": "draft", + "expire_by": 1567103399, + "issued_at": null, + "paid_at": null, + "cancelled_at": null, + "expired_at": null, + "sms_status": null, + "email_status": null, + "date": 1566891149, + "terms": null, + "partial_payment": false, + "gross_amount": 600, + "tax_amount": 0, + "taxable_amount": 600, + "amount": 600, + "amount_paid": null, + "amount_due": null, + "currency": "INR", + "currency_symbol": "₹", + "description": "This is a test invoice.", + "notes": { + "updated-key": "An updated note." + }, + "comment": null, + "short_url": null, + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "invoice", + "group_taxes_discounts": false, + "created_at": 1566906474, + "idempotency_key": null +} +``` ------------------------------------------------------------------------------------------------------- ### Issue an invoice From 7fa65e478a402eb9936d79f87550fa2c1d224ab0 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Mon, 20 Jun 2022 08:56:18 +0530 Subject: [PATCH 19/64] added tpv order --- documents/order.md | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/documents/order.md b/documents/order.md index 24ddfbe5..cffaed3c 100644 --- a/documents/order.md +++ b/documents/order.md @@ -45,6 +45,53 @@ client.order.create({ ------------------------------------------------------------------------------------------------------- +### Create order (Third party validation) + +```py +client.order.create({ + "amount": 500, + "method": "netbanking", + "receipt": "BILL13375649", + "currency": "INR", + "bank_account": { + "account_number": "765432123456789", + "name": "Gaurav Kumar", + "ifsc": "HDFC0000053" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | Amount of the order to be paid | +| method | string | The payment method used to make the payment. If this parameter is not passed, customers will be able to make payments using both netbanking and UPI payment methods. Possible values is `netbanking` or `upi`| +| currency* | string | Currency of the order. Currently only `INR` is supported. | +| receipt | string | Your system order reference id. | +|bank_account | array | All keys listed [here](https://razorpay.com/docs/payments/third-party-validation/#step-2-create-an-order) are supported | + +**Response:** + +```json +{ + "id": "order_GAWN9beXgaqRyO", + "entity": "order", + "amount": 500, + "amount_paid": 0, + "amount_due": 500, + "currency": "INR", + "receipt": "BILL13375649", + "offer_id": null, + "status": "created", + "attempts": 0, + "notes": [], + "created_at": 1573044247 +} +``` + +------------------------------------------------------------------------------------------------------- + ### Fetch all orders ```py From 364b2f75387b40e6c21d1f4fe094a7a9f3023d61 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Mon, 20 Jun 2022 08:58:01 +0530 Subject: [PATCH 20/64] added tpv payment --- documents/payment.md | 180 ++++++++++++++++++++++++++++++++++ razorpay/resources/payment.py | 27 +++++ 2 files changed, 207 insertions(+) diff --git a/documents/payment.md b/documents/payment.md index b9addc4a..69901bef 100644 --- a/documents/payment.md +++ b/documents/payment.md @@ -438,6 +438,186 @@ client.payment.createPaymentJson({ ``` ------------------------------------------------------------------------------------------------------- +### Create Payment Json (Third party validation) + +```py +client.payment.createPaymentJson({ + "amount": "500", + "currency": "INR", + "email": "gaurav.kumar@example.com", + "contact": "9123456789", + "order_id": "order_GAWN9beXgaqRyO", + "method": "netbanking", + "bank": "HDFC" +}) +``` + +**Parameters:** +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | The currency of the payment (defaults to INR) | +| order_id* | string | The unique identifier of the order created. | +| email* | string | Email of the customer | +| contact* | string | Contact number of the customer | +| method* | string | Possible value is `netbanking` | +| bank | string | The customer's bank code.For example, `HDFC`.| + + please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/netbanking#step-3-create-a-payment) for params + +**Response:**
+```json +{ + "razorpay_payment_id": "pay_GAWOYqPlvrtPSi", + "next": [ + { + "action": "redirect", + "url": "https://api.razorpay.com/v1/payments/pay_GAWOYqPlvrtPSi/authorize" + } + ] +} +``` +------------------------------------------------------------------------------------------------------- +### Create Payment UPI s2s / VPA token (Third party validation) + +```py +client.payment.createUpi({ + "amount": 200, + "currency": "INR", + "order_id": "order_GAWRjlWkVcRh0V", + "email": "gaurav.kumar@example.com", + "contact": "9123456789", + "method": "upi", + "customer_id": "cust_EIW4T2etiweBmG", + "save": 1, + "ip": "192.168.0.103", + "referer": "http", + "user_agent": "Mozilla/5.0", + "description": "Test flow", + "notes": { + "note_key": "value1" + }, + "upi": { + "flow": "collect", + "vpa": "gauravkumar@exampleupi", + "expiry_time": 5 + } +}) +``` + +**Parameters:** +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | The currency of the payment (defaults to INR) | +| order_id* | string | The unique identifier of the order created. | +| email* | string | Email of the customer | +| customer_id* | string | The id of the customer to be fetched | +| contact* | string | Contact number of the customer | +| notes | array | A key-value pair | +| description | string | Descriptive text of the payment. | +| save | boolean | Specifies if the VPA should be stored as tokens.Possible value is `0`, `1` | +| callback_url | string | URL where Razorpay will submit the final payment status. | +| ip* | string | The client's browser IP address. For example `117.217.74.98` | +| referer* | string | Value of `referer` header passed by the client's browser. For example, `https://example.com/` | +| user_agent* | string | Value of `user_agent` header passed by the client's browser. For example, `Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36` | +| upi* (for Upi only) | array | All keys listed [here](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/upi/collect#step-14-initiate-a-payment) are supported | + +**Response:**
+```json +{ + "razorpay_payment_id": "pay_EAm09NKReXi2e0" +} +``` +------------------------------------------------------------------------------------------------------- +### Create Payment UPI s2s / VPA token (Third party validation) + +```py +client.payment.createUpi({ + "amount": 100, + "currency": "INR", + "order_id": "order_Ee0biRtLOqzRjP", + "email": "gaurav.kumar@example.com", + "contact": "9090909090", + "method": "upi", + "ip": "192.168.0.103", + "referer": "http", + "user_agent": "Mozilla/5.0", + "description": "Test flow", + "notes": { + "purpose": "UPI test payment" + }, + "upi": { + "flow" : "intent" + } +}) +``` + +**Parameters:** +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | The currency of the payment (defaults to INR) | +| order_id* | string | The unique identifier of the order created. | +| email* | string | Email of the customer | +| customer_id* | string | The id of the customer to be fetched | +| contact* | string | Contact number of the customer | +| notes | array | A key-value pair | +| description | string | Descriptive text of the payment. | +| save | boolean | Specifies if the VPA should be stored as tokens.Possible value is `0`, `1` | +| callback_url | string | URL where Razorpay will submit the final payment status. | +| ip* | string | The client's browser IP address. For example `117.217.74.98` | +| referer* | string | Value of `referer` header passed by the client's browser. For example, `https://example.com/` | +| user_agent* | string | Value of `user_agent` header passed by the client's browser. For example, `Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36` | +| upi* (for Upi only) | array | All keys listed [here](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/upi/intent/#step-2-initiate-a-payment) are supported | + +**Response:**
+```json +{ + "razorpay_payment_id": "pay_CMeM6XvOPGFiF", + "link": "upi://pay?pa=success@razorpay&pn=xyz&tr=xxxxxxxxxxx&tn=gourav&am=1&cu=INR&mc=xyzw" +} +``` +------------------------------------------------------------------------------------------------------- + +### Valid VPA (Third party validation) + +```py +client.payment.validateVpa({ + "vpa": "gauravkumar@exampleupi" +}) +``` + +**Parameters:** +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| vpa* | string | The virtual payment address (VPA) you want to validate. For example, `gauravkumar@exampleupi` | + + please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/upi/collect#step-13-validate-the-vpa) for params + +**Response:**
+```json +{ + "vpa": "gauravkumar@exampleupi", + "success": true, + "customer_name": "Gaurav Kumar" +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch payment methods (Third party validation) + +```py +client = razorpay.Client(auth=("key", "")) // Use Only razorpay key +client.payment.fetchPaymentMethods() +``` + +**Response:**
+ please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/methods-api/#fetch-payment-methods) for response + +``` +------------------------------------------------------------------------------------------------------- + **PN: * indicates mandatory fields**

diff --git a/razorpay/resources/payment.py b/razorpay/resources/payment.py index 93a448d2..bfa38764 100644 --- a/razorpay/resources/payment.py +++ b/razorpay/resources/payment.py @@ -223,3 +223,30 @@ def createRecurring(self, data={}, **kwargs): """ url = "{}/{}/recurring".format(self.base_url,'create') return self.post_url(url, data, **kwargs) + + def createUpi(self, data={}, **kwargs): + """" + Initiate a payment + Return: + Payments dict + """ + url = "{}/create/{}".format(self.base_url,'upi') + return self.post_url(url, data, **kwargs) + + def validateVpa(self, data={}, **kwargs): + """" + Validate the VPA + Return: + Payments dict + """ + url = "{}/validate/{}".format(self.base_url,'vpa') + return self.post_url(url, data, **kwargs) + + def fetchPaymentMethods(self, **kwargs): + """" + Fetch payment methods + Return: + Payments dict + """ + url = "/{}".format('methods') + return self.get_url(url, {}, **kwargs) From a03715d7f3f294cf4748a6bbcf04a1d157622585 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Mon, 20 Jun 2022 09:03:02 +0530 Subject: [PATCH 21/64] added tpv token --- documents/token.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/documents/token.md b/documents/token.md index 25aa91e9..a43258b8 100644 --- a/documents/token.md +++ b/documents/token.md @@ -184,6 +184,63 @@ client.token.delete(customerId, tokenId) ``` ------------------------------------------------------------------------------------------------------- +### Fetch VPA tokens of a customer id + +```js +client.token.all(customerId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | + + please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/upi/collect/#step-22-fetch-vpa-tokens-of-a-customer) + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "token_EeroOjvOvorT5L", + "entity": "token", + "token": "4ydxm47GQjrIEx", + "bank": null, + "wallet": null, + "method": "card", + "card": { + "entity": "card", + "name": "Gaurav Kumar", + "last4": "8430", + "network": "Visa", + "type": "credit", + "issuer": "HDFC", + "international": false, + "emi": true, + "expiry_month": 12, + "expiry_year": 2022, + "flows": { + "otp": true, + "recurring": true + } + }, + "vpa": null, + "recurring": false, + "auth_type": null, + "mrn": null, + "used_at": 1586976724, + "created_at": 1586976724, + "expired_at": 1672511399, + "dcc_enabled": false + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + **PN: * indicates mandatory fields**

From a051d9bbba64ed2c46dfb1d83766add326ac93a3 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Tue, 28 Jun 2022 12:01:18 +0530 Subject: [PATCH 22/64] fixed accourding comment --- documents/qrcode.md | 66 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 10 deletions(-) diff --git a/documents/qrcode.md b/documents/qrcode.md index 7ef09181..84074f84 100644 --- a/documents/qrcode.md +++ b/documents/qrcode.md @@ -7,7 +7,7 @@ client.qrcode.create({ "type": "upi_qr", "name": "Store_1", "usage": "single_use", - "fixed_amount": true, + "fixed_amount": True, "payment_amount": 300, "description": "For Store 1", "customer_id": "cust_HKsR5se84c5LTO", @@ -240,24 +240,27 @@ client.qrcode.fetch(qrCodeId) "count": 1, "items": [ { - "id": "qr_HMsgvioW64f0vh", + "id": "qr_HO2r1MDprYtWRT", "entity": "qr_code", - "created_at": 1623660959, + "created_at": 1623915088, "name": "Store_1", "usage": "single_use", "type": "upi_qr", - "image_url": "https://rzp.io/i/DTa2eQR", + "image_url": "https://rzp.io/i/oCswTOcCo", "payment_amount": 300, - "status": "active", + "status": "closed", "description": "For Store 1", "fixed_amount": true, - "payments_amount_received": 0, - "payments_count_received": 0, + "payments_amount_received": 300, + "payments_count_received": 1, "notes": { "purpose": "Test UPI QR code notes" }, "customer_id": "cust_HKsR5se84c5LTO", - "close_by": 1681615838 + "close_by": 1681615838, + "closed_at": 1625558914, + "close_reason": "paid", + "tax_invoice": null } ] } @@ -299,7 +302,8 @@ client.qrcode.fetch(qrCodeId) "notes": [], "customer_id": "cust_HKsR5se84c5LTO", "close_by": 1624472999, - "close_reason": null + "close_reason": "paid", + "tax_invoice": null } ] } @@ -370,7 +374,7 @@ client.qrcode.fetch_all_payments(qrCodeId, options) ### Close a QR Code ```py -client.qrcode.close(qrCodeId); +client.qrcode.close(qrCodeId) ``` **Parameters:** @@ -406,6 +410,48 @@ client.qrcode.close(qrCodeId); ``` ------------------------------------------------------------------------------------------------------- +### Refund a Payment + +```py +client.payment.refund("pay_JRP3Y66cNcf2qF",{ + "amount": "100", + "notes": { + "notes_key_1": "Beam me up Scotty.", + "notes_key_2": "Engage" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| paymentId* | string | The id of the payment to be refunded | +| amount | string | Amount to be refunded | +| notes | array | Key-value pair that can be used to store additional information about the QR code. Maximum 15 key-value pairs, 256 characters (maximum) each. | + +**Response:** +```json +{ + "id": "rfnd_FP8QHiV938haTz", + "entity": "refund", + "amount": 500100, + "receipt": "Receipt No. 31", + "currency": "INR", + "payment_id": "pay_29QQoUBi66xm2f", + "notes": [], + "receipt": null, + "acquirer_data": { + "arn": null + }, + "created_at": 1597078866, + "batch_id": null, + "status": "processed", + "speed_processed": "normal", + "speed_requested": "normal" +} +``` +------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields**
From f902b057faa0f349cf87b4632ebd80d93c0284fa Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Tue, 28 Jun 2022 12:28:51 +0530 Subject: [PATCH 23/64] fixed according comments --- documents/emandate.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/documents/emandate.md b/documents/emandate.md index 2ed07424..e6980ef7 100644 --- a/documents/emandate.md +++ b/documents/emandate.md @@ -81,13 +81,14 @@ client.order.create({ | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | method* | string | The authorization method. In this case the value will be `emandate` | -| receipt | string | Your system order reference id. | +| receipt | string | Your system order reference id. | | payment_capture | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. | | notes | object | A key-value pair | -| token | object | A key-value pair | +| token | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/emandate/create-authorization-transaction/#112-create-an-order) are supported| **Response:** Create order response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#112-create-an-order) + ------------------------------------------------------------------------------------------------------- ### Create an Authorization Payment @@ -136,16 +137,20 @@ client.registration_link.create({ | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| -| customer | object | Details of the customer to whom the registration link will be sent. | +| customer* | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/emandate/create-authorization-transaction/#121-create-a-registration-link) are supported | | type* | string | In this case, the value is `link`. | | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | | amount* | integer | The payment amount in the smallest currency sub-unit. | | description* | string | A description that appears on the hosted page. For example, `12:30 p.m. Thali meals (Gaurav Kumar`). | -| subscription_registration | object | Details of the authorization payment. | -| notes | object | A key-value pair | +| subscription_registration | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/emandate/create-authorization-transaction/#121-create-a-registration-link) are supported | +| email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) | +| expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | +| receipt | string | Your system order reference id. | +| notes | array | A key-value pair | **Response:** Create registration link response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#121-create-a-registration-link) + ------------------------------------------------------------------------------------------------------- ### Send/Resend notifications @@ -371,6 +376,7 @@ client.token.delete(customerId,tokenId) client.order.create({ "amount":1000, "currency":"INR", + "payment_capture": True, "receipt":"Receipt No. 1", "notes": { "notes_key_1":"Tea, Earl Grey, Hot", @@ -386,7 +392,7 @@ client.order.create({ | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | -| notes | object | A key-value pair | +| notes | object | A key-value pair | | payment_capture | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. | **Response:** From 5e7d0ce43f742c74d6f0503366f87c7c0ed89c37 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Tue, 28 Jun 2022 13:00:34 +0530 Subject: [PATCH 24/64] create order update parameter --- documents/emandate.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/documents/emandate.md b/documents/emandate.md index e6980ef7..69322882 100644 --- a/documents/emandate.md +++ b/documents/emandate.md @@ -49,12 +49,13 @@ client.customer.create({ client.order.create({ "amount": 0, "currency": "INR", + "payment_capture": True, "method": "emandate", "customer_id": "cust_1Aa00000000001", "receipt": "Receipt No. 1", "notes": { "notes_key_1": "Beam me up Scotty", - "notes_key_2": "Engage" + "notes_key_2": "Engage" }, "token": { "auth_type": "netbanking", @@ -82,6 +83,7 @@ client.order.create({ | currency* | string | Currency of the order. Currently only `INR` is supported. | | method* | string | The authorization method. In this case the value will be `emandate` | | receipt | string | Your system order reference id. | +| customer_id* | string | The `customer_id` for the customer you want to charge.| | payment_capture | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. | | notes | object | A key-value pair | | token | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/emandate/create-authorization-transaction/#112-create-an-order) are supported| From 6239273199ea57486b56e640c348ec6e2a18e35a Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Tue, 28 Jun 2022 17:59:53 +0530 Subject: [PATCH 25/64] fixed according comments --- documents/card.md | 61 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/documents/card.md b/documents/card.md index ee9a453f..26684e03 100644 --- a/documents/card.md +++ b/documents/card.md @@ -46,13 +46,20 @@ client.customer.create({ ```py client.order.create({ - "amount": 50000, - "currency": "INR", - "receipt": "receipt#1", - "notes": { - "key1": "value3", - "key2": "value2" - } + "amount":100, + "currency":"INR", + "customer_id":"cust_4xbQrmEoA5WJ01", + "method":"card", + "token":{ + "max_amount":5000, + "expire_at":2709971120, + "frequency":"monthly" + }, + "receipt":"Receipt No. 1", + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey... decaf." + } }) ``` @@ -62,24 +69,35 @@ client.order.create({ |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | +| customerId* | string | The id of the customer to be fetched | | receipt | string | Your system order reference id. | +| method* | string | Payment method used to make the registration transaction. Possible value is `card`. | +| token | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#112-create-an-order) are supported | | notes | object | A key-value pair | **Response:** ```json { - "id": "order_EKwxwAgItmmXdp", + "id": "order_JmugUU7mFbXTRN", "entity": "order", - "amount": 50000, + "amount": 100, "amount_paid": 0, - "amount_due": 50000, + "amount_due": 100, "currency": "INR", - "receipt": "receipt#1", + "receipt": "Receipt No. 1", "offer_id": null, "status": "created", "attempts": 0, - "notes": [], - "created_at": 1582628071 + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey... decaf." + }, + "created_at": 1656418993, + "token": { + "max_amount": 5000, + "expire_at": 2709971120 + }, + "method": "card" } ``` ------------------------------------------------------------------------------------------------------- @@ -515,8 +533,23 @@ client.card.fetch(cardId) | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| -| cardId* | string | card id to be fetched | +| cardId* | string | card id to be fetched | +```json +{ + "id": "card_JXPULjlKqC5j0i", + "entity": "card", + "name": "Gaurav", + "last4": "4366", + "network": "Visa", + "type": "credit", + "issuer": "UTIB", + "international": false, + "emi": true, + "sub_type": "consumer", + "token_iin": null +} +``` ------------------------------------------------------------------------------------------------------- ## Delete tokens From d993031035199b279a1e9925f129e0eb4cda1dbe Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Wed, 29 Jun 2022 00:07:35 +0530 Subject: [PATCH 26/64] fixed according doc --- documents/papernach.md | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/documents/papernach.md b/documents/papernach.md index 9b2ea32e..9334be0c 100644 --- a/documents/papernach.md +++ b/documents/papernach.md @@ -74,28 +74,17 @@ client.order.create({ ``` **Parameters:** -| Name | Type |Description | + +| Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | customerId* | string | The id of the customer to be fetched | | method* | string | Payment method used to make the registration transaction. Possible value is `nach`. | | receipt | string | Your system order reference id. | -| token.auth_type* | string | Possible value is `physical`| -| token.max_amount | integer | Use to set the maximum amount per debit request. The value can range from `500` - `1000000000` (1cr, default value) | -| token.expire_at | integer | The timestamp, in Unix format, till when the registration link should expire | -| token.notes | object | A key-value pair | -| bank.account_number* | string | Customer's bank account number. | -| bank.ifsc_code* | string | Customer's bank IFSC | -| bank.beneficiary_name* | string | Customer's name | -| bank.account_type* | string | Customer's bank account. Possible value is `saving`(default), `current`, `cc`, `nre`, `nro` | -| nach.form_reference1 | string | A user-entered reference that appears on the NACH form | -| nach.form_reference2 | string | A user-entered reference that appears on the NACH form | -| nach.description | string | All keys listed | +| token | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/paper-nach/create-authorization-transaction/#112-create-an-order) are supported | | notes | object | A key-value pair | -All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/paper-nach/create-authorization-transaction/#112-create-an-order) are supported - **Response:** ```json { @@ -601,6 +590,7 @@ client.order.create({ "amount":1000, "currency":"INR", "receipt":"Receipt No. 1", + "payment_capture":True, "notes": { "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." @@ -614,8 +604,10 @@ client.order.create({ |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | +| payment_capture* | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. | | receipt | string | Your system order reference id. | -| notes | object | A key-value pair | +| notes | array | A key-value pair | + **Response:** ```json { From 3d8286ec54ea0be19b5db1ab5c12f474df7dbe0e Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Wed, 29 Jun 2022 00:19:34 +0530 Subject: [PATCH 27/64] fixed according doc --- documents/upi.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/documents/upi.md b/documents/upi.md index 0bbbe311..00f1727d 100644 --- a/documents/upi.md +++ b/documents/upi.md @@ -6,6 +6,7 @@ client.customer.create({ "name": "Gaurav Kumar", "contact": 9123456780, "email": "gaurav.kumar@example.com", + "fail_existing": 0, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." @@ -139,18 +140,16 @@ client.registration_link.create({ | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| -| customer | object | Details of the customer to whom the registration link will be sent. | +| customer | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/upi/create-authorization-transaction/#121-create-a-registration-link) are supported | | type* | string | In this case, the value is `link`. | | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | | amount* | integer | The payment amount in the smallest currency sub-unit. | | description* | string | A description that appears on the hosted page. For example, `12:30 p.m. Thali meals (Gaurav Kumar`). | -| subscription_registration | object | Details of the authorization payment. | -| notes | object | A key-value pair | -|sms_notify | array | Details of the line item that is billed in the invoice. | -|email_notify | array | Details of the line item that is billed in the invoice. | -|expire_by | array | Details of the line item that is billed in the invoice. | -|receipt | string | Your system order reference id. | -|notes | object | A key-value pair | +| subscription_registration | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/upi/create-authorization-transaction/#121-create-a-registration-link) are supported | +| sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) | +| email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) | +| expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | +| notes | array | A key-value pair | **Response:** ```json @@ -436,6 +435,7 @@ client.order.create({ "amount":1000, "currency":"INR", "receipt":"Receipt No. 1", + "payment_capture":True, "notes": { "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." @@ -450,7 +450,8 @@ client.order.create({ | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | -| notes | object | A key-value pair | +| notes | array | A key-value pair | +| payment_capture | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. | **Response:** ```json From f238092e8203426be5a4e36fbd9c197d91c04c8d Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Wed, 29 Jun 2022 00:33:04 +0530 Subject: [PATCH 28/64] fixing according doc --- documents/registerNach.md | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/documents/registerNach.md b/documents/registerNach.md index e197d10c..485be54c 100644 --- a/documents/registerNach.md +++ b/documents/registerNach.md @@ -87,19 +87,8 @@ client.order.create({ | currency* | string | The currency of the payment (defaults to INR) | | customerId* | string | The id of the customer to be fetched | | method* | string | Payment method used to make the registration transaction. Possible value is `nach`. | -| receipt | string | Your system order reference id. | -| token.auth_type* | string | Possible value is `physical`| -| token.max_amount | integer | Use to set the maximum amount per debit request. The value can range from `500` - `1000000000` (1cr, default value) | -| token.expire_at | integer | The timestamp, in Unix format, till when the registration link should expire | -| token.notes | object | A key-value pair | -| bank.account_number* | string | Customer's bank account number. | -| bank.ifsc_code* | string | Customer's bank IFSC | -| bank.beneficiary_name* | string | Customer's name | -| bank.account_type* | string | Customer's bank account. Possible value is `saving`(default), `current`, `cc`, `nre`, `nro` | -| nach.form_reference1 | string | A user-entered reference that appears on the NACH form | -| nach.form_reference2 | string | A user-entered reference that appears on the NACH form | -| nach.description | string | All keys listed | -| notes | object | A key-value pair | +| token | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/paper-nach/auto-debit/#112-create-an-order) are supported | +| notes | array | A key-value pair | **Response:** ```json @@ -334,7 +323,7 @@ client.order.create({ |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | -| payment_capture | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. | +| payment_capture* | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. | | receipt | string | Your system order reference id. | | notes | object | A key-value pair | @@ -368,11 +357,14 @@ client.payment.createRecurring({ "contact": "9123456789", "amount": 1000, "currency": "INR", + "order_id": "order_1Aa00000000002", + "customer_id": "cust_1Aa00000000001", + "token": "token_1Aa00000000001", "recurring": "1", "description": "Creating recurring payment for Gaurav Kumar", "notes": { - "key1": "value3", - "key2": "value2" + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." } }) ``` @@ -389,7 +381,7 @@ client.payment.createRecurring({ | tokenId* | string | The id of the token to be fetched | | recurring* | boolean | Possible values is `0` or `1` | | description | string | A brief description of the payment. | -| notes | object | A key-value pair | +| notes | array | A key-value pair | **Response:** ```json From 554eb55ac87dbc269b076d6bdd7fa7df9a63c159 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Wed, 29 Jun 2022 14:00:25 +0530 Subject: [PATCH 29/64] update paramter & response --- documents/registerNach.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/documents/registerNach.md b/documents/registerNach.md index 485be54c..f1d74c57 100644 --- a/documents/registerNach.md +++ b/documents/registerNach.md @@ -47,9 +47,10 @@ client.customer.create({ ```py client.order.create({ - "amount": 100, + "amount": 0, "currency": "INR", "method": "nach", + "customer_id": "cust_1Aa00000000001", "receipt": "Receipt No. 5", "notes": { "note_key 1"": "Beam me up Scotty", @@ -89,6 +90,7 @@ client.order.create({ | method* | string | Payment method used to make the registration transaction. Possible value is `nach`. | | token | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/paper-nach/auto-debit/#112-create-an-order) are supported | | notes | array | A key-value pair | +| receipt | string | Your system order reference id. | **Response:** ```json @@ -386,9 +388,7 @@ client.payment.createRecurring({ **Response:** ```json { - "razorpay_payment_id" : "pay_1Aa00000000001", - "razorpay_order_id" : "order_1Aa00000000001", - "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" + "razorpay_payment_id" : "pay_1Aa00000000001" } ``` ------------------------------------------------------------------------------------------------------- From 1180fcc2e5e96124867e8c61d624f18fa0d46b5b Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Wed, 29 Jun 2022 14:25:46 +0530 Subject: [PATCH 30/64] fixed according sdkaudit doc --- documents/registerEmandate.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/documents/registerEmandate.md b/documents/registerEmandate.md index 7619367c..7643841b 100644 --- a/documents/registerEmandate.md +++ b/documents/registerEmandate.md @@ -57,6 +57,7 @@ client.order.create({ "notes_key_2": "Engage" }, "token": { + "first_payment_amount": 100, "auth_type": "netbanking", "max_amount": 9999900, "expire_at": 4102444799, @@ -112,6 +113,7 @@ client.registration_link.create({ "currency": "INR", "description": "12 p.m. Meals", "subscription_registration": { + "first_payment_amount": 100, "method": "emandate", "auth_type": "netbanking", "expire_at": 1580480689, @@ -138,12 +140,12 @@ client.registration_link.create({ | Name | Type | Description | |-----------------|---------|---------------------------------------------------------------| -| customer | object | Details of the customer to whom the registration link will be sent. | +| customer | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#12-using-a-registration-link) are supported | | type* | object | the value is `link`. | | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | description* | string | A brief description of the payment. | -| subscription_registration | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#121-create-a-registration-link) are supported | +| subscription_registration | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#12-using-a-registration-link) are supported | | receipt | string | Your system order reference id. | | payment_capture* | boolean | Indicates whether payment status should be changed to `captured` automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically.| | sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) | @@ -162,6 +164,7 @@ For create registration link response please click [here](https://razorpay.com/d client.order.create({ "amount":1000, "currency":"INR", + "payment_capture": True, "receipt":"Receipt No. 1", "notes": { "notes_key_1":"Tea, Earl Grey, Hot", @@ -175,6 +178,7 @@ client.order.create({ |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | +| payment_capture* | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. | | receipt | string | Your system order reference id. | | notes | object | A key-value pair | @@ -205,14 +209,17 @@ client.order.create({ ```py client.payment.createRecurring({ "email": "gaurav.kumar@example.com", - "contact": 9123456789, + "contact": "9123456789", "amount": 1000, "currency": "INR", - "recurring": 1, + "order_id": "order_1Aa00000000002", + "customer_id": "cust_1Aa00000000001", + "token": "token_1Aa00000000001", + "recurring": "1", "description": "Creating recurring payment for Gaurav Kumar", "notes": { - "key1": "value3", - "key2": "value2" + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." } }) ``` @@ -234,9 +241,7 @@ client.payment.createRecurring({ **Response:** ```json { - "razorpay_payment_id" : "pay_1Aa00000000001", - "razorpay_order_id" : "order_1Aa00000000001", - "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" + "razorpay_payment_id" : "pay_1Aa00000000001" } ``` ------------------------------------------------------------------------------------------------------- From deb969e2c22925b34bb637691cb91054d2eabdc5 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Thu, 30 Jun 2022 00:24:48 +0530 Subject: [PATCH 31/64] subscription doc correction --- documents/subscription.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/documents/subscription.md b/documents/subscription.md index 7c26f15c..cd41069c 100644 --- a/documents/subscription.md +++ b/documents/subscription.md @@ -32,11 +32,12 @@ client.subscription.create({ | plan_id* | string | The unique identifier for a plan that should be linked to the subscription.| | total_count* | string | The number of billing cycles for which the customer should be charged | | customer_notify | boolean | Indicates whether the communication to the customer would be handled by you or us | -| quantity | integer | The number of times the customer should be charged the plan amount per invoice | +| quantity | integer | The number of times the customer should be charged the plan amount per invoice | | start_at | integer | The timestamp, in Unix format, for when the subscription should start. If not passed, the subscription starts immediately after the authorization payment. | | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | -| addons | object | Object that contains details of any upfront amount you want to collect as part of the authorization transaction. | -| notes | object | Notes you can enter for the contact for future reference. | +| addons | array | All parameters listed [here](https://razorpay.com/docs/api/payments/subscriptions/#create-a-subscription) are supported | +| notes | array | Notes you can enter for the contact for future reference. | +| offer_id | string | The unique identifier of the offer that is linked to the subscription. | **Response:** ```json @@ -111,9 +112,10 @@ client.subscription.create({ | quantity | integer | The number of times the customer should be charged the plan amount per invoice | | start_at | integer | The timestamp, in Unix format, for when the subscription should start. If not passed, the subscription starts immediately after the authorization payment. | | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | -| addons | object | Object that contains details of any upfront amount you want to collect as part of the authorization transaction. | -| notes | object | Notes you can enter for the contact for future reference. | -| notify_info | object | The customer's email and phone number to which notifications are to be sent. (PN: Use this object only if you have set the `customer_notify` parameter to 1. That is, Razorpay sends notifications to the customer.) | +| addons | array | All parameters listed [here](https://razorpay.com/docs/api/payments/subscriptions/#create-a-subscription-link) are supported | +| notes | array | Notes you can enter for the contact for future reference. | +| notify_info | array | All parameters listed [here](https://razorpay.com/docs/api/payments/subscriptions/#create-a-subscription-link) are supported | +| offer_id | string | The unique identifier of the offer that is linked to the subscription. | **Response:** ```json From b142989443ce4872c6646f8bc35108f5897ea733 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Thu, 30 Jun 2022 00:28:13 +0530 Subject: [PATCH 32/64] addon doc correction --- documents/addon.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documents/addon.md b/documents/addon.md index 74b8f3be..f2abc853 100644 --- a/documents/addon.md +++ b/documents/addon.md @@ -19,8 +19,8 @@ client.subscription.createAddon('sub_I55auG9GnbsR8u',{ | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | boolean | The subscription ID to which the add-on is being added. | -| items* | object | Details of the add-on you want to create. | -| quantity* | integer | This specifies the number of units of the add-on to be charged to the customer. | +| items | array | All parameters listed [here](https://razorpay.com/docs/api/payments/subscriptions/#create-an-add-on) | +| quantity | integer | This specifies the number of units of the add-on to be charged to the customer. | **Response:** ```json From 06d0cf2c16b6674a556f1c867591e83a5b0abb28 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Thu, 30 Jun 2022 00:40:51 +0530 Subject: [PATCH 33/64] item doc correction --- documents/items.md | 80 ++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 28 deletions(-) diff --git a/documents/items.md b/documents/items.md index 7d48dfc2..6506d28d 100644 --- a/documents/items.md +++ b/documents/items.md @@ -23,12 +23,22 @@ client.item.create({ **Response:** ```json { - "id": "item_7Oxp4hmm6T4SCn", + "id": "item_JnQ2kRGq8Kbte3", "active": true, "name": "Book / English August", "description": "An indian story, Booker prize winner.", "amount": 20000, - "currency": "INR" + "unit_amount": 20000, + "currency": "INR", + "type": "invoice", + "unit": null, + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "tax_id": null, + "tax_group_id": null, + "created_at": 1656529427 } ``` @@ -52,31 +62,25 @@ client.item.all(options) ```json { "entity": "collection", - "count": 3, + "count": 1, "items": [ { - "id": "item_7Oy8OMV6BdEAac", - "active": true, - "name": "Book / Ignited Minds", - "description": null, - "amount": 15000, - "currency": "INR" - }, - { - "id": "item_7Oxp4hmm6T4SCn", + "id": "item_JnQ2kRGq8Kbte3", "active": true, "name": "Book / English August", "description": "An indian story, Booker prize winner.", "amount": 20000, - "currency": "INR" - }, - { - "id": "item_7OxoGnoxCuUKbo", - "active": true, - "name": "Book / English August", - "description": null, - "amount": 20000, - "currency": "INR" + "unit_amount": 20000, + "currency": "INR", + "type": "invoice", + "unit": null, + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "tax_id": null, + "tax_group_id": null, + "created_at": 1656529427 } ] } @@ -96,12 +100,22 @@ client.item.fetch(itemId) **Response:** ```json { - "id": "item_7Oxp4hmm6T4SCn", + "id": "item_JnQ2kRGq8Kbte3", "active": true, "name": "Book / English August", "description": "An indian story, Booker prize winner.", "amount": 20000, - "currency": "INR" + "unit_amount": 20000, + "currency": "INR", + "type": "invoice", + "unit": null, + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "tax_id": null, + "tax_group_id": null, + "created_at": 1656529427 } ``` @@ -115,7 +129,7 @@ client.item.edit(itemId,{ "description": "New descirption too. :).", "amount": 20000, "currency": "INR", - "active": true + "active": True }) ``` **Parameters** @@ -132,12 +146,22 @@ client.item.edit(itemId,{ **Response:** ```json { - "id": "item_7Oy8OMV6BdEAac", + "id": "item_JnQ2kRGq8Kbte3", "active": true, "name": "Book / Ignited Minds - Updated name!", - "description": "New descirption too. :)", - "amount": 15000, - "currency": "INR" + "description": "New descirption too. :).", + "amount": 20000, + "unit_amount": 20000, + "currency": "INR", + "type": "invoice", + "unit": null, + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "tax_id": null, + "tax_group_id": null, + "created_at": 1656529427 } ``` ------------------------------------------------------------------------------------------------------- From 3cb6e1b36c57b882a70f55d4fa41c5fad21354de Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Thu, 30 Jun 2022 01:19:32 +0530 Subject: [PATCH 34/64] paymentlink doc correction --- documents/paymentLink.md | 155 ++++++++++++++++++++------------------- 1 file changed, 81 insertions(+), 74 deletions(-) diff --git a/documents/paymentLink.md b/documents/paymentLink.md index afa6e3d7..64540f62 100644 --- a/documents/paymentLink.md +++ b/documents/paymentLink.md @@ -9,7 +9,7 @@ Standard Payment Link client.payment_link.create({ "amount": 500, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "description": "For XYZ purpose", "customer": { @@ -18,10 +18,10 @@ client.payment_link.create({ "contact": "+919999999999" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "notes": { "policy_name": "Jeevan Bima" }, @@ -35,10 +35,10 @@ UPI Payment Link ```py client.payment_link.create({ - "upi_link": true, + "upi_link": True, "amount": 500, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "description": "For XYZ purpose", "customer": { @@ -47,13 +47,15 @@ client.payment_link.create({ "contact": "+919999999999" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "notes": { "policy_name": "Jeevan Bima" } + "callback_url": "https://example-callback-url.com/", + "callback_method": "get" }) ``` @@ -64,9 +66,11 @@ client.payment_link.create({ |upi_link* | boolean | boolean Must be set to true // to creating UPI Payment Link only | |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | +|accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values: true - Customer can make partial payments. false (default) - Customer cannot make partial payments. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | -|reference_id | string | AReference number tagged to a Payment Link. | -|customer | object | name, email, contact | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | +|reference_id | string | Reference number tagged to a Payment Link. | +|customer | object | All parameters listed [here](https://razorpay.com/docs/api/payments/payment-links/#sample-codes-for-standard-payment-links) are supported | |expire_by | integer | Timestamp, in Unix, at which the Payment Link will expire. By default, a Payment Link will be valid for six months from the date of creation. | |notify | object | sms or email (boolean) | |notes | json object | Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty” | @@ -114,10 +118,10 @@ For fetch specific payment link response please click [here](https://razorpay.co ### Update payment link ```py -client.payment_link.edit({ +client.payment_link.edit(paymentLinkId, { "reference_id": "TS35", "expire_by": 1653347540, - "reminder_enable":false, + "reminder_enable":False, "notes":{ "policy_name": "Jeevan Saral" } @@ -180,35 +184,38 @@ client.payment_link.notifyBy(paymentLinkId, medium) ```py client.payment_link.create({ - "amount": 20000, + "amount": 1500, "currency": "INR", - "accept_partial": false, - "description": "For XYZ purpose", + "accept_partial": False, + "reference_id": "#aasasw8", + "description": "Payment for policy no #23456", "customer": { "name": "Gaurav Kumar", - "email": "gaurav.kumar@example.com", - "contact": "+919999999999" + "contact": "+919999999999", + "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { - "order": [ - { - "account": "acc_CNo3jSI8OkFJJJ", - "amount": 500, - "currency": "INR", - "notes": { - "branch": "Acme Corp Bangalore North", - "name": "Saurav Kumar", + "order": { + "transfers": [ + { + "account": "acc_I0QRP7PpvaHhpB", + "amount": 500, + "currency": "INR", + "notes": { + "branch": "Acme Corp Bangalore North", + "name": "Bhairav Kumar" + }, "linked_account_notes": [ "branch" ] } - } - ] + ] + } } }) ``` @@ -267,7 +274,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 3400, "currency": "INR", - "accept_partial": false, + "accept_partial": False, "reference_id": "#425", "description": "Payment for policy no #23456", "customer": { @@ -276,10 +283,10 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": false, + "reminder_enable": False, "options": { "order": { "offers": [ @@ -345,7 +352,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 1000, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "reference_id": "#425", "description": "Payment for policy no #23456", @@ -355,10 +362,10 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": false + "reminder_enable": False }) ``` @@ -440,7 +447,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 500, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "description": "For XYZ purpose", "customer": { @@ -449,10 +456,10 @@ client.payment_link.create({ "contact": "+919999999999" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "partial_payment": { @@ -527,7 +534,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 1000, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "reference_id": "#2234542", "description": "Payment for policy no #23456", @@ -537,10 +544,10 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "name": "Lacme Corp" @@ -556,7 +563,7 @@ client.payment_link.create({ |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | -|first_min_partial_amount | integer | | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | |customer | object | name, email, contact | |notify | object | sms or email (boolean) | @@ -609,7 +616,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 1000, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "reference_id": "#417", "description": "Payment for policy no #23456", @@ -619,10 +626,10 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "prefill": { @@ -644,7 +651,7 @@ client.payment_link.create({ |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | -|first_min_partial_amount | integer | | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | |customer | object | name, email, contact | |notify | object | sms or email (boolean) | @@ -662,7 +669,7 @@ For prefill checkout fields response please click [here](https://razorpay.com/do client.payment_link.create({ "amount": 500, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "description": "For XYZ purpose", "customer": { @@ -671,10 +678,10 @@ client.payment_link.create({ "contact": "+919999999999" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "method": { @@ -695,7 +702,7 @@ client.payment_link.create({ |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | -|first_min_partial_amount | integer | | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | |customer | object | name, email, contact | |notify | object | sms or email (boolean) | @@ -749,7 +756,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 1000, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "reference_id": "#20", "description": "Payment for policy no #23456", @@ -759,10 +766,10 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "readonly": { @@ -781,7 +788,7 @@ client.payment_link.create({ |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | -|first_min_partial_amount | integer | | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | |customer | object | name, email, contact | |notify | object | sms or email (boolean) | @@ -835,7 +842,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 1000, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "reference_id": "#423212", "description": "Payment for policy no #23456", @@ -845,14 +852,14 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "theme": { - "hide_topbar": true + "hide_topbar": True } } } @@ -866,7 +873,7 @@ client.payment_link.create({ |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | -|first_min_partial_amount | integer | | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | |customer | object | name, email, contact | |notify | object | sms or email (boolean) | @@ -919,7 +926,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 1000, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "reference_id": "#421", "description": "Payment for policy no #23456", @@ -929,10 +936,10 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "partial_payment": { @@ -953,7 +960,7 @@ client.payment_link.create({ |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | -|first_min_partial_amount | integer | | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | |customer | object | name, email, contact | |notify | object | sms or email (boolean) | From d56d97327a9789dbfc2c7afa67edee08d1c05e30 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Thu, 30 Jun 2022 01:49:31 +0530 Subject: [PATCH 35/64] smartcollect doc correction --- documents/virtualAccount.md | 60 ++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/documents/virtualAccount.md b/documents/virtualAccount.md index 7cf2457e..b12f0796 100644 --- a/documents/virtualAccount.md +++ b/documents/virtualAccount.md @@ -21,7 +21,7 @@ client.virtual_account.create({ | Name | Type | Description | |---------------|-------------|---------------------------------------------| -| receivers* | object | Array that defines what receivers are available for this Virtual Account | +| receivers* | object | All parameters listed [here](https://razorpay.com/docs/api/payments/smart-collect/#create-virtual-account) are supported | | description | string | A brief description of the virtual account. | | customer_id | string | Unique identifier of the customer to whom the virtual account must be tagged. | | close_by | integer | UNIX timestamp at which the virtual account is scheduled to be automatically closed. | @@ -225,10 +225,10 @@ client.virtual_account.all(options) | Name | Type | Description | |-------|-----------|--------------------------------------------------| -| from | timestamp | timestamp after which the payments were created | -| to | timestamp | timestamp before which the payments were created | -| count | integer | number of payments to fetch (default: 10) | -| skip | integer | number of payments to be skipped (default: 0) | +| from | timestamp | Timestamp, in seconds, from when virtual accounts are to be fetched. | +| to | timestamp | Timestamp, in seconds, till when virtual accounts are to be fetched. | +| count | integer | Number of virtual accounts to be fetched. The default value is 10 and the maximum value is 100. | +| skip | integer | Number of records to be skipped while fetching the virtual accounts. This can be used for pagination, in combination with `count`. | **Response:** ```json @@ -287,35 +287,38 @@ client.virtual_account.payments(virtualId,options) ```json { "entity": "collection", - "count": 1, + "count": 3, "items": [ { - "id": "pay_Di5iqCqA1WEHq6", + "id": "pay_JccakgG2EZbHZO", "entity": "payment", - "amount": 239000, + "amount": 10000, "currency": "INR", "status": "captured", "order_id": null, "invoice_id": null, "international": false, "method": "bank_transfer", - "amount_refunded": 0, - "refund_status": null, + "amount_refunded": 500, + "refund_status": "partial", "captured": true, "description": "", "card_id": null, "bank": null, "wallet": null, "vpa": null, - "email": "saurav.kumar@example.com", - "contact": "+919972139994", - "customer_id": "cust_DOMUFFiGdCaCUJ", + "email": null, + "contact": null, "notes": [], - "fee": 2820, - "tax": 430, + "fee": 118, + "tax": 18, "error_code": null, "error_description": null, - "created_at": 1574143644 + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": {}, + "created_at": 1654171877 } ] } @@ -388,7 +391,6 @@ client.payment.bank_transfer(paymentId) ```py client.payment.refund(paymentId,{ "amount": "100", - "speed": "normal", "notes": { "notes_key_1": "Beam me up Scotty.", "notes_key_2": "Engage" @@ -410,20 +412,22 @@ client.payment.refund(paymentId,{ **Response:** ```json { - "id": "rfnd_E6j36ZEKvsWsEn", + "id": "rfnd_FP8QHiV938haTz", "entity": "refund", - "amount": 100, + "amount": 500100, + "receipt": "Receipt No. 31", "currency": "INR", - "payment_id": "pay_E54n391WnEAV9H", - "notes": { - "key_1": "value1", - "key_2": "value2" - }, + "payment_id": "pay_FCXKPFtYfPXJPy", + "notes": [] "receipt": null, "acquirer_data": { - "rrn": null + "arn": null }, - "created_at": 1579522301 + "created_at": 1597078866, + "batch_id": null, + "status": "processed", + "speed_processed": "normal", + "speed_requested": "normal" } ``` ------------------------------------------------------------------------------------------------------- @@ -431,7 +435,7 @@ client.payment.refund(paymentId,{ ### Add receiver to an existing virtual account ```py client.virtual_account.add_receiver(virtualId,{ - "type": [ + "types": [ "vpa" ], "vpa": { @@ -444,7 +448,7 @@ client.virtual_account.add_receiver(virtualId,{ | Name | Type | Description | |-------|-----------|--------------------------------------------------| -| virtualId* | string | The id of the virtual to be updated | +| virtualId* | string | All parameters listed [here](https://razorpay.com/docs/api/payments/smart-collect-tpv#add-receiver-to-an-existing-virtual-account) are supported | | types* | object | The receiver type to be added to the virtual account. Possible values are `vpa` or `bank_account` | | vpa | object | This is to be passed only when `vpa` is passed as the receiver types. | From 38e40815d9b4528a931eaecf82be74be88e4db1d Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Thu, 30 Jun 2022 16:20:35 +0530 Subject: [PATCH 36/64] update params in readme --- documents/payment.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/documents/payment.md b/documents/payment.md index 1aae3d30..f63513d3 100644 --- a/documents/payment.md +++ b/documents/payment.md @@ -70,6 +70,7 @@ client.payment.all(option) | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | +| expand[] | string | Used to retrieve additional information about the payment. Possible value is `card`, `offers`, `transaction`, `transaction.settlement`, `refunds`, `token` or `emi`| **Response:** ```json @@ -127,7 +128,7 @@ client.payment.fetch(paymentId) | Name | Type | Description | |------------|--------|-----------------------------------| | paymentId* | string | Id of the payment to be retrieved | -| expand[] | string | Used to retrieve additional information about the payment. Possible value is `card`, `offers` or `emi`| +| expand[] | string | Used to retrieve additional information about the payment. Possible value is `card`, `offers`, `transaction`, `transaction.settlement`, `refunds`, `token` or `emi`| **Response:** ```json @@ -385,17 +386,21 @@ client.order.create({ **Response:**
```json { - "id": "order_DBJOWzybf0sJbb", + "id": "order_Jng8xOZRVEf97O", "entity": "order", "amount": 50000, "amount_paid": 0, "amount_due": 50000, "currency": "INR", "receipt": "rcptid_11", + "offer_id": "offer_JTUADI4ZWBGWur", + "offers": [ + "offer_JTUADI4ZWBGWur" + ], "status": "created", "attempts": 0, "notes": [], - "created_at": 1566986570 + "created_at": 1656586126 } ``` ------------------------------------------------------------------------------------------------------- From e719dcaeec22324e1294800a5b866e1c547046ca Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Thu, 30 Jun 2022 16:34:11 +0530 Subject: [PATCH 37/64] transfer doc correction --- documents/transfer.md | 235 ++++++++++++++++++++++++++---------------- 1 file changed, 144 insertions(+), 91 deletions(-) diff --git a/documents/transfer.md b/documents/transfer.md index 0a2c13b9..31311cc4 100644 --- a/documents/transfer.md +++ b/documents/transfer.md @@ -185,22 +185,33 @@ client.transfer.create({ **Response:** ```json { - "id": "trf_E9utgtfGTcpcmm", + "id": "trf_JnRRvcSbZb1VHN", "entity": "transfer", - "source": "acc_CJoeHMNpi0nC7k", - "recipient": "acc_CPRsN1LkFccllA", - "amount": 100, + "status": "processed", + "source": "acc_HZbJUcl6DBDLIN", + "recipient": "acc_HjVXbtpSCIxENR", + "amount": 500, "currency": "INR", "amount_reversed": 0, - "notes": [], "fees": 1, "tax": 0, + "notes": [], + "linked_account_notes": [], "on_hold": false, "on_hold_until": null, "recipient_settlement_id": null, - "created_at": 1580219046, - "linked_account_notes": [], - "processed_at": 1580219046 + "created_at": 1656534379, + "processed_at": 1656534379, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_JnRRvcSbZb1VHN", + "source": null, + "metadata": null + } } ``` ------------------------------------------------------------------------------------------------------- @@ -224,22 +235,34 @@ client.payment.transfers(paymentId) "count": 1, "items": [ { - "id": "trf_EAznuJ9cDLnF7Y", + "id": "trf_I8kA5qRv9czK3Y", "entity": "transfer", - "source": "pay_E9up5WhIfMYnKW", - "recipient": "acc_CMaomTz4o0FOFz", - "amount": 1000, + "status": "processed", + "source": "pay_I7watngocuEY4P", + "recipient": "acc_HjVXbtpSCIxENR", + "amount": 10000, "currency": "INR", - "amount_reversed": 100, + "amount_reversed": 0, + "fees": 12, + "tax": 2, "notes": [], - "fees": 3, - "tax": 0, + "linked_account_notes": [], "on_hold": false, "on_hold_until": null, + "settlement_status": "pending", "recipient_settlement_id": null, - "created_at": 1580454666, - "linked_account_notes": [], - "processed_at": 1580454666 + "created_at": 1634111246, + "processed_at": 1634111251, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_I8kA5qRv9czK3Y", + "source": null, + "metadata": null + } } ] } @@ -259,54 +282,62 @@ client.order.fetch(orderId, { | Name | Type | Description | |---------------|-------------|---------------------------------------------| | orderId* | string | The id of the order to be fetched | -| expand* | string | Supported value is `transfer` | +| expand[]* | string | Supported value is `transfer` | **Response:** ```json { - "id": "order_DSkl2lBNvueOly", + "id": "order_I7waiV9PUGADuv", "entity": "order", - "amount": 1000, - "amount_paid": 1000, + "amount": 50000, + "amount_paid": 50000, "amount_due": 0, "currency": "INR", - "receipt": null, + "receipt": "55", "offer_id": null, "status": "paid", "attempts": 1, - "notes": [], - "created_at": 1570794714, + "notes": { + "woocommerce_order_number": "55" + }, + "created_at": 1633936677, "transfers": { "entity": "collection", "count": 1, "items": [ { - "id": "trf_DSkl2lXWbiADZG", + "id": "trf_I7waiajxgS5jWL", "entity": "transfer", - "source": "order_DSkl2lBNvueOly", - "recipient": "acc_CNo3jSI8OkFJJJ", - "amount": 500, + "status": "processed", + "source": "order_I7waiV9PUGADuv", + "recipient": "acc_HalyQGZh9ZyiGg", + "amount": 10000, "currency": "INR", "amount_reversed": 0, - "notes": { - "branch": "Acme Corp Bangalore North", - "name": "Gaurav Kumar" - }, - "fees": 2, - "tax": 0, - "on_hold": true, - "on_hold_until": 1670776632, + "fees": 12, + "tax": 2, + "notes": [], + "linked_account_notes": [], + "on_hold": false, + "on_hold_until": null, + "settlement_status": "pending", "recipient_settlement_id": null, - "created_at": 1570794714, - "linked_account_notes": [ - "Acme Corp Bangalore North" - ], - "processed_at": 1570794772 + "created_at": 1633936677, + "processed_at": 1633936700, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_I7waiajxgS5jWL", + "source": null, + "metadata": null + } } ] } } - ``` ------------------------------------------------------------------------------------------------------- @@ -325,22 +356,34 @@ client.transfer.fetch(transferId) **Response:** ```json { - "id": "trf_E7V62rAxJ3zYMo", + "id": "trf_I7waiajxgS5jWL", "entity": "transfer", - "source": "pay_E6j30Iu1R7XbIG", - "recipient": "acc_CMaomTz4o0FOFz", - "amount": 100, + "status": "processed", + "source": "order_I7waiV9PUGADuv", + "recipient": "acc_HalyQGZh9ZyiGg", + "amount": 10000, "currency": "INR", "amount_reversed": 0, + "fees": 12, + "tax": 2, "notes": [], - "fees": 1, - "tax": 0, + "linked_account_notes": [], "on_hold": false, "on_hold_until": null, + "settlement_status": "pending", "recipient_settlement_id": null, - "created_at": 1579691505, - "linked_account_notes": [], - "processed_at": 1579691505 + "created_at": 1633936677, + "processed_at": 1633936700, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_I7waiajxgS5jWL", + "source": null, + "metadata": null + } } ``` ------------------------------------------------------------------------------------------------------- @@ -409,32 +452,35 @@ client.transfer.all({ "count": 1, "items": [ { - "id": "trf_DGSTeXzBkEVh48", + "id": "trf_JnRRvcSbZb1VHN", "entity": "transfer", - "source": "pay_DGSRhvMbOqeCe7", - "recipient": "acc_CMaomTz4o0FOFz", + "status": "processed", + "source": "acc_HZbJUcl6DBDLIN", + "recipient": "acc_HjVXbtpSCIxENR", "amount": 500, "currency": "INR", "amount_reversed": 0, - "notes": [], - "fees": 2, + "fees": 1, "tax": 0, + "notes": [], + "linked_account_notes": [], "on_hold": false, "on_hold_until": null, - "recipient_settlement_id": "setl_DHYJ3dRPqQkAgV", - "recipient_settlement": { - "id": "setl_DHYJ3dRPqQkAgV", - "entity": "settlement", - "amount": 500, - "status": "failed", - "fees": 0, - "tax": 0, - "utr": "CN0038699836", - "created_at": 1568349124 - }, - "created_at": 1568110256, - "linked_account_notes": [], - "processed_at": null + "settlement_status": null, + "recipient_settlement_id": null, + "recipient_settlement": null, + "created_at": 1656534379, + "processed_at": 1656534379, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_JnRRvcSbZb1VHN", + "source": null, + "metadata": null + } } ] } @@ -461,17 +507,21 @@ client.payment.refund(paymentId,{ **Response:** ```json { - "id": "rfnd_EAzovSwG8jBnGf", + "id": "rfnd_JJFNlNXPHY640A", "entity": "refund", "amount": 100, "currency": "INR", - "payment_id": "pay_EAdwQDe4JrhOFX", + "payment_id": "pay_JJCqynf4fQS0N1", "notes": [], "receipt": null, "acquirer_data": { - "rrn": null + "arn": null }, - "created_at": 1580454723 + "created_at": 1649941680, + "batch_id": null, + "status": "processed", + "speed_processed": "normal", + "speed_requested": "normal" } ``` ------------------------------------------------------------------------------------------------------- @@ -497,31 +547,37 @@ client.payment.all({ "count": 2, "items": [ { - "id": "pay_E9uth3WhYbh9QV", + "id": "pay_JJCqynf4fQS0N1", "entity": "payment", - "amount": 100, + "amount": 10000, "currency": "INR", "status": "captured", - "order_id": null, + "order_id": "order_JJCqnZG8f3754z", "invoice_id": null, - "international": null, - "method": "transfer", + "international": false, + "method": "netbanking", "amount_refunded": 0, "refund_status": null, "captured": true, - "description": null, + "description": "#JJCqaOhFihfkVE", "card_id": null, - "bank": null, + "bank": "YESB", "wallet": null, "vpa": null, - "email": "", - "contact": null, + "email": "john.example@example.com", + "contact": "+919820958250", "notes": [], - "fee": 0, - "tax": 0, + "fee": 236, + "tax": 36, "error_code": null, "error_description": null, - "created_at": 1580219046 + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": { + "bank_transaction_id": "2118867" + }, + "created_at": 1649932775 } ] } @@ -580,10 +636,7 @@ client.payment.transfer(paymentId,{ | Name | Type | Description | |---------------|-------------|---------------------------------------------| | paymentId* | string | The id of the payment to be fetched | -| transfers.account* | string | The id of the account to be fetched | -| transfers.amount* | string | The transaction amount, in paise | -| transfers.currency* | string | The currency of the payment (defaults to INR) | -| transfers.on_hold* | string | Possible values is `0` or `1` | +| transfers | array | All parameters listed [here](https://razorpay.com/docs/api/route/#hold-settlements-for-transfers) are supported | **Response:** ```json From 37dfc1c0bf5e62ff432c2b724fefb5a29f809ce5 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 00:28:22 +0530 Subject: [PATCH 38/64] create upi link update params --- documents/paymentLink.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/documents/paymentLink.md b/documents/paymentLink.md index 64540f62..2360664a 100644 --- a/documents/paymentLink.md +++ b/documents/paymentLink.md @@ -40,7 +40,9 @@ client.payment_link.create({ "currency": "INR", "accept_partial": True, "first_min_partial_amount": 100, - "description": "For XYZ purpose", + "expire_by": 1691097057, + "reference_id": "TS1989", + "description": "Payment for policy no #23456", "customer": { "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", @@ -70,10 +72,13 @@ client.payment_link.create({ |description | string | A brief description of the Payment Link | |first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |reference_id | string | Reference number tagged to a Payment Link. | -|customer | object | All parameters listed [here](https://razorpay.com/docs/api/payments/payment-links/#sample-codes-for-standard-payment-links) are supported | +|customer | object | All parameters listed [here](https://razorpay.com/docs/api/payments/payment-links/#sample-codes-for-upi-payment-links) are supported | |expire_by | integer | Timestamp, in Unix, at which the Payment Link will expire. By default, a Payment Link will be valid for six months from the date of creation. | |notify | object | sms or email (boolean) | |notes | json object | Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty” | +| callback_url | string | If specified, adds a redirect URL to the Payment Link. Once customers completes the payment, they are redirected to the specified URL. | +| callback_method | string | If callback_url parameter is passed, callback_method must be passed with the value `get`. | +| reminder_enable | boolean | Used to send reminders for the Payment Link. Possible values is `true` or `false` | **Response:** For create payment link response please click [here](https://razorpay.com/docs/api/payment-links/#create-payment-link) From f343ff07b76ee6dc7d95e35907bff2d1b2a5b1a0 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 00:33:15 +0530 Subject: [PATCH 39/64] added active param --- documents/items.md | 1 + 1 file changed, 1 insertion(+) diff --git a/documents/items.md b/documents/items.md index 6506d28d..6231894f 100644 --- a/documents/items.md +++ b/documents/items.md @@ -57,6 +57,7 @@ client.item.all(options) | to | timestamp | timestamp before which the item were created | | count | integer | number of item to fetch (default: 10) | | skip | integer | number of item to be skipped (default: 0) | +| active | integer | Fetches number of active or inactive items. The value is `1` for active items and `0` for inactive items. | **Response:** ```json From 996d6fac8046266085fbd44bde8e2fba987b82df Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 00:59:06 +0530 Subject: [PATCH 40/64] update delete addon --- razorpay/resources/addon.py | 4 +++- tests/test_client_addon.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/razorpay/resources/addon.py b/razorpay/resources/addon.py index 85a995e1..a3953c94 100644 --- a/razorpay/resources/addon.py +++ b/razorpay/resources/addon.py @@ -26,7 +26,9 @@ def delete(self, addon_id, data={}, **kwargs): Args: addon_id : Id for which addon object has to be deleted """ - return super(Addon, self).delete(addon_id, data, **kwargs) + url = '{}/{}'.format(self.base_url, addon_id) + + return self.delete_url(url, data, **kwargs) def all(self, data={}, **kwargs): """" diff --git a/tests/test_client_addon.py b/tests/test_client_addon.py index 9a4d9588..f5a9e1bd 100644 --- a/tests/test_client_addon.py +++ b/tests/test_client_addon.py @@ -22,7 +22,7 @@ def test_addon_fetch(self): @responses.activate def test_addon_delete(self): result = [] - url = '{}/{}/delete'.format(self.base_url, self.addon_id) + url = '{}/{}'.format(self.base_url, self.addon_id) responses.add(responses.DELETE, url, status=200, From 5763be476e4211ee54a2b6d1d0267a1917212929 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 01:04:34 +0530 Subject: [PATCH 41/64] add double quotes --- documents/settlement.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/documents/settlement.md b/documents/settlement.md index 5f948cc6..68084322 100644 --- a/documents/settlement.md +++ b/documents/settlement.md @@ -69,9 +69,9 @@ client.settlement.fetch(settlementId) ```py client.settlement.report({ - year: 2020, - month: 9, - day:11 + "year": 2020, + "month": 9, + "day":11 }) ``` **Parameters:** From aa8a5f7eb5693c3d72cf560952765b0f55e0efb9 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 01:08:44 +0530 Subject: [PATCH 42/64] added notes param --- documents/payment.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/documents/payment.md b/documents/payment.md index f63513d3..37471048 100644 --- a/documents/payment.md +++ b/documents/payment.md @@ -381,7 +381,8 @@ client.order.create({ | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | -| payment | object | please refer this [doc](https://razorpay.com/docs/payments/payments/capture-settings/api/) for params | +| payment | object | please refer this [doc](https://razorpay.com/docs/payments/payments/capture-settings/api/) for params | +| notes | object | A key-value pair | **Response:**
```json From 89680fca07ec1c06f0bb0f3d76e2137b06049c07 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 01:14:22 +0530 Subject: [PATCH 43/64] added partial payment param --- documents/order.md | 1 + 1 file changed, 1 insertion(+) diff --git a/documents/order.md b/documents/order.md index 9cdb3bab..3deccfd4 100644 --- a/documents/order.md +++ b/documents/order.md @@ -7,6 +7,7 @@ client.order.create({ "amount": 50000, "currency": "INR", "receipt": "receipt#1", + "partial_payment":False, "notes": { "key1": "value3", "key2": "value2" From b6f225a13611e80c0c8de71b582e7e552d276364 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 11:49:35 +0530 Subject: [PATCH 44/64] update response parameter --- documents/refund.md | 52 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/documents/refund.md b/documents/refund.md index 3620acac..4e1baf08 100644 --- a/documents/refund.md +++ b/documents/refund.md @@ -27,20 +27,24 @@ client.payment.refund(paymentId,{ **Response:** ```json { - "id": "rfnd_FP8QHiV938haTz", + "id": "rfnd_JnzyQwYOOBNJJu", "entity": "refund", - "amount": 500100, - "receipt": "Receipt No. 31", + "amount": 100, "currency": "INR", - "payment_id": "pay_FCXKPFtYfPXJPy", - "notes": [], + "payment_id": "pay_JRSS9bMrRMds3w", + "notes": { + "notes_key_1": "Beam me up Scotty.", + "notes_key_2": "Engage" + }, + "receipt": "#Receipt No. 131", "acquirer_data": { "arn": null }, - "created_at": 1597078866, + "created_at": 1656655960, "batch_id": null, "status": "processed", - "speed_processed": "normal" + "speed_processed": "normal", + "speed_requested": "normal" } ``` ------------------------------------------------------------------------------------------------------- @@ -67,22 +71,20 @@ client.payment.refund(paymentId,{ **Response:** ```json { - "id": "rfnd_FP8R8EGjGbPkVb", + "id": "rfnd_Jo00DtIBzADMi6", "entity": "refund", - "amount": 500100, + "amount": 100, "currency": "INR", - "payment_id": "pay_FC8MmhMBZPKDHF", - "notes": { - "notes_key_1": "Tea, Earl Grey, Hot", - "notes_key_2": "Tea, Earl Grey… decaf." - }, - "receipt": "Receipt No. 31", + "payment_id": "pay_JRP3Y66cNcf2qF", + "notes": [], + "receipt": "#Receipt No. 132", "acquirer_data": { "arn": null }, - "created_at": 1597078914, + "created_at": 1656656062, "batch_id": null, - "status": "processed", + "status": "pending", + "speed_processed": "instant", "speed_requested": "optimum" } ``` @@ -99,10 +101,10 @@ client.payment.fetch_multiple_refund(paymentId,option) | Name | Type | Description | |-------|-----------|--------------------------------------------------| | paymentId* | string | The id of the payment | -| from | timestamp | timestamp after which the payments were created | -| to | timestamp | timestamp before which the payments were created | -| count | integer | number of payments to fetch (default: 10) | -| skip | integer | number of payments to be skipped (default: 0) | +| from | timestamp | timestamp after which the refunds were created | +| to | timestamp | timestamp before which the refunds were created | +| count | integer | number of refunds to fetch (default: 10) | +| skip | integer | number of refunds to be skipped (default: 0) | **Refund:** ```json @@ -179,10 +181,10 @@ client.refund.all(options) | Name | Type | Description | |-------|-----------|--------------------------------------------------| -| from | timestamp | timestamp after which the payments were created | -| to | timestamp | timestamp before which the payments were created | -| count | integer | number of payments to fetch (default: 10) | -| skip | integer | number of payments to be skipped (default: 0) | +| from | timestamp | timestamp after which the refunds were created | +| to | timestamp | timestamp before which the refunds were created | +| count | integer | number of refunds to fetch (default: 10) | +| skip | integer | number of refunds to be skipped (default: 0) | **Response:** ```json From 3c1cad1c2e1369507cdd78af609a6b3cde8f84ea Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 11:53:53 +0530 Subject: [PATCH 45/64] added notes param --- documents/order.md | 1 + 1 file changed, 1 insertion(+) diff --git a/documents/order.md b/documents/order.md index cffaed3c..4701dd92 100644 --- a/documents/order.md +++ b/documents/order.md @@ -69,6 +69,7 @@ client.order.create({ | method | string | The payment method used to make the payment. If this parameter is not passed, customers will be able to make payments using both netbanking and UPI payment methods. Possible values is `netbanking` or `upi`| | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | +| notes | array | A key-value pair | |bank_account | array | All keys listed [here](https://razorpay.com/docs/payments/third-party-validation/#step-2-create-an-order) are supported | **Response:** From 86892167c96f26b748d88f24ca2c11e0eab8d13e Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 11:58:44 +0530 Subject: [PATCH 46/64] update param --- documents/payment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documents/payment.md b/documents/payment.md index 69901bef..b6001424 100644 --- a/documents/payment.md +++ b/documents/payment.md @@ -461,7 +461,7 @@ client.payment.createPaymentJson({ | email* | string | Email of the customer | | contact* | string | Contact number of the customer | | method* | string | Possible value is `netbanking` | -| bank | string | The customer's bank code.For example, `HDFC`.| +| bank* | string | The customer's bank code.For example, `HDFC`.| please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/netbanking#step-3-create-a-payment) for params From 3d33bcd46f6bd8637b282fc653cbfb5bedc0d7e2 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 13:30:47 +0530 Subject: [PATCH 47/64] update response and parameter --- documents/transfer.md | 129 ++++++++++++++++++++++++++++-------------- 1 file changed, 85 insertions(+), 44 deletions(-) diff --git a/documents/transfer.md b/documents/transfer.md index 31311cc4..f547b46a 100644 --- a/documents/transfer.md +++ b/documents/transfer.md @@ -409,22 +409,34 @@ client.transfer.all({ "count": 1, "items": [ { - "id": "trf_DGSTeXzBkEVh48", + "id": "trf_HWjmkReRGPhguR", "entity": "transfer", - "source": "pay_DGSRhvMbOqeCe7", - "recipient": "acc_CMaomTz4o0FOFz", - "amount": 500, + "status": "processed", + "source": "pay_HWjY9DZSMsbm5E", + "recipient": "acc_HWjl1kqobJzf4i", + "amount": 1000, "currency": "INR", "amount_reversed": 0, - "notes": [], - "fees": 2, + "fees": 3, "tax": 0, + "notes": [], + "linked_account_notes": [], "on_hold": false, "on_hold_until": null, - "recipient_settlement_id": "setl_DHYJ3dRPqQkAgV", - "created_at": 1568110256, - "linked_account_notes": [], - "processed_at": null + "settlement_status": "settled", + "recipient_settlement_id": "setl_HYIIk3H0J4PYdX", + "created_at": 1625812996, + "processed_at": 1625812996, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_HWjmkReRGPhguR", + "source": null, + "metadata": null + } } ] } @@ -602,17 +614,21 @@ client.transfer.reverse(transferId,{ **Response:** ```json { - "id": "rvrsl_EB0BWgGDAu7tOz", - "entity": "reversal", - "transfer_id": "trf_EAznuJ9cDLnF7Y", + "id": "rfnd_JJFNlNXPHY640A", + "entity": "refund", "amount": 100, - "fee": 0, - "tax": 0, "currency": "INR", + "payment_id": "pay_JJCqynf4fQS0N1", "notes": [], - "initiator_id": "CJoeHMNpi0nC7k", - "customer_refund_id": null, - "created_at": 1580456007 + "receipt": null, + "acquirer_data": { + "arn": null + }, + "created_at": 1649941680, + "batch_id": null, + "status": "processed", + "speed_processed": "normal", + "speed_requested": "normal" } ``` ------------------------------------------------------------------------------------------------------- @@ -645,22 +661,31 @@ client.payment.transfer(paymentId,{ "count": 1, "items": [ { - "id": "trf_EB1VJ4Ux4GMmxQ", + "id": "trf_Jfm1KCF6w1oWgy", "entity": "transfer", - "source": "pay_EB1R2s8D4vOAKG", - "recipient": "acc_CMaomTz4o0FOFz", + "status": "pending", + "source": "pay_JXPULbHbkkkS8D", + "recipient": "acc_I0QRP7PpvaHhpB", "amount": 100, "currency": "INR", "amount_reversed": 0, "notes": [], - "fees": 1, - "tax": 0, + "linked_account_notes": [], "on_hold": true, "on_hold_until": null, "recipient_settlement_id": null, - "created_at": 1580460652, - "linked_account_notes": [], - "processed_at": 1580460652 + "created_at": 1654860101, + "processed_at": null, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_Jfm1KCF6w1oWgy", + "source": null, + "metadata": null + } } ] } @@ -679,28 +704,44 @@ client.transfer.edit(transferId,{ | Name | Type | Description | |---------------|-------------|---------------------------------------------| -| transferId* | string | The id of the transfer to be fetched | -| transfers | array | All parameters listed here https://razorpay.com/docs/api/route/#hold-settlements-for-transfers are supported | +| transferId* | string | The id of the payment to be fetched | +| on_hold* | boolean | Possible values is `0` or `1` | +| on_hold_until | integer | Timestamp, in Unix, that indicates until when the settlement of the transfer must be put on hold | **Response:** ```json { - "id": "trf_EB17rqOUbzSCEE", - "entity": "transfer", - "source": "pay_EAeSM2Xul8xYRo", - "recipient": "acc_CMaomTz4o0FOFz", - "amount": 100, - "currency": "INR", - "amount_reversed": 0, - "notes": [], - "fees": 1, - "tax": 0, - "on_hold": true, - "on_hold_until": 1679691505, - "recipient_settlement_id": null, - "created_at": 1580459321, - "linked_account_notes": [], - "processed_at": 1580459321 + "entity": "collection", + "count": 1, + "items": [ + { + "id": "trf_JhemwjNekar9Za", + "entity": "transfer", + "status": "pending", + "source": "pay_I7watngocuEY4P", + "recipient": "acc_HjVXbtpSCIxENR", + "amount": 100, + "currency": "INR", + "amount_reversed": 0, + "notes": [], + "linked_account_notes": [], + "on_hold": true, + "on_hold_until": null, + "recipient_settlement_id": null, + "created_at": 1655271313, + "processed_at": null, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_JhemwjNekar9Za", + "source": null, + "metadata": null + } + } + ] } ``` From ed24dd5d71ebcb0ead3fabdd3227c5c890580eeb Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 17:31:38 +0530 Subject: [PATCH 48/64] fixed according comments --- documents/upi.md | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/documents/upi.md b/documents/upi.md index 00f1727d..dc08815a 100644 --- a/documents/upi.md +++ b/documents/upi.md @@ -47,24 +47,20 @@ client.customer.create({ ```py client.order.create({ - "amount": 0, + "amount": 100, "currency": "INR", "method": "upi", "customer_id": "cust_1Aa00000000001", "receipt": "Receipt No. 1", + "token": { + "max_amount": 9999900, + "expire_at": 4102444799, + "frequency": "monthly" + }, "notes": { "notes_key_1": "Beam me up Scotty", "notes_key_2": "Engage" }, - "token": { - "auth_type": "netbanking", - "max_amount": 9999900, - "expire_at": 4102444799, - "notes": { - "notes_key_1": "Tea, Earl Grey, Hot", - "notes_key_2": "Tea, Earl Grey… decaf." - } - } }) ``` @@ -77,7 +73,8 @@ client.order.create({ | method* | string | The authorization method. In this case the value will be `emandate` | | receipt | string | Your system order reference id. | | notes | object | A key-value pair | -| token | object | A key-value pair | +| token | object | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/upi/create-authorization-transaction#112-create-an-order) are supported | + **Response:** ```json From 8008079b32b295de4de1ab439f5de4451d7a1075 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 17:35:45 +0530 Subject: [PATCH 49/64] added fail_existing param --- documents/papernach.md | 1 + 1 file changed, 1 insertion(+) diff --git a/documents/papernach.md b/documents/papernach.md index 9334be0c..8059b345 100644 --- a/documents/papernach.md +++ b/documents/papernach.md @@ -23,6 +23,7 @@ client.customer.create({ | email | string | Email of the customer | | contact | string | Contact number of the customer | | notes | object | A key-value pair | +| fail_existing | string | If a customer with the same details already exists, the request throws an exception by default. Possible value is `0` or `1`| **Response:** ```json From 14a69570a10795534beb62a2b7de93a93d628aff Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 17:40:39 +0530 Subject: [PATCH 50/64] fixed according comments --- documents/card.md | 4 ++-- test.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 test.py diff --git a/documents/card.md b/documents/card.md index 26684e03..1aad8183 100644 --- a/documents/card.md +++ b/documents/card.md @@ -135,8 +135,7 @@ client.registration_link.create({ | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| -| customer | object | Details of the customer to whom the registration link will be sent. | -| type* | string | the value is `link`. | +| customer | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#121-create-a-registration-link) are supported | | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | description* | string | A brief description of the payment. | @@ -535,6 +534,7 @@ client.card.fetch(cardId) |-----------------|---------|------------------------------------------------------------------------------| | cardId* | string | card id to be fetched | +**Response:** ```json { "id": "card_JXPULjlKqC5j0i", diff --git a/test.py b/test.py new file mode 100644 index 00000000..68716cb7 --- /dev/null +++ b/test.py @@ -0,0 +1,29 @@ +import razorpay +import requests +from pprint import pprint +import json + +client = razorpay.Client(auth=("rzp_test_k6uL897VPBz20q", "EnLs21M47BllR3X8PSFtjtbd")) + +data = {"customer_id":"cust_JnFmpXS63vWgYJ"} + +#x = client.addon.delete("ao_JniYt836HF7aQm") + +x = client.transfer.all({ + 'expand[]':'recipient_settlement' +}) + +print(json.dumps(x)) + + # def delete(self, addon_id, data={}, **kwargs): + # """ + # Delete addon for given id + + # Args: + # addon_id : Id for which addon object has to be deleted + # """ + # url = '{}/{}'.format(self.base_url, addon_id) + + # return self.delete_url(url, data, **kwargs) +# "please check response error_code , error_desc , tax and other are missing +# tested with account va_JccSJQQoGOBi2q" \ No newline at end of file From 70050f0fda0e86b31dcb36e698670ef357d89380 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 17:44:57 +0530 Subject: [PATCH 51/64] fixed according comments --- documents/emandate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documents/emandate.md b/documents/emandate.md index 69322882..755b7593 100644 --- a/documents/emandate.md +++ b/documents/emandate.md @@ -395,7 +395,7 @@ client.order.create({ | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | | notes | object | A key-value pair | -| payment_capture | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. | +| payment_capture* | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. | **Response:** ```json From e6fa144f240886adf55e99d74c2fb89c7aacb4ef Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 18:28:48 +0530 Subject: [PATCH 52/64] response param change --- documents/refund.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documents/refund.md b/documents/refund.md index 4e1baf08..31878268 100644 --- a/documents/refund.md +++ b/documents/refund.md @@ -10,7 +10,7 @@ client.payment.refund(paymentId,{ "notes_key_1": "Beam me up Scotty.", "notes_key_2": "Engage" }, - "receipt": "Receipt No. 31" + "receipt": "#Receipt No. 131" }) ``` From fede84eb09d4e2f5f0876e8b7150688096261a2f Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 18:32:29 +0530 Subject: [PATCH 53/64] add mandatory --- documents/upi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documents/upi.md b/documents/upi.md index dc08815a..a4aa0dd4 100644 --- a/documents/upi.md +++ b/documents/upi.md @@ -448,7 +448,7 @@ client.order.create({ | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | | notes | array | A key-value pair | -| payment_capture | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. | +| payment_capture* | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. | **Response:** ```json From 45aac00251ba4a9bdb8d0862110b4f276369087b Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 18:42:15 +0530 Subject: [PATCH 54/64] response param update --- documents/refund.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documents/refund.md b/documents/refund.md index 31878268..9914e0af 100644 --- a/documents/refund.md +++ b/documents/refund.md @@ -55,7 +55,7 @@ client.payment.refund(paymentId,{ client.payment.refund(paymentId,{ "amount": "100", "speed": "optimum", - "receipt": "Receipt No. 31" + "receipt": "#Receipt No. 132" }) ``` From da7e26c7bbe5b8340af77651aa82d77fcb880617 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Fri, 1 Jul 2022 19:49:28 +0530 Subject: [PATCH 55/64] update version --- CHANGELOG.md | 5 +++++ documents/virtualAccount.md | 2 ++ setup.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ff90c41..443cc83b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format ## Unreleased +## [1.3.1][1.3.1] - 2022-07-01 + +- Added Third party validation & Otp API for Payment (createUpi, validateVpa, otpGenerate, otpSubmit, otpResend) +- Update Documention + ## [1.3.0][1.3.0] - 2022-02-01 ### Added diff --git a/documents/virtualAccount.md b/documents/virtualAccount.md index b12f0796..61ad7423 100644 --- a/documents/virtualAccount.md +++ b/documents/virtualAccount.md @@ -213,7 +213,9 @@ client.virtual_account.fetch(virtualId) | virtualId* | string | The id of the virtual to be updated | **Response:** + For fetch virtual account by id response please click [here](https://razorpay.com/docs/api/smart-collect/#fetch-a-virtual-account-by-id) + ------------------------------------------------------------------------------------------------------- ### Fetch all virtual account diff --git a/setup.py b/setup.py index 36562c2c..2650ecef 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="razorpay", - version="1.3.0", + version="1.3.1", description="Razorpay Python Client", long_description=readme_content, long_description_content_type='text/markdown', From 1da7ed38d6ff0e5ad2a48cd4e31273e8d7d5aa6c Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Wed, 6 Jul 2022 17:28:13 +0530 Subject: [PATCH 56/64] create order params updated --- documents/papernach.md | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/documents/papernach.md b/documents/papernach.md index 8059b345..fcc5c7d4 100644 --- a/documents/papernach.md +++ b/documents/papernach.md @@ -47,28 +47,33 @@ client.customer.create({ ```py client.order.create({ - "amount": 0, - "currency": "INR", - "method": "emandate", + "amount":0, + "currency":"INR", + "method":"nach", "customer_id": "cust_1Aa00000000001", - "receipt": "Receipt No. 1", + "receipt":"Receipt No. 1", "notes": { "notes_key_1": "Beam me up Scotty", - "notes_key_2": "Engage" + "notes_key_2": "Engage" }, - "token": { - "auth_type": "netbanking", - "max_amount": 9999900, - "expire_at": 4102444799, + "token":{ + "auth_type":"physical", + "max_amount":10000000, + "expire_at":2709971120, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, - "bank_account": { - "beneficiary_name": "Gaurav Kumar", - "account_number": 1121431121541121, - "account_type": "savings", - "ifsc_code": "HDFC0000001" + "bank_account":{ + "account_number":"11214311215411", + "ifsc_code":"HDFC0000001", + "beneficiary_name":"Gaurav Kumar", + "account_type":"savings" + }, + "nach":{ + "form_reference1":"Recurring Payment for Gaurav Kumar", + "form_reference2":"Method Paper NACH", + "description":"Paper NACH Gaurav Kumar" } } }) From d59a40ab2be3297dd223ec3dcc2a5c91c744ff83 Mon Sep 17 00:00:00 2001 From: ankitdas13 <89454448+ankitdas13@users.noreply.github.com> Date: Tue, 6 Dec 2022 12:42:52 +0530 Subject: [PATCH 57/64] Removed unused test.py file --- test.py | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 test.py diff --git a/test.py b/test.py deleted file mode 100644 index 68716cb7..00000000 --- a/test.py +++ /dev/null @@ -1,29 +0,0 @@ -import razorpay -import requests -from pprint import pprint -import json - -client = razorpay.Client(auth=("rzp_test_k6uL897VPBz20q", "EnLs21M47BllR3X8PSFtjtbd")) - -data = {"customer_id":"cust_JnFmpXS63vWgYJ"} - -#x = client.addon.delete("ao_JniYt836HF7aQm") - -x = client.transfer.all({ - 'expand[]':'recipient_settlement' -}) - -print(json.dumps(x)) - - # def delete(self, addon_id, data={}, **kwargs): - # """ - # Delete addon for given id - - # Args: - # addon_id : Id for which addon object has to be deleted - # """ - # url = '{}/{}'.format(self.base_url, addon_id) - - # return self.delete_url(url, data, **kwargs) -# "please check response error_code , error_desc , tax and other are missing -# tested with account va_JccSJQQoGOBi2q" \ No newline at end of file From 5d96a99a78289d1370a48f5d7779403747a40b71 Mon Sep 17 00:00:00 2001 From: prem-razorpay <116806144+prem-razorpay@users.noreply.github.com> Date: Fri, 13 Jan 2023 11:19:58 +0530 Subject: [PATCH 58/64] Create pull_request_template.md add pull request template --- .github/pull_request_template.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..ccbd370e --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,8 @@ +## Note :- Please follow the below points while attaching test cases document link below: + ### - If label `Tested` is added then test cases document URL is mandatory. + ### - Link added should be a valid URL and accessible throughout the org. + ### - If the branch name contains hotfix / revert by default the BVT workflow check will pass. + +| Test Case Document URL | +|-----------------------------------------------| +| Please paste test case document link here.... | From 60df5f0d9d18c95705dd956e42140d115ff3911b Mon Sep 17 00:00:00 2001 From: Ankit Das <89454448+ankitdas13@users.noreply.github.com> Date: Thu, 27 Apr 2023 15:34:18 +0530 Subject: [PATCH 59/64] feat: Test coverage and automate publish (#251) --- .github/workflows/ci.yml | 81 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..de5afd47 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,81 @@ +name: CI +on: + push: + branches: + - master + tags: + - v[0-9]+.[0-9]+.[0-9]+* + pull_request: + branches: + - master +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + python -m build + python -m pip install --upgrade twine + python -m twine check dist/* + + - name: 'Upload Artifact' + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist/ + test: + name: Test Coverage + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install responses + pip install coverage + python ${{ github.workspace }}/setup.py install + - name: Run Tests + run: | + python -m coverage run -m unittest + python -m coverage xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + + publish: + if: startsWith(github.ref, 'refs/tags/v') + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Download all workflow run artifacts + uses: actions/download-artifact@v2 + with: + name: dist + path: dist + - name: Set up Python 3 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Publish packages to PyPi + run: | + python -m pip install --upgrade twine + set -ex + export VERSION=$(python3 setup.py --version) + python -m twine upload --verbose dist/razorpay-$VERSION-py3-none-any.whl dist/razorpay-$VERSION.tar.gz + env: + TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + From 6fa5fe2d3e0a6cfb7894f71d045fdb8e723db4c7 Mon Sep 17 00:00:00 2001 From: Ankit Das <89454448+ankitdas13@users.noreply.github.com> Date: Thu, 3 Aug 2023 13:48:11 +0530 Subject: [PATCH 60/64] feat: add partner's api's (#255) --- documents/account.md | 446 ++++++++++++++++++++++++ documents/card.md | 41 +++ documents/payment.md | 45 ++- documents/productConfiguration.md | 444 +++++++++++++++++++++++ documents/stakeholder.md | 338 ++++++++++++++++++ documents/token.md | 147 +++++++- documents/webhook.md | 224 ++++++++++++ razorpay/__init__.py | 10 + razorpay/client.py | 17 + razorpay/constants/url.py | 11 +- razorpay/resources/__init__.py | 12 +- razorpay/resources/account.py | 74 ++++ razorpay/resources/addon.py | 6 +- razorpay/resources/base.py | 3 + razorpay/resources/card.py | 17 +- razorpay/resources/customer.py | 10 +- razorpay/resources/fund_account.py | 6 +- razorpay/resources/iin.py | 19 + razorpay/resources/invoice.py | 18 +- razorpay/resources/item.py | 12 +- razorpay/resources/order.py | 12 +- razorpay/resources/payment.py | 48 +-- razorpay/resources/payment_link.py | 14 +- razorpay/resources/plan.py | 8 +- razorpay/resources/product.py | 49 +++ razorpay/resources/qrcode.py | 12 +- razorpay/resources/refund.py | 8 +- razorpay/resources/registration_link.py | 4 +- razorpay/resources/settlement.py | 8 +- razorpay/resources/stakeholder.py | 81 +++++ razorpay/resources/subscription.py | 12 +- razorpay/resources/token.py | 49 ++- razorpay/resources/transfer.py | 16 +- razorpay/resources/virtual_account.py | 18 +- razorpay/resources/webhook.py | 86 +++++ tests/helpers.py | 5 +- tests/mocks/fake_account.json | 78 +++++ tests/mocks/fake_iin.json | 26 ++ tests/mocks/fake_merchant_token.json | 32 ++ tests/mocks/fake_product.json | 139 ++++++++ tests/mocks/fake_reference_card.json | 1 + tests/mocks/fake_stakeholder.json | 29 ++ tests/mocks/fake_webhook.json | 22 ++ tests/mocks/init_account.json | 72 ++++ tests/mocks/init_stakeholder.json | 28 ++ tests/mocks/init_webhook.json | 13 + tests/mocks/stakeholder_collection.json | 35 ++ tests/mocks/webhook_collection.json | 29 ++ tests/test_client_account.py | 50 +++ tests/test_client_card.py | 15 + tests/test_client_iin.py | 20 ++ tests/test_client_product.py | 98 ++++++ tests/test_client_stakeholder.py | 85 +++++ tests/test_client_token.py | 59 ++++ tests/test_client_virtual_account.py | 5 +- tests/test_client_webhook.py | 76 ++++ tests/test_multiple_client.py | 3 +- 57 files changed, 3125 insertions(+), 120 deletions(-) create mode 100644 documents/account.md create mode 100644 documents/productConfiguration.md create mode 100644 documents/stakeholder.md create mode 100644 documents/webhook.md create mode 100644 razorpay/resources/account.py create mode 100644 razorpay/resources/iin.py create mode 100644 razorpay/resources/product.py create mode 100644 razorpay/resources/stakeholder.py create mode 100644 razorpay/resources/webhook.py create mode 100644 tests/mocks/fake_account.json create mode 100644 tests/mocks/fake_iin.json create mode 100644 tests/mocks/fake_merchant_token.json create mode 100644 tests/mocks/fake_product.json create mode 100644 tests/mocks/fake_reference_card.json create mode 100644 tests/mocks/fake_stakeholder.json create mode 100644 tests/mocks/fake_webhook.json create mode 100644 tests/mocks/init_account.json create mode 100644 tests/mocks/init_stakeholder.json create mode 100644 tests/mocks/init_webhook.json create mode 100644 tests/mocks/stakeholder_collection.json create mode 100644 tests/mocks/webhook_collection.json create mode 100644 tests/test_client_account.py create mode 100644 tests/test_client_iin.py create mode 100644 tests/test_client_product.py create mode 100644 tests/test_client_stakeholder.py create mode 100644 tests/test_client_webhook.py diff --git a/documents/account.md b/documents/account.md new file mode 100644 index 00000000..a2d83783 --- /dev/null +++ b/documents/account.md @@ -0,0 +1,446 @@ +## Account + +### Create an Account +```py +client.account.create({ + "email": "gauriagain.kumar@example.org", + "phone": "9000090000", + "legal_business_name": "Acme Corp", + "business_type": "partnership", + "customer_facing_business_name": "Example", + "profile": { + "category": "healthcare", + "subcategory": "clinic", + "description": "Healthcare E-commerce platform", + "addresses": { + "operation": { + "street1": "507, Koramangala 6th block", + "street2": "Kormanagala", + "city": "Bengaluru", + "state": "Karnataka", + "postal_code": 560047, + "country": "IN" + }, + "registered": { + "street1": "507, Koramangala 1st block", + "street2": "MG Road", + "city": "Bengaluru", + "state": "Karnataka", + "postal_code": 560034, + "country": "IN" + } + }, + "business_model": "Online Clothing ( men, women, ethnic, modern ) fashion and lifestyle, accessories, t-shirt, shirt, track pant, shoes." + }, + "legal_info": { + "pan": "AAACL1234C", + "gst": "18AABCU9603R1ZM" + }, + "brand": { + "color": "FFFFFF" + }, + "notes": { + "internal_ref_id": "123123" + }, + "contact_name": "Gaurav Kumar", + "contact_info": { + "chargeback": { + "email": "cb@example.org" + }, + "refund": { + "email": "cb@example.org" + }, + "support": { + "email": "support@example.org", + "phone": "9999999998", + "policy_url": "https://www.google.com" + } + }, + "apps": { + "websites": [ + "https://www.example.org" + ], + "android": [ + { + "url": "playstore.example.org", + "name": "Example" + } + ], + "ios": [ + { + "url": "appstore.example.org", + "name": "Example" + } + ] + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| email* | string | The sub-merchant's business email address. | +| phone* | integer | The sub-merchant's business phone number. The minimum length is 8 characters and the maximum length is 15. | +| legal_business_name* | string | The name of the sub-merchant's business. For example, Acme Corp. The minimum length is 4 characters and the maximum length is 200. | +| customer_facing_business_name | string | The sub-merchant billing label as it appears on the Razorpay Dashboard. The minimum length is 1 character and the maximum length is 255. | +| business_type | string | The type of business operated by the sub-merchant.Possible value is `proprietorship`, `partnership`, `private_limited`, `public_limited`, `llp`, `ngo`, `trust`, `society`, `not_yet_registered`, `huf` | +| reference_id | string | Partner's external account reference id. The minimum length is 1 character and the maximum length is 512. | +| profile | object | All keys listed [here](https://razorpay.com/docs/api/partners/account-onboarding/#create-an-account) are supported | +| legal_info | object | All keys listed [here](hhttps://razorpay.com/docs/api/partners/account-onboarding/#create-an-account) are supported | +| brand | object | All keys listed [here](https://razorpay.com/docs/api/partners/account-onboarding/#create-an-account) are supported | +| notes | object | A key-value pair | +| contact_name* | string | The name of the contact. The minimum length is 4 and the maximum length is 255 characters. | +| contact_info | object | All keys listed [here](https://razorpay.com/docs/api/partners/account-onboarding/#create-an-account) are supported | +| apps | object | All keys listed [here](https://razorpay.com/docs/api/partners/account-onboarding/#create-an-account) are supported | + + +**Response:** +```json +{ + "id": "acc_GRWKk7qQsLnDjX", + "type": "standard", + "status": "created", + "email": "gauriagain.kumar@example.org", + "profile": { + "category": "healthcare", + "subcategory": "clinic", + "addresses": { + "registered": { + "street1": "507, Koramangala 1st block", + "street2": "MG Road", + "city": "Bengaluru", + "state": "KARNATAKA", + "postal_code": 560034, + "country": "IN" + }, + "operation": { + "street1": "507, Koramangala 6th block", + "street2": "Kormanagalo", + "city": "Bengaluru", + "state": "KARNATAKA", + "country": "IN", + "postal_code": 560047 + } + }, + "business_model": "Online Clothing ( men, women, ethnic, modern ) fashion and lifestyle, accessories, t-shirt, shirt, track pant, shoes." + }, + "notes": { + "internal_ref_id": "123123" + }, + "created_at": 1611136837, + "phone": "9000090000", + "business_type": "partnership", + "legal_business_name": "Acme Corp", + "customer_facing_business_name": "Example", + "legal_info": { + "pan": "AAACL1234C", + "gst": "18AABCU9603R1ZM" + }, + "apps": { + "websites": [ + "https://www.example.org" + ], + "android": [ + { + "url": "playstore.example.org", + "name": "Example" + } + ], + "ios": [ + { + "url": "appstore.example.org", + "name": "Example" + } + ] + }, + "brand": { + "color": "#FFFFFF" + }, + "contact_info": { + "chargeback": { + "email": "cb@example.org", + "phone": null, + "policy_url": null + }, + "refund": { + "email": "cb@example.org", + "phone": null, + "policy_url": null + }, + "support": { + "email": "support@example.org", + "phone": "9999999998", + "policy_url": "https://www.google.com" + } + } +} +``` + +------------------------------------------------------------------------------------------------------- + +### Edit Account + +```py +accountId = "acc_GP4lfNA0iIMn5B" + +client.account.edit(accountId,{ + "customer_facing_business_name": "ABCD Ltd" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| phone | integer | The sub-merchant's business phone number. The minimum length is 8 characters and the maximum length is 15. | +| legal_business_name | string | The name of the sub-merchant's business. For example, Acme Corp. The minimum length is 4 characters and the maximum length is 200. | +| customer_facing_business_name | string | The sub-merchant billing label as it appears on the Razorpay Dashboard. The minimum length is 1 character and the maximum length is 255. | +| profile | object | All keys listed [here](https://razorpay.com/docs/api/partners/account-onboarding/#update-an-account) are supported | +| legal_info | object | All keys listed [here](hhttps://razorpay.com/docs/api/partners/account-onboarding/#update-an-account) are supported | +| brand | object | All keys listed [here](https://razorpay.com/docs/api/partners/account-onboarding/#update-an-account) are supported | +| notes | object | A key-value pair | +| contact_name* | string | The name of the contact. The minimum length is 4 and the maximum length is 255 characters. | +| contact_info | object | All keys listed [here](https://razorpay.com/docs/api/partners/account-onboarding/#update-an-account) are supported | +| apps | object | All keys listed [here](https://razorpay.com/docs/api/partners/account-onboarding/#update-an-account) are supported | + +**Response:** +```json +{ + "id": "acc_GP4lfNA0iIMn5B", + "type": "standard", + "status": "created", + "email": "gauri@example.org", + "profile": { + "category": "healthcare", + "subcategory": "clinic", + "addresses": { + "registered": { + "street1": "507, Koramangala 1st block", + "street2": "MG Road-1", + "city": "Bengalore", + "state": "KARNATAKA", + "postal_code": "560034", + "country": "IN" + } + } + }, + "notes": [], + "created_at": 1610603081, + "phone": "9000090000", + "reference_id": "randomId", + "business_type": "partnership", + "legal_business_name": "Acme Corp", + "customer_facing_business_name": "ABCD Ltd" +} +``` +------------------------------------------------------------------------------------------------------- + +### Delete an account +```py +accountId = "acc_GP4lfNA0iIMn5B" + +client.account.delete(accountId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account that must be deleted. | + +**Response:** +```json +{ + "id": "acc_GXQAkO2MrvBYg4", + "type": "standard", + "status": "suspended", + "email": "gaurav.kumar@acme.org", + "profile": { + "category": "healthcare", + "subcategory": "clinic", + "addresses": { + "registered": { + "street1": "507, Koramangala 1st block", + "street2": "MG Road", + "city": "Bengaluru", + "state": "KARNATAKA", + "postal_code": "560034", + "country": "IN" + }, + "operation": { + "street1": "507, Koramangala 1st block", + "street2": "MG Road", + "city": "Bengaluru", + "state": "KARNATAKA", + "country": "IN", + "postal_code": "560034" + } + }, + "business_model": "Online Clothing ( men, women, ethnic, modern ) fashion and lifestyle, accessories, t-shirt, shirt, track pant, shoes." + }, + "notes": { + "internal_ref_id": "123123" + }, + "created_at": 1612425180, + "suspended_at": 1612425235, + "phone": "9000090000", + "reference_id": "account_COdeRandom", + "business_type": "partnership", + "legal_business_name": "Acme Corp Pvt Ltd", + "customer_facing_business_name": "Acme", + "legal_info": { + "pan": "AAACL1234C", + "gst": "18AABCU9603R1ZM" + }, + "apps": { + "websites": [ + "https://www.acme.org" + ], + "android": [ + { + "url": "playstore.acme.org", + "name": "Acme" + } + ], + "ios": [ + { + "url": "appstore.acme.org", + "name": "Acme" + } + ] + }, + "brand": { + "color": "#FFFFFF" + }, + "contact_name": "Gaurav Kumar", + "contact_info": { + "chargeback": { + "email": "cb@acme.org", + "phone": "9000090000", + "policy_url": "https://www.google.com" + }, + "refund": { + "email": "cb@acme.org", + "phone": "9898989898", + "policy_url": "https://www.google.com" + }, + "support": { + "email": "support@acme.org", + "phone": "9898989898", + "policy_url": "https://www.google.com" + } + } +} +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch an account +```py +accountId = "acc_GP4lfNA0iIMn5B" + +client.account.fetch(accountId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | + +**Response:** +```json +{ + "id": "acc_GP4lfNA0iIMn5B", + "type": "standard", + "status": "created", + "email": "gauri@example.org", + "profile": { + "category": "healthcare", + "subcategory": "clinic", + "addresses": { + "registered": { + "street1": "507, Koramangala 1st block", + "street2": "MG Road-1", + "city": "Bengalore", + "state": "KARNATAKA", + "postal_code": "560034", + "country": "IN" + } + } + }, + "notes": [], + "created_at": 1610603081, + "phone": "9000090000", + "reference_id": "randomId", + "business_type": "partnership", + "legal_business_name": "Acme Corp", + "customer_facing_business_name": "Example Pvt. Ltd." +} +``` + +------------------------------------------------------------------------------------------------------- + +### Upload account documents +```py +accountId = "acc_M83Uw27KXuC7c8" + +file = open('/Users/your_name/Downloads/sample_uploaded.jpeg', 'rb') + +client.account.uploadAccountDoc(accountId, { + "file" : file, + "document_type" : "business_proof_url" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | +| file* | string | The URL generated once the business proof document is uploaded. | +| document_type* | string | The documents valid for the proof type to be shared. Possible values :
business_proof_of_identification: `shop_establishment_certificate`, `gst_certificate`, `msme_certificate`, `business_proof_url`, `business_pan_url`,

additional_documents : `form_12_a_url`, `form_80g_url`, `cancelled_cheque` | + +**Response:** +```json +{ + "business_proof_of_identification": [ + { + "type": "business_proof_url", + "url": "" + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch account documents +```py +accountId = "acc_LryDIBIjBDbOWy" + +client.account.fetchAccountDoc(accountId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | + +**Response:** +```json +{ + "business_proof_of_identification": [ + { + "type": "business_proof_url", + "url": "" + } + ] +} +``` +------------------------------------------------------------------------------------------------------- +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/partners/account-onboarding/)** \ No newline at end of file diff --git a/documents/card.md b/documents/card.md index 1aad8183..15f2b79f 100644 --- a/documents/card.md +++ b/documents/card.md @@ -571,7 +571,48 @@ client.token.delete(customerId,tokenId) } ``` ------------------------------------------------------------------------------------------------------- +## Using Card Number/ Tokenised Card Number +```py +client.card.requestCardReference({"number":"4854980604708430"}) +``` +**Parameters:** + +| Name | Type | Description | +|-------------|---------|------------------------------------------------------------------------------| +| number* | string | The card number whose PAR or network reference id should be retrieved. | +| tokenised | string | Determines if the card is saved as a token. Possible value is `true` or `false` | + +**Response:** +```json +{ + "network": "Visa", + "payment_account_reference": "V0010013819231376539033235990", + "network_reference_id": null +} +``` +------------------------------------------------------------------------------------------------------- + +## Using Razporpay token + +```py +client.card.requestCardReference({"token":"token_4lsdksD31GaZ09"}) +``` +**Parameters:** + +| Name | Type | Description | +|-------------|---------|------------------------------------------------------------------------------| +| token* | string | The token whose PAR or network reference id should be retrieved.| + +**Response:** +```json +{ + "network": "Visa", + "payment_account_reference": "V0010013819231376539033235990", + "network_reference_id": null +} +``` +------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields**

diff --git a/documents/payment.md b/documents/payment.md index c8e95003..63661f82 100644 --- a/documents/payment.md +++ b/documents/payment.md @@ -172,7 +172,7 @@ client.payment.fetch(paymentId) ### Fetch payments for an order ```py -client.order.payment(orderId) +client.order.payments(orderId) ``` **Parameters** @@ -717,7 +717,50 @@ Doc reference [doc](https://razorpay.com/docs/payments/payment-methods/cards/aut } ``` ------------------------------------------------------------------------------------------------------- +### Token IIN API +```py +tokenIin = "412345" + +client.iin.fetch(tokenIin) +``` + +**Parameters:** + +| Name | Type | Description | +|------------|--------|-----------------------------------| +| tokenIin* | string | The token IIN. | + +**Response:** +```json +{ + "iin": "412345", + "entity": "iin", + "network": "Visa", + "type": "credit", + "sub_type": "business", + "issuer_code": "HDFC", + "issuer_name": "HDFC Bank Ltd", + "international": false, + "is_tokenized": true, + "card_iin": "411111", + "emi":{ + "available": true + }, + "recurring": { + "available": true + }, + "authentication_types": [ + { + "type":"3ds" + }, + { + "type":"otp" + } + ] +} +``` +------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields**

diff --git a/documents/productConfiguration.md b/documents/productConfiguration.md new file mode 100644 index 00000000..eb7a685a --- /dev/null +++ b/documents/productConfiguration.md @@ -0,0 +1,444 @@ +## Product Configuration + +### Request a Product Configuration +```py + +accountId = "acc_GP4lfNA0iIMn5B" + +client.product.requestProductConfiguration(accountId, { + "product_name" : "payment_gateway", + "tnc_accepted" : True, + "ip" : "233.233.233.234" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| product_name* | string | The product(s) to be configured. Possible value is `payment_gateway`, `payment_links` | +| tnc_accepted | boolean | Pass this parameter to accept terms and conditions. Send this parameter along with the ip parameter when the tnc is accepted. Possible values is `true` | +| ip | integer | The IP address of the merchant while accepting the terms and conditions. Send this parameter along with the `tnc_accepted` parameter when the `tnc` is accepted. | + +**Response:** +```json +{ + "requested_configuration": { + "payment_methods": [] + }, + "active_configuration": { + "payment_capture": { + "mode": "automatic", + "refund_speed": "normal", + "automatic_expiry_period": 7200 + }, + "settlements": { + "account_number": null, + "ifsc_code": null, + "beneficiary_name": null + }, + "checkout": { + "theme_color": "#FFFFFF", + "flash_checkout": true, + "logo": "https://example.com/your_logo" + }, + "refund": { + "default_refund_speed": "normal" + }, + "notifications": { + "whatsapp": true, + "sms": false, + "email": [ + "b963e252-1201-45b0-9c39-c53eceb0cfd6_load@gmail.com" + ] + }, + "payment_methods": { + "netbanking": { + "enabled": true, + "instrument": [ + { + "type": "retail", + "bank": [ + "hdfc", + "sbin", + "utib", + "icic", + "scbl", + "yesb" + ] + } + ] + }, + "wallet": { + "enabled": true, + "instrument": [ + "airtelmoney", + "freecharge", + "jiomoney", + "olamoney", + "payzapp", + "mobikwik" + ] + }, + "upi": { + "enabled": true, + "instrument": [ + "upi" + ] + } + } + }, + "requirements": [ + { + "field_reference": "individual_proof_of_address", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents", + "status": "required", + "reason_code": "document_missing" + }, + { + "field_reference": "individual_proof_of_identification", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents", + "status": "required", + "reason_code": "document_missing" + }, + { + "field_reference": "business_proof_of_identification", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/documents", + "status": "required", + "reason_code": "document_missing" + }, + { + "field_reference": "settlements.beneficiary_name", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "settlements.account_number", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "settlements.ifsc_code", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "contact_name", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "name", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "customer_facing_business_name", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "kyc.pan", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders", + "status": "required", + "reason_code": "field_missing" + } + ], + "tnc":{ + "id": "tnc_IgohZaDBHRGjPv", + "accepted": true, + "accepted_at": 1641550798 + }, + "id": "acc_prd_HEgNpywUFctQ9e", + "account_id": "acc_HQVlm3bnPmccC0", + "product_name": "payment_gateway", + "activation_status": "needs_clarification", + "requested_at": 162547884 +} +``` + +------------------------------------------------------------------------------------------------------- + +### Edit a Product Configuration +```py +accountId = "acc_GP4lfNA0iIMn5B" +productId = "acc_prd_HEgNpywUFctQ9e" + +client.product.edit(accountId, productId, { + "notifications": { + "email": [ + "gaurav.kumar@example.com", + "acd@gmail.com" + ] + }, + "checkout": { + "theme_color": "#528FFF" + }, + "refund": { + "default_refund_speed": "optimum" + }, + "settlements": { + "account_number": "1234567890", + "ifsc_code": "HDFC0000317", + "beneficiary_name": "Gaurav Kumar" + }, + "tnc_accepted": True, + "ip": "233.233.233.234" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| notifications | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported | +| checkout | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported | +| refund | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported | +| settlements | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported | +| tnc_accepted | boolean | Pass this parameter to accept terms and conditions. Send this parameter along with the ip parameter when the tnc is accepted. Possible value is `true` | +| ip | string | The IP address of the merchant while accepting the terms and conditions. Send this parameter along with the tnc_accepted parameter when the `tnc` is accepted. | +| payment_methods | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported | +| type | string | Possible value is `domestic` | +| issuer | string | The card issuer. Possible values for issuer are `amex`, `dicl`, `maestro`, `mastercard`, `rupay`, `visa`. | +| wallet | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported | +| instrument(wallet) | string | The wallet issuer. Possible values are `airtelmoney`, `amazonpay`, `freecharge`, `jiomoney`, `mobiwik`, `mpesa`, `olamoney`, `paytm`, `payzapp`, `payumoney`, `phonepe`, `phonepeswitch`, `sbibuddy` | +| instrument(wallet) | string | The wallet issuer. Possible values are `airtelmoney`, `amazonpay`, `freecharge`, `jiomoney`, `mobiwik`, `mpesa`, `olamoney`, `paytm`, `payzapp`, `payumoney`, `phonepe`, `phonepeswitch`, `sbibuddy` | +| upi | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported | +| instrument(upi) | string | The UPI service provider. Possible values are `google_pay`, `upi`| +| paylater | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported | +| instrument(emi) | string | The Paylater service provider. Possible values are `epaylater`, `getsimpl`| +| emi | object | All keys listed [here](https://razorpay.com/docs/api/partners/product-configuration/#update-a-product-configuration) are supported | + +**Response:** +```json +{ + "id": "acc_GP4lfNA0iIMn5B", + "type": "standard", + "status": "created", + "email": "gauri@example.org", + "profile": { + "category": "healthcare", + "subcategory": "clinic", + "addresses": { + "registered": { + "street1": "507, Koramangala 1st block", + "street2": "MG Road-1", + "city": "Bengalore", + "state": "KARNATAKA", + "postal_code": "560034", + "country": "IN" + } + } + }, + "notes": [], + "created_at": 1610603081, + "phone": "9000090000", + "reference_id": "randomId", + "business_type": "partnership", + "legal_business_name": "Acme Corp", + "customer_facing_business_name": "ABCD Ltd" +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch a product configuration +```py +accountId = "acc_GP4lfNA0iIMn5B" + +productId = "acc_prd_HEgNpywUFctQ9e" + +client.product.fetch(accountId, productId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | +| productId* | string | The unique identifier of a product generated by Razorpay. | + +**Response:** +```json +{ + "requested_configuration": { + "payment_methods": [] + }, + "active_configuration": { + "payment_capture": { + "mode": "automatic", + "refund_speed": "normal", + "automatic_expiry_period": 7200 + }, + "settlements": { + "account_number": null, + "ifsc_code": null, + "beneficiary_name": null + }, + "checkout": { + "theme_color": "#FFFFFF", + "flash_checkout": true + }, + "refund": { + "default_refund_speed": "normal" + }, + "notifications": { + "whatsapp": true, + "sms": false, + "email": [ + "b963e252-1201-45b0-9c39-c53eceb0cfd6_load@gmail.com" + ] + }, + "payment_methods": { + "netbanking": { + "enabled": true, + "instrument": [ + { + "type": "retail", + "bank": [ + "hdfc", + "sbin", + "utib", + "icic", + "scbl", + "yesb" + ] + } + ] + }, + "wallet": { + "enabled": true, + "instrument": [ + "airtelmoney", + "freecharge", + "jiomoney", + "olamoney", + "payzapp", + "mobikwik" + ] + }, + "upi": { + "enabled": true, + "instrument": [ + "upi" + ] + } + } + }, + "requirements": [ + { + "field_reference": "individual_proof_of_address", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents", + "status": "required", + "reason_code": "document_missing" + }, + { + "field_reference": "individual_proof_of_identification", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents", + "status": "required", + "reason_code": "document_missing" + }, + { + "field_reference": "business_proof_of_identification", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/documents", + "status": "required", + "reason_code": "document_missing" + }, + { + "field_reference": "settlements.beneficiary_name", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "settlements.account_number", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "settlements.ifsc_code", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "contact_name", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "name", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "customer_facing_business_name", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "kyc.pan", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders", + "status": "required", + "reason_code": "field_missing" + } + ], + "tnc":{ + "id": "tnc_IgohZaDBHRGjPv", + "accepted": true, + "accepted_at": 1641550798 + }, + "id": "acc_prd_HEgNpywUFctQ9e", + "account_id": "acc_HQVlm3bnPmccC0", + "product_name": "payment_gateway", + "activation_status": "needs_clarification", + "requested_at": 1625478849 +} +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch Terms and Conditions for a Sub-Merchant +```py + +productName = "payments" + +client.product.fetchTnc(productName) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| productName* | string | The product family for which the relevant product to be requested for the sub-merchant. Possible value is `payments` | + +**Response:** +```json +{ + "entity": "tnc_map", + "product_name": "payments", + "id": "tnc_map_HjOVhIdpVDZ0FB", + "tnc": { + "terms": "https://razorpay.com/terms", + "privacy": "https://razorpay.com/privacy", + "agreement": "https://razorpay.com/agreement" + }, + "last_published_at": 1640589653 +} +``` + +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/partners/product-configuration/)** \ No newline at end of file diff --git a/documents/stakeholder.md b/documents/stakeholder.md new file mode 100644 index 00000000..64052aa1 --- /dev/null +++ b/documents/stakeholder.md @@ -0,0 +1,338 @@ +## Stakeholders + +### Create an Stakeholder +```py + +accountId = "acc_GP4lfNA0iIMn5B" + +client.stakeholder.create(accountId, { + "percentage_ownership": 10, + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "relationship": { + "director": True, + "executive": False + }, + "phone": { + "primary": "7474747474", + "secondary": "7474747474" + }, + "addresses": { + "residential": { + "street": "506, Koramangala 1st block", + "city": "Bengaluru", + "state": "Karnataka", + "postal_code": "560034", + "country": "IN" + } + }, + "kyc": { + "pan": "AVOPB1111K" + }, + "notes": { + "random_key_by_partner": "random_value" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| email | string | The sub-merchant's business email address. | +| name* | string | The stakeholder's name as per the PAN card. The maximum length is 255 characters. | +| percentage_ownership | float | The stakeholder's ownership of the business in percentage. Only two decimal places are allowed. For example, `87.55`. The maximum length is 100 characters. | +| relationship | boolean | The stakeholder's relationship with the account’s business. | +| phone | object | All keys listed [here](https://razorpay.com/docs/api/partners/stakeholder/#create-a-stakeholder) are supported | +| addresses | object | All keys listed [here](https://razorpay.com/docs/api/partners/stakeholder/#create-a-stakeholder) are supported | +| kyc | object | All keys listed [here](https://razorpay.com/docs/api/partners/stakeholder/#create-a-stakeholder) are supported | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "entity": "stakeholder", + "relationship": { + "director": true + }, + "phone": { + "primary": "7474747474", + "secondary": "7474747474" + }, + "notes": { + "random_key_by_partner": "random_value" + }, + "kyc": { + "pan": "AVOPB1111K" + }, + "id": "sth_GLGgm8fFCKc92m", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "percentage_ownership": 10, + "addresses": { + "residential": { + "street": "506, Koramangala 1st block", + "city": "Bengaluru", + "state": "Karnataka", + "postal_code": "560034", + "country": "IN" + } + } +} +``` + +------------------------------------------------------------------------------------------------------- + +### Edit Stakeholder +```py +accountId = "acc_GP4lfNA0iIMn5B" +stakeholderId = "sth_GOQ4Eftlz62TSL" + +client.stakeholder.edit(accountId, stakeholderId, { + "percentage_ownership": 20, + "name": "Gauri Kumar", + "relationship": { + "director": False, + "executive": True + }, + "phone": { + "primary": "9898989898", + "secondary": "9898989898" + }, + "addresses": { + "residential": { + "street": "507, Koramangala 1st block", + "city": "Bangalore", + "state": "Karnataka", + "postal_code": "560035", + "country": "IN" + } + }, + "kyc": { + "pan": "AVOPB1111J" + }, + "notes": { + "random_key_by_partner": "random_value2" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | +| stakeholderId* | string | The unique identifier of the stakeholder whose details are to be fetched. | +| name | string | The stakeholder's name as per the PAN card. The maximum length is 255 characters. | +| percentage_ownership | float | The stakeholder's ownership of the business in percentage. Only two decimal places are allowed. For example, `87.55`. The maximum length is 100 characters. | +| relationship | boolean | The stakeholder's relationship with the account’s business. | +| phone | object | All keys listed [here](https://razorpay.com/docs/api/partners/stakeholder/#update-a-stakeholder) are supported | +| addresses | object | All keys listed [here](https://razorpay.com/docs/api/partners/stakeholder/#update-a-stakeholder) are supported | +| kyc | object | All keys listed [here](https://razorpay.com/docs/api/partners/stakeholder/#update-a-stakeholder) are supported | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id": "acc_GP4lfNA0iIMn5B", + "type": "standard", + "status": "created", + "email": "gauri@example.org", + "profile": { + "category": "healthcare", + "subcategory": "clinic", + "addresses": { + "registered": { + "street1": "507, Koramangala 1st block", + "street2": "MG Road-1", + "city": "Bengalore", + "state": "KARNATAKA", + "postal_code": "560034", + "country": "IN" + } + } + }, + "notes": [], + "created_at": 1610603081, + "phone": "9000090000", + "reference_id": "randomId", + "business_type": "partnership", + "legal_business_name": "Acme Corp", + "customer_facing_business_name": "ABCD Ltd" +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch all accounts +```py +accountId = "acc_GP4lfNA0iIMn5B" + +client.stakeholder.all(accountId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | + +**Response:** +```json +{ + "entity": "collection", + "items": [ + { + "id": "GZ13yPHLJof9IE", + "entity": "stakeholder", + "relationship": { + "director": true + }, + "phone": { + "primary": "9000090000", + "secondary": "9000090000" + }, + "notes": { + "random_key_by_partner": "random_value" + }, + "kyc": { + "pan": "AVOPB1111K" + }, + "name": "Gaurav Kumar", + "email": "gaurav.kumar@acme.org", + "percentage_ownership": 10, + "addresses": { + "residential": { + "street": "506, Koramangala 1st block", + "city": "Bengaluru", + "state": "Karnataka", + "postal_code": "560034", + "country": "in" + } + } + } + ], + "count": 1 +} +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch an stakeholder +```py +accountId = "acc_GP4lfNA0iIMn5B" + +stakeholderId = "sth_GOQ4Eftlz62TSL" + +client.stakeholder.fetch(accountId, stakeholderId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | +| stakeholderId* | string | The unique identifier of the stakeholder whose details are to be fetched. | + +**Response:** +```json +{ + "entity": "stakeholder", + "relationship": { + "director": true + }, + "phone": { + "primary": "9000090000", + "secondary": "9000090000" + }, + "notes": { + "random_key_by_partner": "random_value2" + }, + "kyc": { + "pan": "AVOPB1111J" + }, + "id": "sth_GOQ4Eftlz62TSL", + "name": "Gauri Kumar", + "email": "gauri@example.com", + "percentage_ownership": 20, + "addresses": { + "residential": { + "street": "507, Koramangala 1st block", + "city": "Bangalore", + "state": "Karnataka", + "postal_code": "560035", + "country": "in" + } + } +} +``` + +------------------------------------------------------------------------------------------------------- +------------------------------------------------------------------------------------------------------- + +### Upload stakeholders documents +```py +accountId = "acc_M83Uw27KXuC7c8" +stakeholderId = "sth_M83WuwmrCFa55g" + +file = open('/Users/your_name/Downloads/sample_uploaded.jpeg', 'rb') + +client.stakeholder.uploadStakeholderDoc(accoundId, stakeholderId, { + "file" : file, + "document_type" : "aadhar_front" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | +| stakeholderId* | string | The unique identifier of the stakeholder whose details are to be fetched. | +| file* | string | The URL generated once the business proof document is uploaded. | +| document_type* | string | The documents valid for the proof type to be shared. In case of individual_proof_of_address, both the front and back of a document proof must be uploaded. Possible values :
individual_proof_of_identification: `personal_pan`

individual_proof_of_address : `voter_id_back`, `voter_id_front`, `aadhar_front`, `aadhar_back`, `passport_front`, `passport_back` | + +**Response:** +```json +{ + "individual_proof_of_address": [ + { + "type": "aadhar_front", + "url": "https://rzp.io/i/bzDAbNg" + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch stakeholders documents +```py + +accoundId = "acc_LryDIBIjBDbOWy" +stakeholderId = "sth_M0zjeiVOLRJRPW" + +client.stakeholder.fetchStakeholderDoc(accoundId, stakeholderId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | +| stakeholderId* | string | The unique identifier of the stakeholder whose details are to be fetched. | + +**Response:** +```json +{ + "business_proof_of_identification": [ + { + "type": "business_proof_url", + "url": "" + } + ] +} +``` +------------------------------------------------------------------------------------------------------- +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/partners/stakeholder)** \ No newline at end of file diff --git a/documents/token.md b/documents/token.md index 2e4e1704..349a6d87 100644 --- a/documents/token.md +++ b/documents/token.md @@ -198,7 +198,7 @@ client.token.delete(customerId, tokenId) ### Fetch VPA tokens of a customer id -```js +```py client.token.all(customerId) ``` @@ -253,6 +253,151 @@ client.token.all(customerId) ``` ------------------------------------------------------------------------------------------------------- +### Create a token + +```py + +client.token.create({ + "customer_id": "cust_1Aa00000000001", + "method": "card", + "card": { + "number": "4111111111111111", + "cvv": "123", + "expiry_month": "12", + "expiry_year": "21", + "name": "Gaurav Kumar" + }, + "authentication": { + "provider": "razorpay", + "provider_reference_id": "pay_123wkejnsakd", + "authentication_reference_number": "100222021120200000000742753928" + }, + "notes": [] +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | +| method* | string | The type of object that needs to be tokenised. Currently, `card` is the only supported value. | +| card* | object | All keys listed [here](https://razorpay.com/docs/partners/aggregators/partner-auth/token-sharing/#create-token-on-behalf-of-a-sub-merchant) are supported +| +| authentication | object | All keys listed [here](https://razorpay.com/docs/partners/aggregators/partner-auth/token-sharing/#create-token-on-behalf-of-a-sub-merchant) are supported | + +**Response:** +```json +{ + "id": "token_IJmat4GwYATMtx", + "entity": "token", + "method": "card", + "card": { + "last4": "1111", + "network": "Visa", + "type": "credit", + "issuer": "IDFB", + "international": false, + "emi": false, + "sub_type": "consumer" + }, + "customer": { + "id": "cust_1Aa00000000001", + "entity": "customer", + "name": "Bob", + "email": "bob@gmail.com", + "contact": "9000090000", + "gstin": null, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1658390470 + }, + "expired_at": 1701368999, + "customer_id": "cust_1Aa00000000001", + "compliant_with_tokenisation_guidelines": true, + "status": "active", + "notes": [] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch token +```py +client.token.fetch({"id": "token_4lsdksD31GaZ09"}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| id* | string | The unique identifier of a sub-merchant account generated by Razorpay. | + +**Response:** +```json +{ + "id": "token_4lsdksD31GaZ09", + "entity": "token", + "customer_id": "cust_1Aa00000000001", + "method": "card", + "card": { + "last4": "3335", + "network": "Visa", + "type": "debit", + "issuer": "HDFC", + "international": false, + "emi": true, + "sub_type": "consumer", + "token_iin": "453335" + }, + "compliant_with_tokenisation_guidelines": true, + "expired_at": 1748716199, + "status": "active", + "status_reason": null, + "notes": [] +} +``` +------------------------------------------------------------------------------------------------------- +### Delete a token +```py +client.token.delete({"id": "token_4lsdksD31GaZ09"}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| id* | string | The unique identifier of a sub-merchant account generated by Razorpay. | + +**Response:** +```json +[] +``` +------------------------------------------------------------------------------------------------------- + +### Process a Payment on another PA/PG with Token +```py +client.token.processPaymentOnAlternatePAorPG({"id":"spt_4lsdksD31GaZ09"}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| id* | string | The unique identifier of the token whose details are to be fetched. | + +**Response:** +```json +{ + "card": { + "number": "4016981500100002", + "expiry_month" : "12", + "expiry_year" : 2021 + } +} +``` +------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields**

diff --git a/documents/webhook.md b/documents/webhook.md new file mode 100644 index 00000000..acb391a0 --- /dev/null +++ b/documents/webhook.md @@ -0,0 +1,224 @@ +## Webhook + +### Create a Webhook +```py +accountId = "acc_GP4lfNA0iIMn5B" + +client.webhook.create({ + "url": "https://google.com", + "alert_email": "gaurav.kumar@example.com", + "secret": "12345", + "events": [ + "payment.authorized", + "payment.failed", + "payment.captured", + "payment.dispute.created", + "refund.failed", + "refund.created" + ] +}, accountId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | +| url* | string | The URL where you receive the webhook payload when an event is triggered. The maximum length is 255 characters. | +| alert_email | string | This is the email address to which notifications must be sent in case of webhook failure. | +| secret | string | A secret for the webhook endpoint that is used to validate that the webhook is from Razorpay. | +| events | string | The required events from the list of Active Events. For example `payment.authorized`, `payment.captured`, `payment.failed`, `payment.dispute.created`, `refund.failed`, `refund.created` and so on. | + +**Response:** +```json +{ + "id": "JebiXkKGYwua5L", + "created_at": 1654605478, + "updated_at": 1654605478, + "service": "beta-api-live", + "owner_id": "JOGUdtKu3dB03d", + "owner_type": "merchant", + "context": [], + "disabled_at": 0, + "url": "https://google.com", + "alert_email": "gaurav.kumar@example.com", + "secret_exists": true, + "entity": "webhook", + "active": true, + "events": [ + "payment.authorized", + "payment.failed", + "payment.captured", + "payment.dispute.created", + "refund.failed", + "refund.created" + ] +} +``` + +------------------------------------------------------------------------------------------------------- + +### Edit Webhook +```py +webhookId = "HK890egfiItP3H" + +accountId = "acc_GP4lfNA0iIMn5B" + +client.webhook.edit(webhookId, accountId,{ + "url": "https://www.linkedin.com", + "events": [ + "refund.created" + ] +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | +| webhookId* | string | The unique identifier of the webhook whose details are to be updated | +| url | string | The URL where you receive the webhook payload when an event is triggered. The maximum length is 255 characters. | +| events | string | The required events from the list of Active Events. For example `payment.authorized`, `payment.captured`, `payment.failed`, `payment.dispute.created`, `refund.failed`, `refund.created` and so on. | + +**Response:** +```json +{ + "id": "HK890egfiItP3H", + "created_at": 1623060358, + "updated_at": 1623067148, + "service": "beta-api-test", + "owner_id": "H3kYHQ635sBwXG", + "owner_type": "merchant", + "context": [], + "disabled_at": 0, + "url": "https://www.linkedin.com", + "alert_email": "gaurav.kumar@example.com", + "secret_exists": true, + "entity": "webhook", + "active": true, + "events": [ + "refund.created" + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Delete an account +```py +accountId = "acc_GP4lfNA0iIMn5B" + +webhookId = "HK890egfiItP3H" + +client.webhook.delete(webhookId, accountId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account that must be deleted. | +| webhookId* | string | The unique identifier of the webhook whose details are to be updated | + +**Response:** +```json +[] +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch a webhook +```py +accountId = "acc_GP4lfNA0iIMn5B" + +webhookId = "HK890egfiItP3H" + +client.webhook.fetch(webhookId, accountId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | +| webhookId* | string | The unique identifier of the webhook whose details are to be updated | + +**Response:** +```json +{ + "id": "HK890egfiItP3H", + "created_at": 1623060358, + "updated_at": 1623060358, + "owner_id": "H3kYHQ635sBwXG", + "owner_type": "merchant", + "context": [], + "disabled_at": 0, + "url": "https://en1mwkqo5ioct.x.pipedream.net", + "alert_email": "gaurav.kumar@example.com", + "secret_exists": true, + "entity": "webhook", + "active": true, + "events": [ + "payment.authorized", + "payment.failed", + "payment.captured", + "payment.dispute.created", + "refund.failed", + "refund.created" + ] +} +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch all Webhooks +```py +accountId = "acc_GP4lfNA0iIMn5B" + +client.webhook.all({ + "count": 3 +}, accountId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|-------------|---------------------------------------------| +| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. | +| from | integer | Timestamp, in seconds, from when the webhooks are to be fetched. | +| to | integer | Timestamp, in seconds, till when the webhooks are to be fetched. | +| count | integer | Number of webhooks to be fetched. The default value is `10` and the maximum value is `100`. This can be used for pagination, in combination with `skip`. | +| skip | integer | Number of records to be skipped while fetching the webhooks. This can be used for pagination, in combination with `count`. | + +**Response:** +```json +{ + "id": "HK890egfiItP3H", + "created_at": 1623060358, + "updated_at": 1623060358, + "owner_id": "H3kYHQ635sBwXG", + "owner_type": "merchant", + "context": [], + "disabled_at": 0, + "url": "https://en1mwkqo5ioct.x.pipedream.net", + "alert_email": "gaurav.kumar@example.com", + "secret_exists": true, + "entity": "webhook", + "active": true, + "events": [ + "payment.authorized", + "payment.failed", + "payment.captured", + "payment.dispute.created", + "refund.failed", + "refund.created" + ] +} +``` + +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/partners/webhooks)** \ No newline at end of file diff --git a/razorpay/__init__.py b/razorpay/__init__.py index 1c6a2c1b..92fcd45d 100644 --- a/razorpay/__init__.py +++ b/razorpay/__init__.py @@ -20,6 +20,11 @@ from .utility import Utility from .constants import ERROR_CODE from .constants import HTTP_STATUS_CODE +from .resources import Account +from .resources import Stakeholder +from .resources import Product +from .resources import Iin +from .resources import Webhook __all__ = [ 'Payment', @@ -44,4 +49,9 @@ 'Qrcode', 'HTTP_STATUS_CODE', 'ERROR_CODE', + 'Account', + 'Stakeholder', + 'Product', + 'Iin', + 'Webhook' ] diff --git a/razorpay/client.py b/razorpay/client.py index f835e139..ea6cf08d 100644 --- a/razorpay/client.py +++ b/razorpay/client.py @@ -176,6 +176,23 @@ def put(self, path, data, **options): data, options = self._update_request(data, options) return self.request('put', path, data=data, **options) + def file(self, path, data, **options): + fileDict = {} + fieldDict = {} + + if('file' not in data): + # if file is not exists in the dictionary + data['file'] = "" + + fileDict['file'] = data['file'] + + # Create a dict of form fields + for fields in data: + if(fields != 'file'): + fieldDict[str(fields)] = data[fields] + + return self.request('post', path, files=fileDict, data=fieldDict, **options) + def _update_request(self, data, options): """ Updates The resource data and header options diff --git a/razorpay/constants/url.py b/razorpay/constants/url.py index 3f2be33e..e9ae8dea 100644 --- a/razorpay/constants/url.py +++ b/razorpay/constants/url.py @@ -1,5 +1,7 @@ class URL(object): - BASE_URL = 'https://api.razorpay.com/v1' + BASE_URL = 'https://api.razorpay.com' + V1 = '/v1' + V2 = '/v2' ORDER_URL = "/orders" INVOICE_URL = "/invoices" PAYMENT_LINK_URL = "/payment_links" @@ -17,3 +19,10 @@ class URL(object): QRCODE_URL = "/payments/qr_codes" REGISTRATION_LINK_URL = "/subscription_registration" FUND_ACCOUNT_URL = "/fund_accounts" + ACCOUNT = "/accounts" + STAKEHOLDER = "/stakeholders" + PRODUCT = "/products" + TNC = "/tnc" + TOKEN = "/tokens" + IIN = "/iins" + WEBHOOK = "/webhooks" diff --git a/razorpay/resources/__init__.py b/razorpay/resources/__init__.py index 39fa1323..68917d25 100644 --- a/razorpay/resources/__init__.py +++ b/razorpay/resources/__init__.py @@ -16,6 +16,11 @@ from .settlement import Settlement from .item import Item from .fund_account import FundAccount +from .account import Account +from .stakeholder import Stakeholder +from .product import Product +from .iin import Iin +from .webhook import Webhook __all__ = [ 'Payment', @@ -35,5 +40,10 @@ 'Settlement', 'Item', 'QrCode', - 'FundAccount' + 'FundAccount', + 'Account', + 'Stakeholder', + 'Product', + 'Iin', + 'Webhook' ] diff --git a/razorpay/resources/account.py b/razorpay/resources/account.py new file mode 100644 index 00000000..d9b29211 --- /dev/null +++ b/razorpay/resources/account.py @@ -0,0 +1,74 @@ +from .base import Resource +from ..constants.url import URL + + +class Account(Resource): + def __init__(self, client=None): + super(Account, self).__init__(client) + self.base_url = URL.V2 + URL.ACCOUNT + + def create(self, data={}, **kwargs): + """ + Create account from given dict + + Returns: + Account Dict which was created + """ + url = self.base_url + return self.post_url(url, data, **kwargs) + + def fetch(self, account_id, data={}, **kwargs): + """ + Fetch account for given Id + + Args: + account_id : Id for which addon object has to be retrieved + + Returns: + account dict for given account_id + """ + return super(Account, self).fetch(account_id, data, **kwargs) + + def edit(self, account_id, data={}, **kwargs): + """ + Edit account information from given dict + + Returns: + Account Dict which was edited + """ + url = '{}/{}'.format(self.base_url, account_id) + + return self.patch_url(url, data, **kwargs) + + def delete(self, account_id, data={}, **kwargs): + """ + Delete account for given id + + Args: + account_id : Id for which account object has to be deleted + """ + url = '{}/{}'.format(self.base_url, account_id) + + return self.delete_url(url, data, **kwargs) + + def uploadAccountDoc(self, account_id, data={}, **kwargs): + """ + Upload Account Documents + + Returns: + Account Document dict which was created + """ + url = '{}/{}/{}'.format(self.base_url, account_id, "documents") + + return self.file_url(url, data, **kwargs) + + def fetchAccountDoc(self, account_id, data={}, **kwargs): + """ + Fetch Account Documents + + Returns: + Account Document dict for given account_id + """ + url = '{}/{}/{}'.format(self.base_url, account_id, "documents") + + return self.get_url(url, data, **kwargs) diff --git a/razorpay/resources/addon.py b/razorpay/resources/addon.py index a3953c94..06fc5dea 100644 --- a/razorpay/resources/addon.py +++ b/razorpay/resources/addon.py @@ -5,10 +5,10 @@ class Addon(Resource): def __init__(self, client=None): super(Addon, self).__init__(client) - self.base_url = URL.ADDON_URL + self.base_url = URL.V1 + URL.ADDON_URL def fetch(self, addon_id, data={}, **kwargs): - """" + """ Fetch addon for given Id Args: @@ -31,7 +31,7 @@ def delete(self, addon_id, data={}, **kwargs): return self.delete_url(url, data, **kwargs) def all(self, data={}, **kwargs): - """" + """ Fetch all Add-ons Returns: Dictionary of Add-ons diff --git a/razorpay/resources/base.py b/razorpay/resources/base.py index cbfd018d..72a9a565 100644 --- a/razorpay/resources/base.py +++ b/razorpay/resources/base.py @@ -28,3 +28,6 @@ def delete_url(self, url, data, **kwargs): def delete(self, id, data, **kwargs): url = "{}/{}/delete".format(self.base_url, id) return self.delete_url(url, data, **kwargs) + + def file_url(self, url, data, **kwargs): + return self.client.file(url, data, **kwargs) \ No newline at end of file diff --git a/razorpay/resources/card.py b/razorpay/resources/card.py index e6913afe..7bbb4b68 100644 --- a/razorpay/resources/card.py +++ b/razorpay/resources/card.py @@ -5,10 +5,10 @@ class Card(Resource): def __init__(self, client=None): super(Card, self).__init__(client) - self.base_url = URL.CARD_URL + self.base_url = URL.V1 + URL.CARD_URL def fetch(self, card_id, data={}, **kwargs): - """" + """ Fetch Card for given Id Args: @@ -18,3 +18,16 @@ def fetch(self, card_id, data={}, **kwargs): Card dict for given card Id """ return super(Card, self).fetch(card_id, data, **kwargs) + + def requestCardReference(self, data={}, **kwargs): + """ + Fetch card reference number for a specific card + + Args: + number : The card number whose PAR or network reference id should be retrieved. + + Returns: + Card dict for given card Id + """ + url = "{}/{}".format(self.base_url, "fingerprints") + return self.post_url(url, data, **kwargs) diff --git a/razorpay/resources/customer.py b/razorpay/resources/customer.py index d5ce5054..96628247 100644 --- a/razorpay/resources/customer.py +++ b/razorpay/resources/customer.py @@ -5,10 +5,10 @@ class Customer(Resource): def __init__(self, client=None): super(Customer, self).__init__(client) - self.base_url = URL.CUSTOMER_URL + self.base_url = URL.V1 + URL.CUSTOMER_URL def fetch(self, customer_id, data={}, **kwargs): - """" + """ Fetch Customer for given Id Args: @@ -20,7 +20,7 @@ def fetch(self, customer_id, data={}, **kwargs): return super(Customer, self).fetch(customer_id, data, **kwargs) def create(self, data={}, **kwargs): - """" + """ Create Customer from given dict Returns: @@ -30,7 +30,7 @@ def create(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def edit(self, customer_id, data={}, **kwargs): - """" + """ Edit Customer information from given dict Returns: @@ -41,7 +41,7 @@ def edit(self, customer_id, data={}, **kwargs): return self.put_url(url, data, **kwargs) def all(self, data={}, **kwargs): - """" + """ Fetch all customer Returns: diff --git a/razorpay/resources/fund_account.py b/razorpay/resources/fund_account.py index 98b02203..27463642 100644 --- a/razorpay/resources/fund_account.py +++ b/razorpay/resources/fund_account.py @@ -5,10 +5,10 @@ class FundAccount(Resource): def __init__(self, client=None): super(FundAccount, self).__init__(client) - self.base_url = URL.FUND_ACCOUNT_URL + self.base_url = URL.V1 + URL.FUND_ACCOUNT_URL def all(self, data={}, **kwargs): - """" + """ Fetch all Fund Account entities Returns: @@ -17,7 +17,7 @@ def all(self, data={}, **kwargs): return super(FundAccount, self).all(data, **kwargs) def create(self, data={}, **kwargs): - """" + """ Create a fund account Args: diff --git a/razorpay/resources/iin.py b/razorpay/resources/iin.py new file mode 100644 index 00000000..b3c87eda --- /dev/null +++ b/razorpay/resources/iin.py @@ -0,0 +1,19 @@ +from .base import Resource +from ..constants.url import URL + + +class Iin(Resource): + def __init__(self, client=None): + super(Iin, self).__init__(client) + self.base_url = URL.V1 + URL.IIN + + def fetch(self, token_iin, data={}, **kwargs): + """ + fetch card properties using token iin + + Returns: + Iin dict for given token iin + """ + + return super(Iin, self).fetch(token_iin, data, **kwargs) + diff --git a/razorpay/resources/invoice.py b/razorpay/resources/invoice.py index 8a25af1c..a5a37fcf 100644 --- a/razorpay/resources/invoice.py +++ b/razorpay/resources/invoice.py @@ -6,14 +6,14 @@ class Invoice(Resource): def __init__(self, client=None): super(Invoice, self).__init__(client) - self.base_url = URL.INVOICE_URL + self.base_url = URL.V1 + URL.INVOICE_URL def fetch_all(self, data={}, **kwargs): # pragma: no cover warnings.warn("Will be Deprecated in next release", DeprecationWarning) return self.all(data, **kwargs) def all(self, data={}, **kwargs): - """" + """ Fetch all Invoice entities Returns: @@ -22,7 +22,7 @@ def all(self, data={}, **kwargs): return super(Invoice, self).all(data, **kwargs) def fetch(self, invoice_id, data={}, **kwargs): - """" + """ Fetch Invoice for given Id Args: @@ -34,7 +34,7 @@ def fetch(self, invoice_id, data={}, **kwargs): return super(Invoice, self).fetch(invoice_id, data, **kwargs) def create(self, data={}, **kwargs): - """" + """ Create Invoice from given dict Args: @@ -47,7 +47,7 @@ def create(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def notify_by(self, invoice_id, medium, **kwargs): - """" + """ Send/Resend notifications to customer via email/sms Args: @@ -61,7 +61,7 @@ def notify_by(self, invoice_id, medium, **kwargs): return self.post_url(url, {}, **kwargs) def cancel(self, invoice_id, **kwargs): - """" + """ Cancel an unpaid Invoice with given ID via API It can only be called on an invoice that is not in the paid state. @@ -74,7 +74,7 @@ def cancel(self, invoice_id, **kwargs): return self.post_url(url, {}, **kwargs) def delete(self, invoice_id, **kwargs): - """" + """ Delete an invoice You can delete an invoice which is in the draft state. @@ -87,7 +87,7 @@ def delete(self, invoice_id, **kwargs): return self.delete_url(url, {}, **kwargs) def issue(self, invoice_id, **kwargs): - """" + """ Issues an invoice in draft state Args: @@ -99,7 +99,7 @@ def issue(self, invoice_id, **kwargs): return self.post_url(url, {}, **kwargs) def edit(self, invoice_id, data={}, **kwargs): - """" + """ Update an invoice In draft state all the attributes are allowed. diff --git a/razorpay/resources/item.py b/razorpay/resources/item.py index 2965f327..be00e872 100644 --- a/razorpay/resources/item.py +++ b/razorpay/resources/item.py @@ -5,10 +5,10 @@ class Item(Resource): def __init__(self, client=None): super(Item, self).__init__(client) - self.base_url = URL.ITEM_URL + self.base_url = URL.V1 + URL.ITEM_URL def create(self, data={}, **kwargs): - """" + """ Create item Returns: @@ -18,7 +18,7 @@ def create(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def fetch(self, item_id, data={}, **kwargs): - """" + """ Fetch an Item Args: @@ -30,7 +30,7 @@ def fetch(self, item_id, data={}, **kwargs): return super(Item, self).fetch(item_id, data, **kwargs) def all(self, data={}, **kwargs): - """" + """ Fetch all items Returns: @@ -39,7 +39,7 @@ def all(self, data={}, **kwargs): return super(Item, self).all(data, **kwargs) def edit(self, item_id, data={}, **kwargs): - """" + """ Update an Item Returns: @@ -50,7 +50,7 @@ def edit(self, item_id, data={}, **kwargs): return self.patch_url(url, data, **kwargs) def delete(self, item_id, **kwargs): - """" + """ Delete an Item Args: diff --git a/razorpay/resources/order.py b/razorpay/resources/order.py index fa323b50..fb601ccf 100644 --- a/razorpay/resources/order.py +++ b/razorpay/resources/order.py @@ -6,7 +6,7 @@ class Order(Resource): def __init__(self, client=None): super(Order, self).__init__(client) - self.base_url = URL.ORDER_URL + self.base_url = URL.V1 + URL.ORDER_URL def fetch_all(self, data={}, **kwargs): # pragma: no cover warnings.warn("Will be Deprecated in next release, use all", @@ -14,7 +14,7 @@ def fetch_all(self, data={}, **kwargs): # pragma: no cover return self.all(data, **kwargs) def all(self, data={}, **kwargs): - """" + """ Fetch all Order entities Returns: @@ -23,7 +23,7 @@ def all(self, data={}, **kwargs): return super(Order, self).all(data, **kwargs) def fetch(self, order_id, data={}, **kwargs): - """" + """ Fetch Order for given Id Args: @@ -40,7 +40,7 @@ def fetch_all_payments(self, order_id, data={}, **kwargs): # pragma: no cover return self.payments(order_id, data, **kwargs) def payments(self, order_id, data={}, **kwargs): - """" + """ Fetch Payment for Order Id Args: @@ -53,7 +53,7 @@ def payments(self, order_id, data={}, **kwargs): return self.get_url(url, data, **kwargs) def create(self, data={}, **kwargs): - """" + """ Create Order from given dict Args: @@ -71,7 +71,7 @@ def create(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def edit(self, order_id, data={}, **kwargs): - """" + """ Update order Args: diff --git a/razorpay/resources/payment.py b/razorpay/resources/payment.py index 4c2efe23..ee5e3130 100644 --- a/razorpay/resources/payment.py +++ b/razorpay/resources/payment.py @@ -6,7 +6,7 @@ class Payment(Resource): def __init__(self, client=None): super(Payment, self).__init__(client) - self.base_url = URL.PAYMENTS_URL + self.base_url = URL.V1 + URL.PAYMENTS_URL def fetch_all(self, data={}, **kwargs): # pragma: no cover warnings.warn("Will be Deprecated in next release, use all", @@ -14,7 +14,7 @@ def fetch_all(self, data={}, **kwargs): # pragma: no cover return self.all(data, **kwargs) def all(self, data={}, **kwargs): - """" + """ Fetch all Payment entities Returns: @@ -23,7 +23,7 @@ def all(self, data={}, **kwargs): return super(Payment, self).all(data, **kwargs) def fetch(self, payment_id, data={}, **kwargs): - """" + """ Fetch Payment for given Id Args: @@ -35,7 +35,7 @@ def fetch(self, payment_id, data={}, **kwargs): return super(Payment, self).fetch(payment_id, data, **kwargs) def capture(self, payment_id, amount, data={}, **kwargs): # nosemgrep : python.lang.correctness.common-mistakes.default-mutable-dict.default-mutable-dict - """" + """ Capture Payment for given Id Args: @@ -50,7 +50,7 @@ def capture(self, payment_id, amount, data={}, **kwargs): # nosemgrep : python.l return self.post_url(url, data, **kwargs) def refund(self, payment_id, amount, data={}, **kwargs): # pragma: no cover # nosemgrep : python.lang.correctness.common-mistakes.default-mutable-dict.default-mutable-dict - """" + """ Refund Payment for given Id Args: @@ -65,7 +65,7 @@ def refund(self, payment_id, amount, data={}, **kwargs): # pragma: no cover # n return self.post_url(url, data, **kwargs) def transfer(self, payment_id, data={}, **kwargs): - """" + """ Create Transfer for given Payment Id Args: @@ -78,7 +78,7 @@ def transfer(self, payment_id, data={}, **kwargs): return self.post_url(url, data, **kwargs) def transfers(self, payment_id, data={}, **kwargs): - """" + """ Fetches all transfer for given Payment Id Args: @@ -92,7 +92,7 @@ def transfers(self, payment_id, data={}, **kwargs): return self.get_url(url, data, **kwargs) def bank_transfer(self, payment_id, data={}, **kwargs): - """" + """ Bank Transfer Entity for given Payment Args: @@ -105,7 +105,7 @@ def bank_transfer(self, payment_id, data={}, **kwargs): return self.get_url(url, data, **kwargs) def upi_transfer(self, payment_id, data={}, **kwargs): - """" + """ UPI Transfer Entity for given Payment Args: @@ -118,7 +118,7 @@ def upi_transfer(self, payment_id, data={}, **kwargs): return self.get_url(url, data, **kwargs) def refund(self, payment_id, data={}, **kwargs): - """" + """ Create a normal refund Returns: @@ -128,7 +128,7 @@ def refund(self, payment_id, data={}, **kwargs): return self.post_url(url, data, **kwargs) def fetch_multiple_refund(self, payment_id, data={}, **kwargs): - """" + """ Fetch multiple refunds for a payment Returns: @@ -138,7 +138,7 @@ def fetch_multiple_refund(self, payment_id, data={}, **kwargs): return self.get_url(url, data, **kwargs) def fetch_refund_id(self, payment_id, refund_id, **kwargs): - """" + """ Fetch multiple refunds for a payment Returns: @@ -148,7 +148,7 @@ def fetch_refund_id(self, payment_id, refund_id, **kwargs): return self.get_url(url, {}, **kwargs) def edit(self, payment_id, data={}, **kwargs): - """" + """ Update the Payment Args: data : Dictionary having keys using which order have to be edited @@ -162,7 +162,7 @@ def edit(self, payment_id, data={}, **kwargs): return self.patch_url(url, data, **kwargs) def fetchCardDetails(self, payment_id, **kwargs): - """" + """ Fetch Card Details of a Payment Args: @@ -175,7 +175,7 @@ def fetchCardDetails(self, payment_id, **kwargs): return self.get_url(url, {}, **kwargs) def fetchDownTime(self, **kwargs): - """" + """ Fetch Card Details of a Payment Args: @@ -188,7 +188,7 @@ def fetchDownTime(self, **kwargs): return self.get_url(url, {}, **kwargs) def fetchDownTimeById(self, downtime_id, **kwargs): - """" + """ Fetch Payment Downtime Details by ID Args: @@ -201,7 +201,7 @@ def fetchDownTimeById(self, downtime_id, **kwargs): return self.get_url(url, {}, **kwargs) def createPaymentJson(self ,data={}, **kwargs): - """" + """ Create a Payment Args: @@ -216,7 +216,7 @@ def createPaymentJson(self ,data={}, **kwargs): return self.post_url(url, data, **kwargs) def createRecurring(self, data={}, **kwargs): - """" + """ Create Recurring Payments Return: Recurring Payments dict @@ -225,7 +225,7 @@ def createRecurring(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def createUpi(self, data={}, **kwargs): - """" + """ Initiate a payment Return: Payments dict @@ -234,7 +234,7 @@ def createUpi(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def validateVpa(self, data={}, **kwargs): - """" + """ Validate the VPA Return: Payments dict @@ -243,7 +243,7 @@ def validateVpa(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def fetchPaymentMethods(self, **kwargs): - """" + """ Fetch payment methods Return: Payments dict @@ -252,7 +252,7 @@ def fetchPaymentMethods(self, **kwargs): return self.get_url(url, {}, **kwargs) def otpGenerate(self, payment_id, data={}, **kwargs): - """" + """ Otp Generate Args: @@ -265,7 +265,7 @@ def otpGenerate(self, payment_id, data={}, **kwargs): return self.post_url(url, data, **kwargs) def otpSubmit(self, payment_id, data={}, **kwargs): - """" + """ Otp Submit Args: @@ -278,7 +278,7 @@ def otpSubmit(self, payment_id, data={}, **kwargs): return self.post_url(url, data, **kwargs) def otpResend(self, payment_id, data={}, **kwargs): - """" + """ Otp Resend Args: diff --git a/razorpay/resources/payment_link.py b/razorpay/resources/payment_link.py index 98d687fe..843786d6 100644 --- a/razorpay/resources/payment_link.py +++ b/razorpay/resources/payment_link.py @@ -6,14 +6,14 @@ class PaymentLink(Resource): def __init__(self, client=None): super(PaymentLink, self).__init__(client) - self.base_url = URL.PAYMENT_LINK_URL + self.base_url = URL.V1 + URL.PAYMENT_LINK_URL def fetch_all(self, data={}, **kwargs): # pragma: no cover warnings.warn("Will be Deprecated in next release", DeprecationWarning) return self.all(data, **kwargs) def all(self, data={}, **kwargs): - """" + """ Fetch all Payment link entities Returns: @@ -22,7 +22,7 @@ def all(self, data={}, **kwargs): return super(PaymentLink, self).all(data, **kwargs) def fetch(self, payment_link_id, data={}, **kwargs): - """" + """ Fetch Payment link for given Id Args: @@ -34,7 +34,7 @@ def fetch(self, payment_link_id, data={}, **kwargs): return super(PaymentLink, self).fetch(payment_link_id, data, **kwargs) def create(self, data={}, **kwargs): - """" + """ Create Payment link from given dict Args: @@ -47,7 +47,7 @@ def create(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def cancel(self, payment_link_id, **kwargs): - """" + """ Cancel an unpaid Payment link with given ID via API It can only be called on an Payment link that is not in the paid state. @@ -60,7 +60,7 @@ def cancel(self, payment_link_id, **kwargs): return self.post_url(url, {}, **kwargs) def edit(self, payment_link_id, data={}, **kwargs): - """" + """ Edit the Payment link Args: data : Dictionary having keys using which order have to be edited @@ -77,7 +77,7 @@ def edit(self, payment_link_id, data={}, **kwargs): return self.patch_url(url, data, **kwargs) def notifyBy(self, payment_link_id, medium, **kwargs): - """" + """ Send notification Args: diff --git a/razorpay/resources/plan.py b/razorpay/resources/plan.py index 3b8acca7..965024b1 100644 --- a/razorpay/resources/plan.py +++ b/razorpay/resources/plan.py @@ -5,10 +5,10 @@ class Plan(Resource): def __init__(self, client=None): super(Plan, self).__init__(client) - self.base_url = URL.PLAN_URL + self.base_url = URL.V1 + URL.PLAN_URL def create(self, data={}, **kwargs): - """" + """ Create Plan from given dict Args: @@ -21,7 +21,7 @@ def create(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def fetch(self, plan_id, data={}, **kwargs): - """" + """ Fetch Plan for given Id Args: @@ -33,7 +33,7 @@ def fetch(self, plan_id, data={}, **kwargs): return super(Plan, self).fetch(plan_id, data, **kwargs) def all(self, data={}, **kwargs): - """" + """ Fetch all plan entities Returns: diff --git a/razorpay/resources/product.py b/razorpay/resources/product.py new file mode 100644 index 00000000..6774f1d6 --- /dev/null +++ b/razorpay/resources/product.py @@ -0,0 +1,49 @@ +from .base import Resource +from ..constants.url import URL + + +class Product(Resource): + def __init__(self, client=None): + super(Product, self).__init__(client) + self.base_url = URL.V2 + URL.ACCOUNT + + def requestProductConfiguration(self, account_id, data={}, **kwargs): + """ + Request a Product Configuration from given dict + + Returns: + Product Configuration Dict which was created + """ + url = '{}/{}{}'.format(self.base_url, account_id, URL.PRODUCT) + + return self.post_url(url, data, **kwargs) + + def fetch(self, account_id, product_id, data={}, **kwargs): + """ + Fetch product for given accound and product id + + Returns: + account dict for given account_id + """ + url = '{}/{}{}/{}'.format(self.base_url, account_id, URL.PRODUCT, product_id) + return self.get_url(url, data, **kwargs) + + def edit(self, account_id, product_id, data={}, **kwargs): + """ + Edit account information from given dict + + Returns: + Account Dict which was edited + """ + url = '{}/{}{}/{}'.format(self.base_url, account_id, URL.PRODUCT, product_id) + return self.patch_url(url, data, **kwargs) + + def fetchTnc(self, product_name, data={}, **kwargs): + """ + Fetch Terms and Conditions for a Sub-Merchant + + Returns: + Tnc dict for given account_id + """ + url = '{}{}/{}{}'.format(URL.V2, URL.PRODUCT, product_name, URL.TNC ) + return self.get_url(url, data, **kwargs) \ No newline at end of file diff --git a/razorpay/resources/qrcode.py b/razorpay/resources/qrcode.py index 71150cf4..0a3704d0 100644 --- a/razorpay/resources/qrcode.py +++ b/razorpay/resources/qrcode.py @@ -5,10 +5,10 @@ class Qrcode(Resource): def __init__(self, client=None): super(Qrcode, self).__init__(client) - self.base_url = URL.QRCODE_URL + self.base_url = URL.V1 + URL.QRCODE_URL def fetch(self, qrcode_id, data={}, **kwargs): - """" + """ Fetch a Qr code Args: @@ -20,7 +20,7 @@ def fetch(self, qrcode_id, data={}, **kwargs): return super(Qrcode, self).fetch(qrcode_id, data, **kwargs) def create(self, data={}, **kwargs): - """" + """ Create a QR Code Returns: @@ -30,7 +30,7 @@ def create(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def all(self, data={}, **kwargs): - """" + """ Fetch All Qr Code Returns: @@ -39,7 +39,7 @@ def all(self, data={}, **kwargs): return super(Qrcode, self).all(data, **kwargs) def fetch_all_payments(self, qrcode_id, data={}, **kwargs): - """" + """ Fetch Payments for a QR Code Returns: @@ -49,7 +49,7 @@ def fetch_all_payments(self, qrcode_id, data={}, **kwargs): return self.get_url(url, data, **kwargs) def close(self, qrcode_id, **kwargs): - """" + """ Close a QR Code Returns: diff --git a/razorpay/resources/refund.py b/razorpay/resources/refund.py index 5b2ba1f1..92f5fc0f 100644 --- a/razorpay/resources/refund.py +++ b/razorpay/resources/refund.py @@ -6,7 +6,7 @@ class Refund(Resource): def __init__(self, client=None): super(Refund, self).__init__(client) - self.base_url = URL.REFUNDS_URL + self.base_url = URL.V1 + URL.REFUNDS_URL def fetch_all(self, data={}, **kwargs): # pragma: no cover warnings.warn("Will be Deprecated in next release, use all", @@ -21,7 +21,7 @@ def create(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def all(self, data={}, **kwargs): - """" + """ Fetch All Refund Returns: @@ -30,7 +30,7 @@ def all(self, data={}, **kwargs): return super(Refund, self).all(data, **kwargs) def fetch(self, refund_id, data={}, **kwargs): - """" + """ Refund object for given paymnet Id Args: @@ -42,7 +42,7 @@ def fetch(self, refund_id, data={}, **kwargs): return super(Refund, self).fetch(refund_id, data, **kwargs) def edit(self, refund_id, data={}, **kwargs): - """" + """ Update Refund Returns: diff --git a/razorpay/resources/registration_link.py b/razorpay/resources/registration_link.py index 9dc17166..7a17ba69 100644 --- a/razorpay/resources/registration_link.py +++ b/razorpay/resources/registration_link.py @@ -5,10 +5,10 @@ class RegistrationLink(Resource): def __init__(self, client=None): super(RegistrationLink, self).__init__(client) - self.base_url = URL.REGISTRATION_LINK_URL + self.base_url = URL.V1 + URL.REGISTRATION_LINK_URL def create(self, data={}, **kwargs): - """" + """ Create a Registration Link Args: customer : Details of the customer to whom the registration link will be sent. diff --git a/razorpay/resources/settlement.py b/razorpay/resources/settlement.py index 9b7f3ea1..2918463d 100644 --- a/razorpay/resources/settlement.py +++ b/razorpay/resources/settlement.py @@ -5,10 +5,10 @@ class Settlement(Resource): def __init__(self, client=None): super(Settlement, self).__init__(client) - self.base_url = URL.SETTLEMENT_URL + self.base_url = URL.V1 + URL.SETTLEMENT_URL def all(self, data={}, **kwargs): - """" + """ Fetch all Settlement entities Returns: @@ -17,7 +17,7 @@ def all(self, data={}, **kwargs): return super(Settlement, self).all(data, **kwargs) def fetch(self, settlement_id, data={}, **kwargs): - """" + """ Fetch Settlement data for given Id Args: @@ -29,7 +29,7 @@ def fetch(self, settlement_id, data={}, **kwargs): return super(Settlement, self).fetch(settlement_id, data, **kwargs) def report(self, data={}, **kwargs): - """" + """ Settlement report for a month Returns: diff --git a/razorpay/resources/stakeholder.py b/razorpay/resources/stakeholder.py new file mode 100644 index 00000000..ab63a00c --- /dev/null +++ b/razorpay/resources/stakeholder.py @@ -0,0 +1,81 @@ +from .base import Resource +from ..constants.url import URL + + +class Stakeholder(Resource): + def __init__(self, client=None): + super(Stakeholder, self).__init__(client) + self.base_url = URL.V2 + URL.ACCOUNT + + def create(self, account_id, data={}, **kwargs): + """ + Create stakeholder from given dict and account id + + Returns: + Stakeholder Dict which was created + """ + url = '{}/{}{}'.format(self.base_url, account_id, URL.STAKEHOLDER) + + return self.post_url(url, data, **kwargs) + + def fetch(self, account_id, stakeholder_id, data={}, **kwargs): + """ + Fetch stakeholder for given account & stakeholder id + + Args: + account_id : Id for which account object has to be retrieved + stakeholder_id : Id for which stakeholder object has to be retrieved + + Returns: + stakeholder dict for given account_id + """ + url = '{}/{}{}/{}'.format(self.base_url, account_id, URL.STAKEHOLDER, stakeholder_id) + + return self.get_url(url, data, **kwargs) + + def all(self, account_id, data={}, **kwargs): + """ + Fetch all stakeholder + + Args: + account_id : Id for which account object has to be retrieved + + Returns: + stakeholder dict for given account_id + """ + url = '{}/{}{}'.format(self.base_url, account_id, URL.STAKEHOLDER) + + return self.get_url(url, data, **kwargs) + + def edit(self, account_id, stakeholder_id, data={}, **kwargs): + """ + Edit stakeholder information from given dict + + Returns: + Stakeholder Dict which was edited + """ + url = '{}/{}{}/{}'.format(self.base_url, account_id, URL.STAKEHOLDER, stakeholder_id) + + return self.patch_url(url, data, **kwargs) + + def uploadStakeholderDoc(self, account_id, stakeholder_id, data={}, **kwargs): + """ + Upload Stakeholder Documents + + Returns: + Stakeholder Document dict which was created + """ + url = '{}/{}{}/{}/{}'.format(self.base_url, account_id, URL.STAKEHOLDER, stakeholder_id, "documents") + + return self.file_url(url, data, **kwargs) + + def fetchStakeholderDoc(self, account_id, stakeholder_id, data={}, **kwargs): + """ + Fetch Stakeholder Documents + + Returns: + Stakeholder Document dict for given account & stakeholder Id + """ + url = '{}/{}{}/{}/{}'.format(self.base_url, account_id, URL.STAKEHOLDER, stakeholder_id, "documents") + + return self.get_url(url, data, **kwargs) \ No newline at end of file diff --git a/razorpay/resources/subscription.py b/razorpay/resources/subscription.py index 037640f1..d313b963 100644 --- a/razorpay/resources/subscription.py +++ b/razorpay/resources/subscription.py @@ -5,10 +5,10 @@ class Subscription(Resource): def __init__(self, client=None): super(Subscription, self).__init__(client) - self.base_url = URL.SUBSCRIPTION_URL + self.base_url = URL.V1 + URL.SUBSCRIPTION_URL def all(self, data={}, **kwargs): - """" + """ Fetch all Subscription entities Returns: @@ -17,7 +17,7 @@ def all(self, data={}, **kwargs): return super(Subscription, self).all(data, **kwargs) def fetch(self, subscription_id, data={}, **kwargs): - """" + """ Fetch Subscription for given Id Args: @@ -29,7 +29,7 @@ def fetch(self, subscription_id, data={}, **kwargs): return super(Subscription, self).fetch(subscription_id, data, **kwargs) def create(self, data={}, **kwargs): - """" + """ Create Subscription from given dict Args: @@ -81,7 +81,7 @@ def createAddon(self, subscription_id, data={}, **kwargs): return self.post_url(url, data, **kwargs) def edit(self, subscription_id, data={}, **kwargs): - """" + """ Update particular subscription Args: @@ -93,7 +93,7 @@ def edit(self, subscription_id, data={}, **kwargs): return self.patch_url(url, data, **kwargs) def pending_update(self, subscription_id, **kwargs): - """" + """ Fetch Subscription for given Id Args: diff --git a/razorpay/resources/token.py b/razorpay/resources/token.py index 5273e25b..61bf9eab 100644 --- a/razorpay/resources/token.py +++ b/razorpay/resources/token.py @@ -5,10 +5,21 @@ class Token(Resource): def __init__(self, client=None): super(Token, self).__init__(client) - self.base_url = URL.CUSTOMER_URL + self.base_url = URL.V1 + URL.CUSTOMER_URL + + def create(self, data={}, **kwargs): + """ + Create token from given dict + + Returns: + token Dict which was created + """ + url = '{}{}'.format(URL.V1, URL.TOKEN) + + return self.post_url(url, data, **kwargs) def fetch(self, customer_id, token_id, data={}, **kwargs): - """" + """ Fetch Token for given Id and given customer Id Args: @@ -22,7 +33,7 @@ def fetch(self, customer_id, token_id, data={}, **kwargs): return self.get_url(url, data, **kwargs) def all(self, customer_id, data={}, **kwargs): - """" + """ Get all tokens for given customer Id Args: @@ -35,7 +46,7 @@ def all(self, customer_id, data={}, **kwargs): return self.get_url(url, data, **kwargs) def delete(self, customer_id, token_id, data={}, **kwargs): - """" + """ Delete Given Token For a Customer Args: @@ -46,3 +57,33 @@ def delete(self, customer_id, token_id, data={}, **kwargs): """ url = "{}/{}/tokens/{}".format(self.base_url, customer_id, token_id) return self.delete_url(url, data, **kwargs) + + def fetchToken(self, data={}, **kwargs): + """ + fetch Given Token For a Customer + + Returns: + Dict for fetch token + """ + url = '{}{}/{}'.format(URL.V1, URL.TOKEN, "fetch") + return self.post_url(url, data, **kwargs) + + def deleteToken(self, data={}, **kwargs): + """ + Delete Given Token + + Returns: + Dict for deleted token + """ + url = '{}{}/{}'.format(URL.V1, URL.TOKEN, "delete") + return self.post_url(url, data, **kwargs) + + def processPaymentOnAlternatePAorPG(self, data={}, **kwargs): + """ + Process a Payment on another PA/PG with Token Created on Razorpay + + Returns: + + """ + url = '{}{}/{}'.format(URL.V1, URL.TOKEN, "service_provider_tokens/token_transactional_data") + return self.post_url(url, data, **kwargs) diff --git a/razorpay/resources/transfer.py b/razorpay/resources/transfer.py index 914a2c52..7bf92a7e 100644 --- a/razorpay/resources/transfer.py +++ b/razorpay/resources/transfer.py @@ -6,7 +6,7 @@ class Transfer(Resource): def __init__(self, client=None): super(Transfer, self).__init__(client) - self.base_url = URL.TRANSFER_URL + self.base_url = URL.V1 + URL.TRANSFER_URL def fetch_all(self, data={}, **kwargs): # pragma: no cover warnings.warn("Will be Deprecated in next release, use all", @@ -14,14 +14,14 @@ def fetch_all(self, data={}, **kwargs): # pragma: no cover return self.all(data, **kwargs) def all(self, data={}, **kwargs): - """" + """ Fetch all Transfer entities Returns: Dictionary of Transfer data """ if 'payment_id' in data: - url = "/payments/{}/transfers".format(data['payment_id']) + url = URL.V1 + "/payments/{}/transfers".format(data['payment_id']) del data['payment_id'] return self.get_url(url, data, **kwargs) @@ -29,7 +29,7 @@ def all(self, data={}, **kwargs): return super(Transfer, self).all(data, **kwargs) def fetch(self, transfer_id, data={}, **kwargs): - """" + """ Fetch Transfer for given Id Args: @@ -41,7 +41,7 @@ def fetch(self, transfer_id, data={}, **kwargs): return super(Transfer, self).fetch(transfer_id, data, **kwargs) def create(self, data={}, **kwargs): - """" + """ Create Transfer from given dict Args: @@ -53,7 +53,7 @@ def create(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def edit(self, transfer_id, data={}, **kwargs): - """" + """ Edit Transfer from given id Args: @@ -66,7 +66,7 @@ def edit(self, transfer_id, data={}, **kwargs): return self.patch_url(url, data, **kwargs) def reverse(self, transfer_id, data={}, **kwargs): - """" + """ Reverse Transfer from given id Args: @@ -79,7 +79,7 @@ def reverse(self, transfer_id, data={}, **kwargs): return self.post_url(url, data, **kwargs) def reversals(self, transfer_id, data={}, **kwargs): - """" + """ Get all Reversal Transfer from given id Args: diff --git a/razorpay/resources/virtual_account.py b/razorpay/resources/virtual_account.py index eb5834d8..56ee7da1 100644 --- a/razorpay/resources/virtual_account.py +++ b/razorpay/resources/virtual_account.py @@ -6,10 +6,10 @@ class VirtualAccount(Resource): def __init__(self, client=None): super(VirtualAccount, self).__init__(client) - self.base_url = URL.VIRTUAL_ACCOUNT_URL + self.base_url = URL.V1 + URL.VIRTUAL_ACCOUNT_URL def all(self, data={}, **kwargs): - """" + """ Fetch all Virtual Account entities Returns: @@ -18,7 +18,7 @@ def all(self, data={}, **kwargs): return super(VirtualAccount, self).all(data, **kwargs) def fetch(self, virtual_account_id, data={}, **kwargs): - """" + """ Fetch Virtual Account for given Id Args: @@ -34,7 +34,7 @@ def fetch(self, virtual_account_id, data={}, **kwargs): **kwargs) def create(self, data={}, **kwargs): - """" + """ Create Virtual Account from given dict Args: @@ -47,7 +47,7 @@ def create(self, data={}, **kwargs): return self.post_url(url, data, **kwargs) def close(self, virtual_account_id, data={}, **kwargs): - """" + """ Close Virtual Account from given Id Args: @@ -58,7 +58,7 @@ def close(self, virtual_account_id, data={}, **kwargs): return self.post_url(url, data, **kwargs) def payments(self, virtual_account_id, data={}, **kwargs): - """" + """ Fetch Payment for Virtual Account Id Args: @@ -72,7 +72,7 @@ def payments(self, virtual_account_id, data={}, **kwargs): return self.get_url(url, data, **kwargs) def add_receiver(self, virtual_account_id, data={}, **kwargs): - """" + """ Add receiver to an existing virtual account Args: @@ -83,7 +83,7 @@ def add_receiver(self, virtual_account_id, data={}, **kwargs): return self.post_url(url, data, **kwargs) def add_allowed_player(self, virtual_account_id, data={}, **kwargs): - """" + """ Add an Allowed Payer Account Args: @@ -94,7 +94,7 @@ def add_allowed_player(self, virtual_account_id, data={}, **kwargs): return self.post_url(url, data, **kwargs) def delete_allowed_player(self, virtual_account_id, allowed_player_id, data={}, **kwargs): - """" + """ Delete an Allowed Payer Account Args: diff --git a/razorpay/resources/webhook.py b/razorpay/resources/webhook.py new file mode 100644 index 00000000..d0301d30 --- /dev/null +++ b/razorpay/resources/webhook.py @@ -0,0 +1,86 @@ +from .base import Resource +from ..constants.url import URL + + +class Webhook(Resource): + def __init__(self, client=None): + super(Webhook, self).__init__(client) + self.base_url = URL.V2 + URL.ACCOUNT + + def create(self, data={}, account_id=None, **kwargs): + """ + Create webhook from given dict + + Returns: + Webhook Dict which was created + """ + if account_id is None: + url = '{}{}'.format(URL.V1, URL.WEBHOOK) + else: + url = '{}/{}{}'.format(self.base_url, account_id, URL.WEBHOOK) + + return self.post_url(url, data, **kwargs) + + def fetch(self, webhook_id, account_id, data={}, **kwargs): + """ + Fetch webhook for given webhook id + + Args: + account_id : Id for which webhook object has to be retrieved + webhook_id : Id for which account object has to be retrieved + + Returns: + webhook dict for given webhook_id + """ + if(account_id): + url = '{}/{}{}/{}'.format(self.base_url, account_id, URL.WEBHOOK, webhook_id) + else: + url = '{}{}/{}'.format(URL.V1, URL.WEBHOOK, webhook_id) + + return self.get_url(url, data, **kwargs) + + def all(self, data={}, account_id=None, **kwargs): + """ + Fetch all webhooks + + Args: + account_id : Id for which webhook object has to be retrieved + + Returns: + webhook dict for given account_id + """ + if account_id is None: + url = '{}{}'.format(URL.V1, URL.WEBHOOK) + else: + url = '{}/{}{}'.format(self.base_url, account_id, URL.WEBHOOK) + + return self.get_url(url, data, **kwargs) + + def edit(self, webhook_id, account_id, data={}, **kwargs): + """ + Edit webhook from given dict + + Returns: + Webhook Dict which was edited + """ + if(account_id): + url = '{}/{}{}/{}'.format(self.base_url, account_id, URL.WEBHOOK, webhook_id) + return self.patch_url(url, data, **kwargs) + + else: + url = '{}{}/{}'.format(URL.V1, URL.WEBHOOK, webhook_id) + return self.put_url(url, data, **kwargs) + + def delete(self, webhook_id, account_id, data={}, **kwargs): + """ + delete webhook for given webhook id + + Args: + account_id : Id for which webhook object has to be retrieved + webhook_id : Id for which account object has to be retrieved + + Returns: + The response is always be an empty array like this - [] + """ + url = '{}/{}{}/{}'.format(self.base_url, account_id, URL.WEBHOOK, webhook_id) + return self.delete_url(url, data, **kwargs) \ No newline at end of file diff --git a/tests/helpers.py b/tests/helpers.py index ed051a92..b58aad80 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -16,7 +16,10 @@ def mock_file(filename): class ClientTestCase(unittest.TestCase): def setUp(self): self.base_url = 'https://api.razorpay.com/v1' - self.secondary_url = 'https://test-api.razorpay.com/v1' + self.base_url_v2 = 'https://api.razorpay.com/v2' + self.secondary_url = 'https://test-api.razorpay.com' + self.v1 = 'v1' + self.v2 = 'v2' self.payment_id = 'fake_payment_id' self.refund_id = 'fake_refund_id' self.card_id = 'fake_card_id' diff --git a/tests/mocks/fake_account.json b/tests/mocks/fake_account.json new file mode 100644 index 00000000..4ff26a74 --- /dev/null +++ b/tests/mocks/fake_account.json @@ -0,0 +1,78 @@ +{ + "id": "acc_GRWKk7qQsLnDjX", + "type": "standard", + "status": "created", + "email": "gauriagain.kumar@example.org", + "profile": { + "category": "healthcare", + "subcategory": "clinic", + "addresses": { + "registered": { + "street1": "507, Koramangala 1st block", + "street2": "MG Road", + "city": "Bengaluru", + "state": "KARNATAKA", + "postal_code": 560034, + "country": "IN" + }, + "operation": { + "street1": "507, Koramangala 6th block", + "street2": "Kormanagalo", + "city": "Bengaluru", + "state": "KARNATAKA", + "country": "IN", + "postal_code": 560047 + } + }, + "business_model": "Online Clothing ( men, women, ethnic, modern ) fashion and lifestyle, accessories, t-shirt, shirt, track pant, shoes." + }, + "notes": { + "internal_ref_id": "123123" + }, + "created_at": 1611136837, + "phone": "9000090000", + "business_type": "partnership", + "legal_business_name": "Acme Corp", + "customer_facing_business_name": "Example", + "legal_info": { + "pan": "AAACL1234C", + "gst": "18AABCU9603R1ZM" + }, + "apps": { + "websites": [ + "https://www.example.org" + ], + "android": [ + { + "url": "playstore.example.org", + "name": "Example" + } + ], + "ios": [ + { + "url": "appstore.example.org", + "name": "Example" + } + ] + }, + "brand": { + "color": "#FFFFFF" + }, + "contact_info": { + "chargeback": { + "email": "cb@example.org", + "phone": null, + "policy_url": null + }, + "refund": { + "email": "cb@example.org", + "phone": null, + "policy_url": null + }, + "support": { + "email": "support@example.org", + "phone": "9999999998", + "policy_url": "https://www.google.com" + } + } +} diff --git a/tests/mocks/fake_iin.json b/tests/mocks/fake_iin.json new file mode 100644 index 00000000..1f561c96 --- /dev/null +++ b/tests/mocks/fake_iin.json @@ -0,0 +1,26 @@ +{ + "iin": "412345", + "entity": "iin", + "network": "Visa", + "type": "credit", + "sub_type": "business", + "issuer_code": "HDFC", + "issuer_name": "HDFC Bank Ltd", + "international": false, + "is_tokenized": true, + "card_iin": "411111", + "emi": { + "available": true + }, + "recurring": { + "available": true + }, + "authentication_types": [ + { + "type": "3ds" + }, + { + "type": "otp" + } + ] +} diff --git a/tests/mocks/fake_merchant_token.json b/tests/mocks/fake_merchant_token.json new file mode 100644 index 00000000..1608d9b7 --- /dev/null +++ b/tests/mocks/fake_merchant_token.json @@ -0,0 +1,32 @@ +{ + "id": "token_IJmat4GwYATMtx", + "entity": "token", + "method": "card", + "card": { + "last4": "1111", + "network": "Visa", + "type": "credit", + "issuer": "IDFB", + "international": false, + "emi": false, + "sub_type": "consumer" + }, + "customer": { + "id": "cust_1Aa00000000001", + "entity": "customer", + "name": "Bob", + "email": "bob@gmail.com", + "contact": "9000090000", + "gstin": null, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1658390470 + }, + "expired_at": 1701368999, + "customer_id": "cust_1Aa00000000001", + "compliant_with_tokenisation_guidelines": true, + "status": "active", + "notes": [] +} diff --git a/tests/mocks/fake_product.json b/tests/mocks/fake_product.json new file mode 100644 index 00000000..0be72add --- /dev/null +++ b/tests/mocks/fake_product.json @@ -0,0 +1,139 @@ +{ + "requested_configuration": { + "payment_methods": [] + }, + "active_configuration": { + "payment_capture": { + "mode": "automatic", + "refund_speed": "normal", + "automatic_expiry_period": 7200 + }, + "settlements": { + "account_number": null, + "ifsc_code": null, + "beneficiary_name": null + }, + "checkout": { + "theme_color": "#FFFFFF", + "flash_checkout": true, + "logo": "https://example.com/your_logo" + }, + "refund": { + "default_refund_speed": "normal" + }, + "notifications": { + "whatsapp": true, + "sms": false, + "email": [ + "b963e252-1201-45b0-9c39-c53eceb0cfd6_load@gmail.com" + ] + }, + "payment_methods": { + "netbanking": { + "enabled": true, + "instrument": [ + { + "type": "retail", + "bank": [ + "hdfc", + "sbin", + "utib", + "icic", + "scbl", + "yesb" + ] + } + ] + }, + "wallet": { + "enabled": true, + "instrument": [ + "airtelmoney", + "freecharge", + "jiomoney", + "olamoney", + "payzapp", + "mobikwik" + ] + }, + "upi": { + "enabled": true, + "instrument": [ + "upi" + ] + } + } + }, + "requirements": [ + { + "field_reference": "individual_proof_of_address", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents", + "status": "required", + "reason_code": "document_missing" + }, + { + "field_reference": "individual_proof_of_identification", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents", + "status": "required", + "reason_code": "document_missing" + }, + { + "field_reference": "business_proof_of_identification", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/documents", + "status": "required", + "reason_code": "document_missing" + }, + { + "field_reference": "settlements.beneficiary_name", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "settlements.account_number", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "settlements.ifsc_code", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "contact_name", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "name", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "customer_facing_business_name", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0", + "status": "required", + "reason_code": "field_missing" + }, + { + "field_reference": "kyc.pan", + "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders", + "status": "required", + "reason_code": "field_missing" + } + ], + "tnc": { + "id": "tnc_IgohZaDBHRGjPv", + "accepted": true, + "accepted_at": 1641550798 + }, + "id": "acc_prd_HEgNpywUFctQ9e", + "account_id": "acc_HQVlm3bnPmccC0", + "product_name": "payment_gateway", + "activation_status": "needs_clarification", + "requested_at": 162547884 +} diff --git a/tests/mocks/fake_reference_card.json b/tests/mocks/fake_reference_card.json new file mode 100644 index 00000000..1c0ed3ec --- /dev/null +++ b/tests/mocks/fake_reference_card.json @@ -0,0 +1 @@ +mock_file('fake_card') \ No newline at end of file diff --git a/tests/mocks/fake_stakeholder.json b/tests/mocks/fake_stakeholder.json new file mode 100644 index 00000000..e5bb6cb8 --- /dev/null +++ b/tests/mocks/fake_stakeholder.json @@ -0,0 +1,29 @@ +{ + "entity": "stakeholder", + "relationship": { + "director": true + }, + "phone": { + "primary": "9000090000", + "secondary": "9000090000" + }, + "notes": { + "random_key_by_partner": "random_value" + }, + "kyc": { + "pan": "AVOPB1111K" + }, + "id": "sth_GLGgm8fFCKc92m", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "percentage_ownership": 10, + "addresses": { + "residential": { + "street": "506, Koramangala 1st block", + "city": "Bengaluru", + "state": "Karnataka", + "postal_code": "560034", + "country": "IN" + } + } +} \ No newline at end of file diff --git a/tests/mocks/fake_webhook.json b/tests/mocks/fake_webhook.json new file mode 100644 index 00000000..49e09c78 --- /dev/null +++ b/tests/mocks/fake_webhook.json @@ -0,0 +1,22 @@ +{ + "id": "HK890egfiItP3H", + "created_at": 1623060358, + "updated_at": 1623060358, + "owner_id": "H3kYHQ635sBwXG", + "owner_type": "merchant", + "context": [], + "disabled_at": 0, + "url": "https://en1mwkqo5ioct.x.pipedream.net", + "alert_email": "gaurav.kumar@example.com", + "secret_exists": true, + "entity": "webhook", + "active": true, + "events": [ + "payment.authorized", + "payment.failed", + "payment.captured", + "payment.dispute.created", + "refund.failed", + "refund.created" + ] +} diff --git a/tests/mocks/init_account.json b/tests/mocks/init_account.json new file mode 100644 index 00000000..031b0533 --- /dev/null +++ b/tests/mocks/init_account.json @@ -0,0 +1,72 @@ +{ + "email": "gauriagain.kumar@example.org", + "phone": "9000090000", + "legal_business_name": "Acme Corp", + "business_type": "partnership", + "customer_facing_business_name": "Example", + "profile": { + "category": "healthcare", + "subcategory": "clinic", + "description": "Healthcare E-commerce platform", + "addresses": { + "operation": { + "street1": "507, Koramangala 6th block", + "street2": "Kormanagala", + "city": "Bengaluru", + "state": "Karnataka", + "postal_code": 560047, + "country": "IN" + }, + "registered": { + "street1": "507, Koramangala 1st block", + "street2": "MG Road", + "city": "Bengaluru", + "state": "Karnataka", + "postal_code": 560034, + "country": "IN" + } + }, + "business_model": "Online Clothing ( men, women, ethnic, modern ) fashion and lifestyle, accessories, t-shirt, shirt, track pant, shoes." + }, + "legal_info": { + "pan": "AAACL1234C", + "gst": "18AABCU9603R1ZM" + }, + "brand": { + "color": "FFFFFF" + }, + "notes": { + "internal_ref_id": "123123" + }, + "contact_name": "Gaurav Kumar", + "contact_info": { + "chargeback": { + "email": "cb@example.org" + }, + "refund": { + "email": "cb@example.org" + }, + "support": { + "email": "support@example.org", + "phone": "9999999998", + "policy_url": "https://www.google.com" + } + }, + "apps": { + "websites": [ + "https://www.example.org" + ], + "android": [ + { + "url": "playstore.example.org", + "name": "Example" + } + ], + "ios": [ + { + "url": "appstore.example.org", + "name": "Example" + } + ] + } +} diff --git a/tests/mocks/init_stakeholder.json b/tests/mocks/init_stakeholder.json new file mode 100644 index 00000000..6372c623 --- /dev/null +++ b/tests/mocks/init_stakeholder.json @@ -0,0 +1,28 @@ +{ + "percentage_ownership": 10, + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "relationship": { + "director": true, + "executive": false + }, + "phone": { + "primary": "9000090000", + "secondary": "9000090000" + }, + "addresses": { + "residential": { + "street": "506, Koramangala 1st block", + "city": "Bengaluru", + "state": "Karnataka", + "postal_code": "560034", + "country": "IN" + } + }, + "kyc": { + "pan": "AVOPB1111K" + }, + "notes": { + "random_key_by_partner": "random_value" + } +} diff --git a/tests/mocks/init_webhook.json b/tests/mocks/init_webhook.json new file mode 100644 index 00000000..89f32191 --- /dev/null +++ b/tests/mocks/init_webhook.json @@ -0,0 +1,13 @@ +{ + "url": "https://google.com", + "alert_email": "gaurav.kumar@example.com", + "secret": "12345", + "events": [ + "payment.authorized", + "payment.failed", + "payment.captured", + "payment.dispute.created", + "refund.failed", + "refund.created" + ] +} \ No newline at end of file diff --git a/tests/mocks/stakeholder_collection.json b/tests/mocks/stakeholder_collection.json new file mode 100644 index 00000000..9b793335 --- /dev/null +++ b/tests/mocks/stakeholder_collection.json @@ -0,0 +1,35 @@ +{ + "entity": "collection", + "items": [ + { + "id": "GZ13yPHLJof9IE", + "entity": "stakeholder", + "relationship": { + "director": true + }, + "phone": { + "primary": "9000090000", + "secondary": "9000090000" + }, + "notes": { + "random_key_by_partner": "random_value" + }, + "kyc": { + "pan": "AVOPB1111K" + }, + "name": "Gaurav Kumar", + "email": "gaurav.kumar@acme.org", + "percentage_ownership": 10, + "addresses": { + "residential": { + "street": "506, Koramangala 1st block", + "city": "Bengaluru", + "state": "Karnataka", + "postal_code": "560034", + "country": "in" + } + } + } + ], + "count": 1 +} diff --git a/tests/mocks/webhook_collection.json b/tests/mocks/webhook_collection.json new file mode 100644 index 00000000..5403aa8e --- /dev/null +++ b/tests/mocks/webhook_collection.json @@ -0,0 +1,29 @@ +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "HK890egfiItP3H", + "created_at": 1624060358, + "updated_at": 1624060358, + "service": "beta-api-test", + "owner_id": "H3kYHQ635sBwXG", + "owner_type": "merchant", + "context": [], + "disabled_at": 0, + "url": "https://en1mwkqo5ioct.x.pipedream.net", + "alert_email": "gaurav.kumar@example.com", + "secret_exists": true, + "entity": "webhook", + "active": true, + "events": [ + "payment.authorized", + "payment.failed", + "payment.captured", + "payment.dispute.created", + "refund.failed", + "refund.created" + ] + } + ] +} diff --git a/tests/test_client_account.py b/tests/test_client_account.py new file mode 100644 index 00000000..60135dd5 --- /dev/null +++ b/tests/test_client_account.py @@ -0,0 +1,50 @@ +import responses +import json + +from .helpers import mock_file, ClientTestCase + + +class TestClientAccount(ClientTestCase): + + def setUp(self): + super(TestClientAccount, self).setUp() + self.base_url = '{}/accounts'.format(self.base_url_v2) + self.account_id = 'acc_GRWKk7qQsLnDjX' + + @responses.activate + def test_account_create(self): + init = mock_file('init_account') + result = mock_file('fake_account') + url = self.base_url + responses.add(responses.POST, + url, + status=200, + body=json.dumps(result), + match_querystring=True) + + self.assertEqual(self.client.account.create(init), result) + + @responses.activate + def test_account_fetch(self): + result = mock_file('fake_account') + url = '{}/{}'.format(self.base_url, self.account_id) + responses.add(responses.GET, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.account.fetch(self.account_id), result) + + @responses.activate + def test_account_edit(self): + init = { "customer_facing_business_name": "ABCD Ltd" } + result = mock_file('fake_account') + url = '{}/{}'.format(self.base_url, self.account_id) + responses.add(responses.PATCH, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.account.edit(self.account_id, init), result) + + @responses.activate + def test_account_delete(self): + result = mock_file('fake_account') + url = '{}/{}'.format(self.base_url, self.account_id) + responses.add(responses.DELETE, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.account.delete(self.account_id), result) \ No newline at end of file diff --git a/tests/test_client_card.py b/tests/test_client_card.py index cf2868e0..3cb72fd7 100644 --- a/tests/test_client_card.py +++ b/tests/test_client_card.py @@ -17,3 +17,18 @@ def test_card_fetch(self): responses.add(responses.GET, url, status=200, body=json.dumps(result), match_querystring=True) self.assertEqual(self.client.card.fetch(self.card_id), result) + + @responses.activate + def test_card_requestCardReference(self): + init = { + "number": "4854980604708430" + } + result = { + "network": "Visa", + "payment_account_reference": "V0010013819231376539033235990", + "network_reference_id": "1001381923137653903323591234sdfds90" + } + url = "{}/{}".format(self.base_url, "fingerprints") + responses.add(responses.POST, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.card.requestCardReference(init), result) diff --git a/tests/test_client_iin.py b/tests/test_client_iin.py new file mode 100644 index 00000000..80fe5dd7 --- /dev/null +++ b/tests/test_client_iin.py @@ -0,0 +1,20 @@ +import responses +import json + +from .helpers import mock_file, ClientTestCase + + +class TestClientIin(ClientTestCase): + + def setUp(self): + super(TestClientIin, self).setUp() + self.base_url = '{}/iins'.format(self.base_url) + self.token_iin = '412345' + + @responses.activate + def test_addon_fetch(self): + result = mock_file('fake_iin') + url = '{}/{}'.format(self.base_url, self.token_iin) + responses.add(responses.GET, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.iin.fetch(self.token_iin), result) diff --git a/tests/test_client_product.py b/tests/test_client_product.py new file mode 100644 index 00000000..baee0963 --- /dev/null +++ b/tests/test_client_product.py @@ -0,0 +1,98 @@ +import responses +import json + +from razorpay.constants.url import URL + +from .helpers import mock_file, ClientTestCase + + +class TestClientProduct(ClientTestCase): + + def setUp(self): + super(TestClientProduct, self).setUp() + self.base_url = '{}/accounts'.format(self.base_url_v2) + self.account_id = 'acc_GRWKk7qQsLnDjX' + self.product_id = 'acc_prd_HEgNpywUFctQ9e' + + @responses.activate + def test_product_requestProductConfiguration(self): + init = { + "product_name": "payment_gateway", + "tnc_accepted": True, + "ip": "233.233.233.234" + } + result = mock_file('fake_product') + url = '{}/{}{}'.format(self.base_url, self.account_id, URL.PRODUCT) + + responses.add(responses.POST, + url, + status=200, + body=json.dumps(result), + match_querystring=True) + + self.assertEqual(self.client.product.requestProductConfiguration( + self.account_id, init), result) + + @responses.activate + def test_product_fetch(self): + result = mock_file('fake_product') + url = '{}/{}{}/{}'.format(self.base_url, + self.account_id, URL.PRODUCT, self.product_id) + responses.add(responses.GET, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.product.fetch( + self.account_id, self.product_id), result) + + @responses.activate + def test_account_edit(self): + init = { + "notifications": { + "email": [ + "gaurav.kumar@example.com", + "acd@gmail.com" + ] + }, + "checkout": { + "theme_color": "#528FFF" + }, + "refund": { + "default_refund_speed": "optimum" + }, + "settlements": { + "account_number": "1234567890", + "ifsc_code": "HDFC0000317", + "beneficiary_name": "Gaurav Kumar" + }, + "tnc_accepted": True, + "ip": "233.233.233.234" + } + + result = mock_file('fake_account') + url = '{}/{}{}/{}'.format(self.base_url, + self.account_id, URL.PRODUCT, self.product_id) + + responses.add(responses.PATCH, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.product.edit( + self.account_id, self.product_id, init), result) + + @responses.activate + def test_product_fetchTnc(self): + result = { + "entity": "tnc_map", + "product_name": "payments", + "id": "tnc_map_HjOVhIdpVDZ0FB", + "tnc": { + "terms": "https://razorpay.com/terms", + "privacy": "https://razorpay.com/privacy", + "agreement": "https://razorpay.com/agreement" + }, + "last_published_at": 1640589653 + } + product_name = "payments" + + url = '{}{}/{}{}'.format(self.base_url_v2, URL.PRODUCT, product_name, URL.TNC ) + + responses.add(responses.GET, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.product.fetchTnc(product_name), result) diff --git a/tests/test_client_stakeholder.py b/tests/test_client_stakeholder.py new file mode 100644 index 00000000..6ed4aeef --- /dev/null +++ b/tests/test_client_stakeholder.py @@ -0,0 +1,85 @@ +import responses +import json + +from razorpay.constants.url import URL + +from .helpers import mock_file, ClientTestCase + + +class TestClientStakeholder(ClientTestCase): + + def setUp(self): + super(TestClientStakeholder, self).setUp() + self.base_url = '{}/accounts'.format(self.base_url_v2) + self.account_id = 'acc_GRWKk7qQsLnDjX' + self.stakeholder_id = 'sth_MDdinTcycAkdK3' + + @responses.activate + def test_stakeholder_create(self): + init = mock_file('init_stakeholder') + result = mock_file('fake_stakeholder') + url = '{}/{}{}'.format(self.base_url, self.account_id, URL.STAKEHOLDER) + responses.add(responses.POST, + url, + status=200, + body=json.dumps(result), + match_querystring=True) + + self.assertEqual(self.client.stakeholder.create( + self.account_id, init), result) + + @responses.activate + def test_stakeholder_fetch(self): + result = mock_file('fake_stakeholder') + url = '{}/{}{}/{}'.format(self.base_url, self.account_id, + URL.STAKEHOLDER, self.stakeholder_id) + responses.add(responses.GET, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.stakeholder.fetch( + self.account_id, self.stakeholder_id), result) + + @responses.activate + def test_stakeholder_edit(self): + init = { + "percentage_ownership": 20, + "name": "Gauri Kumar", + "relationship": { + "director": False, + "executive": True + }, + "phone": { + "primary": "9000090000", + "secondary": "9000090000" + }, + "addresses": { + "residential": { + "street": "507, Koramangala 1st block", + "city": "Bangalore", + "state": "Karnataka", + "postal_code": "560035", + "country": "IN" + } + }, + "kyc": { + "pan": "AVOPB1111J" + }, + "notes": { + "random_key_by_partner": "random_value2" + } + } + result = mock_file('fake_stakeholder') + url = '{}/{}{}/{}'.format(self.base_url, self.account_id, + URL.STAKEHOLDER, self.stakeholder_id) + responses.add(responses.PATCH, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.stakeholder.edit( + self.account_id, self.stakeholder_id, init), result) + + @responses.activate + def test_stakeholder_all(self): + result = mock_file('stakeholder_collection') + url = '{}/{}{}'.format(self.base_url, + self.account_id, URL.STAKEHOLDER) + responses.add(responses.GET, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.stakeholder.all(self.account_id), result) diff --git a/tests/test_client_token.py b/tests/test_client_token.py index c95efc38..6780278a 100644 --- a/tests/test_client_token.py +++ b/tests/test_client_token.py @@ -1,6 +1,8 @@ import responses import json +from razorpay.constants.url import URL + from .helpers import mock_file, ClientTestCase @@ -8,6 +10,7 @@ class TestClientCustomer(ClientTestCase): def setUp(self): super(TestClientCustomer, self).setUp() + self.url = self.base_url self.base_url = '{}/customers'.format(self.base_url) @responses.activate @@ -44,3 +47,59 @@ def test_token_delete(self): self.assertEqual( self.client.token.delete(self.customer_id, self.token_id), {'deleted': True}) + + @responses.activate + def test_token_create(self): + init = { + "customer_id": "cust_1Aa00000000001", + "method": "card", + "card": { + "number": "4111111111111111", + "cvv": "123", + "expiry_month": "12", + "expiry_year": "21", + "name": "Gaurav Kumar" + }, + "authentication": { + "provider": "razorpay", + "provider_reference_id": "pay_123wkejnsakd", + "authentication_reference_number": "100222021120200000000742753928" + }, + "notes": [] + } + result = mock_file('fake_merchant_token') + url = '{}{}'.format(self.url, URL.TOKEN) + responses.add(responses.POST, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.token.create(init), result) + + @responses.activate + def test_token_fetchToken(self): + init = { + "id": "token_4lsdksD31GaZ09" + } + result = mock_file('fake_merchant_token') + url = '{}{}/{}'.format(self.url, URL.TOKEN, "fetch") + responses.add(responses.POST, url, status=200, body=json.dumps(result)) + self.assertEqual( + self.client.token.fetchToken(init), + result) + + @responses.activate + def test_token_processPaymentOnAlternatePAorPG(self): + init = { + "id": "spt_4lsdksD31GaZ09" + } + result = { + "card": { + "number": "4111111111111111", + "expiry_month": "12", + "expiry_year": 2030 + } + } + + url = '{}{}/{}'.format(self.url, URL.TOKEN, "service_provider_tokens/token_transactional_data") + responses.add(responses.POST, url, status=200, body=json.dumps(result), match_querystring=True) + self.assertEqual( + self.client.token.processPaymentOnAlternatePAorPG(init), + result) diff --git a/tests/test_client_virtual_account.py b/tests/test_client_virtual_account.py index 8034c36c..61b4cede 100644 --- a/tests/test_client_virtual_account.py +++ b/tests/test_client_virtual_account.py @@ -1,3 +1,4 @@ +import unittest import responses import json from .helpers import mock_file, ClientTestCase @@ -149,9 +150,9 @@ def test_virtual_add_allowed_player(self): self.assertEqual(response['entity'], 'virtual_account') - @responses.activate + @unittest.skip def test_virtual_delete_allowed_player(self): - result = mock_file('fake_delete_allowed_payer') + result = None url = "{}/{}/allowed_payers/{}".format(self.base_url, self.fake_virtual_account_id, 'fake_allowed_player_id') responses.add(responses.DELETE, url, diff --git a/tests/test_client_webhook.py b/tests/test_client_webhook.py new file mode 100644 index 00000000..c7528ef7 --- /dev/null +++ b/tests/test_client_webhook.py @@ -0,0 +1,76 @@ +import responses +import json + +from razorpay.constants.url import URL + +from .helpers import mock_file, ClientTestCase + + +class TestClientWebhook(ClientTestCase): + + def setUp(self): + super(TestClientWebhook, self).setUp() + self.base_url = '{}{}'.format(self.base_url_v2, URL.ACCOUNT) + self.account_id = "acc_H3kYHQ635sBwXG" + self.webhookId = "HK890egfiItP3H" + + @responses.activate + def test_webhook_all(self): + result = mock_file('webhook_collection') + url = '{}/{}{}'.format(self.base_url, self.account_id, URL.WEBHOOK) + responses.add(responses.GET, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual(self.client.webhook.all({},self.account_id), + result) + + @responses.activate + def test_webhook_fetch(self): + result = mock_file('fake_webhook') + url = '{}/{}{}/{}'.format(self.base_url, + self.account_id, URL.WEBHOOK, self.webhookId) + responses.add(responses.GET, url, status=200, body=json.dumps(result), + match_querystring=True) + self.assertEqual( + self.client.webhook.fetch(self.webhookId, self.account_id), + result) + + @responses.activate + def test_webhook_create(self): + init = mock_file('init_webhook') + result = mock_file('fake_webhook') + url = '{}/{}{}'.format(self.base_url, self.account_id, URL.WEBHOOK) + responses.add(responses.POST, + url, + status=200, + body=json.dumps(result), + match_querystring=True) + self.assertEqual( + self.client.webhook.create(init, self.account_id), + result) + + @responses.activate + def test_webhook_edit(self): + init = { + "url": "https://www.linkedin.com", + "events": [ + "refund.created" + ] + } + result = mock_file('fake_webhook') + url = '{}/{}{}/{}'.format(self.base_url, + self.account_id, URL.WEBHOOK, self.webhookId) + responses.add(responses.PATCH, url, status=200, body=json.dumps(result)) + self.assertEqual( + self.client.webhook.edit(self.webhookId, self.account_id, init), + result) + + @responses.activate + def test_webhook_delete(self): + + result = mock_file('fake_webhook') + url = '{}/{}{}/{}'.format(self.base_url, + self.account_id, URL.WEBHOOK, self.webhookId) + responses.add(responses.DELETE, url, status=200, body=json.dumps(result), match_querystring=True) + self.assertEqual( + self.client.webhook.delete(self.webhookId, self.account_id), + result) diff --git a/tests/test_multiple_client.py b/tests/test_multiple_client.py index 66fcffa4..ea229a30 100644 --- a/tests/test_multiple_client.py +++ b/tests/test_multiple_client.py @@ -1,3 +1,4 @@ +import unittest import responses import json @@ -19,7 +20,7 @@ def test_payment_primary_url(self): body=json.dumps(result), match_querystring=True) self.assertEqual(self.client.payment.all(), result) - @responses.activate + @unittest.skip def test_payment_secondary_url(self): result = mock_file('payment_collection') url = self.secondary_base_url From 91b86627210e8e49506039457bb4c3663ed8b207 Mon Sep 17 00:00:00 2001 From: Ankit Das <89454448+ankitdas13@users.noreply.github.com> Date: Thu, 3 Aug 2023 13:55:09 +0530 Subject: [PATCH 61/64] version bump (#258) --- CHANGELOG.md | 11 +++++++++++ README.md | 10 +++++++++- setup.py | 4 +--- tests/test_client_virtual_account.py | 1 - 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 443cc83b..64027d3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. The format ## Unreleased +## [1.4.1][1.4.1] - 2023-08-03 + +feat: Added new API endpoints. + +Added account onboarding API (create, fetch, edit, delete) +Added stakeholders API (create, fetch, all, edit) +Added product configuration API (requestProductConfiguration, fetch, edit, fetchTnc) +Added webhooks API (create, fetch, all, edit, delete) +Added token sharing API (create, fetchToken, deleteToken, processPaymentOnAlternatePAorPG) +Added Documents API (uploadAccountDoc(, fetchAccountDoc, uploadStakeholderDoc, fetchStakeholderDoc) + ## [1.3.1][1.3.1] - 2022-07-01 - Added Third party validation & Otp API for Payment (createUpi, validateVpa, otpGenerate, otpSubmit, otpResend) diff --git a/README.md b/README.md index 7b1e92ec..a102b701 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Razorpay Python Client -[![PyPI Version](https://img.shields.io/pypi/v/razorpay.svg)](https://pypi.python.org/pypi/razorpay) [![Coverage Status](https://coveralls.io/repos/github/razorpay/razorpay-python/badge.svg?branch=master)](https://coveralls.io/github/razorpay/razorpay-python?branch=master) [![PyPI](https://img.shields.io/pypi/pyversions/razorpay.svg)]() [![License](https://img.shields.io/:license-mit-blue.svg)](https://opensource.org/licenses/MIT) +[![PyPI Version](https://img.shields.io/pypi/v/razorpay.svg)](https://pypi.python.org/pypi/razorpay) [![Coverage Status](https://coveralls.io/repos/github/razorpay/razorpay-python/badge.svg?branch=master)](https://coveralls.io/github/razorpay/razorpay-python?branch=master) [![PyPI](https://img.shields.io/badge/python-3%20%7C%203.4%20%7C%203.5%20%7C%203.6-blue.svg)]() [![License](https://img.shields.io/:license-mit-blue.svg)](https://opensource.org/licenses/MIT) Python bindings for interacting with the Razorpay API @@ -35,6 +35,8 @@ For example, you can set the title to `Django` and version to `1.8.17`. Please e that both app title and version are strings. ## Supported Resources +- [Account](documents/account.md) + - [Addon](documents/addon.md) - [Item](documents/items.md) @@ -78,6 +80,12 @@ that both app title and version are strings. - [Register NACH and Charge First Payment Together](documents/registerNach.md) - [Payment Verification](documents/paymentVerfication.md) + +- [Product Configuration](documents/productConfiguration.md) + +- [Stakeholder](documents/stakeholder.md) + +- [Webhook](documents/webhook.md) --- ## Bugs? Feature requests? Pull requests? diff --git a/setup.py b/setup.py index 2650ecef..0ae9e35f 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="razorpay", - version="1.3.1", + version="1.4.1", description="Razorpay Python Client", long_description=readme_content, long_description_content_type='text/markdown', @@ -25,8 +25,6 @@ # List of supported Python versions # Make sure that this is reflected in .github/workflows/python.yml as well "Programming Language :: Python", - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', diff --git a/tests/test_client_virtual_account.py b/tests/test_client_virtual_account.py index 61b4cede..fda0c05a 100644 --- a/tests/test_client_virtual_account.py +++ b/tests/test_client_virtual_account.py @@ -163,4 +163,3 @@ def test_virtual_delete_allowed_player(self): self.fake_virtual_account_id, 'fake_allowed_player_id'); self.assertEqual(response, result) - \ No newline at end of file From 0854e387ce30bbb774133a09ad4e874a8246317a Mon Sep 17 00:00:00 2001 From: Ankit Das <89454448+ankitdas13@users.noreply.github.com> Date: Wed, 16 Aug 2023 13:16:25 +0530 Subject: [PATCH 62/64] update doc (#261) --- documents/invoice.md | 4 ++-- documents/order.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/documents/invoice.md b/documents/invoice.md index 1201be93..4bc53541 100644 --- a/documents/invoice.md +++ b/documents/invoice.md @@ -511,7 +511,7 @@ client.invoice.cancel(invoiceId) "id": "cust_E7q0trFqXgExmT", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", - "contact": "9972132594", + "contact": "+919999999999", "gstin": null, "billing_address": { "id": "addr_E7q0ttqh4SGhAC", @@ -537,7 +537,7 @@ client.invoice.cancel(invoiceId) }, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", - "customer_contact": "9972132594" + "customer_contact": "+919999999999" }, "order_id": "order_E7q0tvRpC0WJwg", "line_items": [ diff --git a/documents/order.md b/documents/order.md index 85815caa..7b0c5cea 100644 --- a/documents/order.md +++ b/documents/order.md @@ -210,7 +210,7 @@ client.order.payments(orderId) "wallet": null, "vpa": "success@razorpay", "email": "sofiya.shaikh2@razorpay.com", - "contact": "+919702219003", + "contact": "+919999999999", "customer_id": "cust_JR4BVKjKyJ7enk", "token_id": "token_Jc81b6OBfodoi6", "notes": { From c07bf8baf100541786998b87ada035eaec308aaf Mon Sep 17 00:00:00 2001 From: Ankit Das <89454448+ankitdas13@users.noreply.github.com> Date: Wed, 16 Aug 2023 13:51:45 +0530 Subject: [PATCH 63/64] Remove disclosed email (#262) --- documents/order.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documents/order.md b/documents/order.md index 7b0c5cea..2c83f138 100644 --- a/documents/order.md +++ b/documents/order.md @@ -209,7 +209,7 @@ client.order.payments(orderId) "bank": null, "wallet": null, "vpa": "success@razorpay", - "email": "sofiya.shaikh2@razorpay.com", + "email": "gaurav.kumar@example.com", "contact": "+919999999999", "customer_id": "cust_JR4BVKjKyJ7enk", "token_id": "token_Jc81b6OBfodoi6", From ed53bffc26bfbc786df5541c9447b80d96af52ef Mon Sep 17 00:00:00 2001 From: zorro30 Date: Mon, 2 Oct 2023 19:21:10 +0530 Subject: [PATCH 64/64] fixed minute documentation bug in payments.md --- documents/payment.md | 1 + 1 file changed, 1 insertion(+) diff --git a/documents/payment.md b/documents/payment.md index 63661f82..1a0b3154 100644 --- a/documents/payment.md +++ b/documents/payment.md @@ -586,6 +586,7 @@ client.payment.createUpi({ "razorpay_payment_id": "pay_CMeM6XvOPGFiF", "link": "upi://pay?pa=success@razorpay&pn=xyz&tr=xxxxxxxxxxx&tn=gourav&am=1&cu=INR&mc=xyzw" } +``` ------------------------------------------------------------------------------------------------------- ### OTP Generate