From 0f90a4852e620c3508a9c7ebaabc54416d9cb5b5 Mon Sep 17 00:00:00 2001
From: Ankit Das <89454448+ankitdas13@users.noreply.github.com>
Date: Mon, 18 Dec 2023 09:13:49 +0530
Subject: [PATCH] feat: Added new API endpoints (#366)
---
.github/workflows/security.yml | 18 +-
documents/Iin.md | 104 +++++++++
documents/account.md | 60 +++++
documents/customer.md | 239 ++++++++++++++++++++
documents/dispute.md | 248 +++++++++++++++++++++
documents/document.md | 71 ++++++
documents/linkedAccount.md | 198 ++++++++++++++++
documents/order.md | 176 +++++++++++++++
documents/payment.md | 211 +++++++++++++++---
documents/settlement.md | 122 ++++++++++
documents/stakeholder.md | 72 +++++-
libs/Requests-2.0.4/src/Transport/Curl.php | 2 +-
src/Account.php | 16 ++
src/Customer.php | 28 +++
src/Dispute.php | 35 +++
src/Document.php | 20 ++
src/Entity.php | 12 +
src/Iin.php | 7 +
src/Order.php | 14 ++
src/Payment.php | 7 +
src/Settlement.php | 11 +-
src/Stakeholder.php | 16 ++
tests/CoverageTest.php | 12 +-
tests/CustomerTest.php | 40 ++++
tests/ExceptionTest.php | 19 --
tests/IinTest.php | 16 ++
tests/PartnerTest.php | 31 +++
27 files changed, 1729 insertions(+), 76 deletions(-)
create mode 100644 documents/Iin.md
create mode 100644 documents/dispute.md
create mode 100644 documents/document.md
create mode 100644 documents/linkedAccount.md
create mode 100644 src/Dispute.php
create mode 100644 src/Document.php
create mode 100644 tests/IinTest.php
diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml
index 3b1a2fa8..65b89bc7 100644
--- a/.github/workflows/security.yml
+++ b/.github/workflows/security.yml
@@ -7,16 +7,16 @@ on:
- cron: '30 20 * * *'
jobs:
semgrep:
- name: Scan
- runs-on: [ubuntu-latest] # nosemgrep : semgrep.dev/s/swati31196:github_provided_runner
+ name: Semgrep
+ runs-on: [ubuntu-latest]
+ container:
+ image: returntocorp/semgrep
steps:
- - uses: actions/checkout@v2
- - uses: returntocorp/semgrep-action@v1
- with:
- publishToken: ${{ secrets.SEMGREP_APP_TOKEN }}
- publishDeployment: 339
+ - uses: actions/checkout@v4.0.0
+ - name: Run semgrep
+ run: semgrep ci
env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
workflow_status:
runs-on: [ ubuntu-latest ] # nosemgrep : semgrep.dev/s/swati31196:github_provided_runner
@@ -48,4 +48,4 @@ jobs:
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
\ No newline at end of file
+ exit 0
diff --git a/documents/Iin.md b/documents/Iin.md
new file mode 100644
index 00000000..bedb86b2
--- /dev/null
+++ b/documents/Iin.md
@@ -0,0 +1,104 @@
+### Iin
+
+### Token IIN API
+
+```php
+$tokenIin = "412345";
+$api->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"
+ }
+ ]
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+### Fetch All IINs Supporting Native OTP
+
+```php
+$api->iin->all(array("flow" => "otp"));
+```
+
+**Response:**
+```json
+{
+ "count": 24,
+ "iins": [
+ "512967",
+ "180005",
+ "401704",
+ "401806",
+ "123456",
+ "411111",
+ "123512967",
+ "180012305",
+ "401123704"
+ ]
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+### Fetch All IINs with Business Sub-type
+
+```php
+$api->iin->all(array("sub_type" => "business"));
+```
+
+**Response:**
+```json
+{
+ "count": 24,
+ "iins": [
+ "512967",
+ "180005",
+ "401704",
+ "401806",
+ "607389",
+ "652203",
+ "414367",
+ "787878",
+ "123456",
+ "411111",
+ "123512967",
+ "180012305",
+ "401123704"
+ ]
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+**PN: * indicates mandatory fields**
+
+
+**For reference click [here](https://razorpay.com/docs/api/payments/cards/iin-api/#iin-entity)**
\ No newline at end of file
diff --git a/documents/account.md b/documents/account.md
index 0696c5cf..38b71904 100644
--- a/documents/account.md
+++ b/documents/account.md
@@ -381,6 +381,66 @@ $api->account->fetch($accountId);
-------------------------------------------------------------------------------------------------------
+### Upload account documents
+```php
+
+$accountId = "acc_M83Uw27KXuC7c8";
+
+$payload = [
+ 'file'=> '/Users/your_name/Downloads/sample_uploaded.pdf'
+ "document_type" => "business_proof_url"
+];
+
+$api->account->fetch($accoundId)->uploadAccountDoc($payload);
+```
+
+**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
+```php
+$accountId = "acc_M83Uw27KXuC7c8";
+
+$api->account->fetch($accoundId)->fetchAccountDoc();
+```
+
+**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**
diff --git a/documents/customer.md b/documents/customer.md
index c4ec79bb..f5e83881 100644
--- a/documents/customer.md
+++ b/documents/customer.md
@@ -131,6 +131,245 @@ $api->customer->fetch($customerId);
-------------------------------------------------------------------------------------------------------
+### Add Bank Account of Customer
+
+```php
+$customerId = "cust_N5mywh91sXB69O"
+
+$api->customer->fetch($customerId)->addBankAccount([
+ "ifsc_code" => "UTIB0000194",
+ "account_number" => "919999999999",
+ "beneficiary_name" => "Pratheek",
+ "beneficiary_address1" => "address 1",
+ "beneficiary_address2" => "address 2",
+ "beneficiary_address3" => "address 3",
+ "beneficiary_address4" => "address 4",
+ "beneficiary_email" => "random@email.com",
+ "beneficiary_mobile" => "8762489310",
+ "beneficiary_city" => "Bangalore",
+ "beneficiary_state" => "KA",
+ "beneficiary_country" => "IN",
+]);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|---------------|-------------|---------------------------------------------|
+| customerId* | string | Customer's bank account number |
+| account_number | integer | The id of the customer to be fetched |
+| account_number | string | The name of the beneficiary associated with the bank account. |
+| beneficiary_name | string | The virtual payment address. |
+| beneficiary_address1 | string | The id of the customer to be fetched |
+| beneficiary_email | string | Email address of the beneficiary. |
+| beneficiary_mobile | integer | Mobile number of the beneficiary. |
+| beneficiary_city | string | The name of the city of the beneficiary. |
+| beneficiary_state | string | The state of the beneficiary. |
+| beneficiary_pin | interger | The pin code of the beneficiary's address. |
+| ifsc_code | string | The IFSC code of the bank branch associated with the account. |
+
+**Response:**
+```json
+{
+ "id" : "cust_1Aa00000000001",
+ "entity": "customer",
+ "name" : "Saurav Kumar",
+ "email" : "Saurav.kumar@example.com",
+ "contact" : "+919000000000",
+ "gstin":"29XAbbA4369J1PA",
+ "notes" : [],
+ "created_at ": 1234567890
+}
+```
+
+-------------------------------------------------------------------------------------------------------
+
+### Delete Bank Account of Customer
+
+```php
+$customerId = "cust_N5mywh91sXB69O"
+
+$bankAccountId = "ba_N6aM8uo64IzxHu"
+
+$api->customer->fetch($customerId)->deleteBankAccount($bankAccountId);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|---------------|-------------|---------------------------------------------|
+| customerId* | string | Customer's bank account number |
+| bank_id | string | The bank_id that needs to be deleted. |
+
+**Response:**
+```json
+{
+ "id": "ba_Evg09Ll05SIPSD",
+ "ifsc": "ICIC0001207",
+ "bank_name": "ICICI Bank",
+ "name": "Test R4zorpay",
+ "account_number": "XXXXXXXXXXXXXXX0434",
+ "status": "deleted"
+}
+```
+
+-------------------------------------------------------------------------------------------------------
+
+### Eligibility Check API
+
+```php
+$api->customer->requestEligibilityCheck(array(
+ "inquiry" => "affordability",
+ "amount" => 500000,
+ "currency" => "INR",
+ "customer" => array(
+ "id" => "cust_MVSyUEwC4qb5sN",
+ "contact" => "+918220276214",
+ "ip" => "105.106.107.108",
+ "referrer" => "https://merchansite.com/example/paybill",
+ "user_agent" => "Mozilla/5.0",
+ )
+));
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|---------------|-------------|---------------------------------------------|
+| customerId* | string | Customer's bank account number |
+| bank_id | string | The bank_id that needs to be deleted. |
+
+**Response:**
+```json
+{
+ "amount": "500000",
+ "customer": {
+ "id": "KkBhM9EC1Y0HTm",
+ "contact": "+918220722114"
+ },
+ "instruments": [
+ {
+ "method": "emi",
+ "issuer": "HDFC",
+ "type": "debit",
+ "eligibility_req_id": "elig_KkCNLzlNeMYQyZ",
+ "eligibility": {
+ "status": "eligible"
+ }
+ },
+ {
+ "method": "paylater",
+ "provider": "getsimpl",
+ "eligibility_req_id": "elig_KkCNLzlNeMYQyZ",
+ "eligibility": {
+ "status": "eligible"
+ }
+ },
+ {
+ "method": "paylater",
+ "provider": "icic",
+ "eligibility_req_id": "elig_KkCNLzlNeMYQyZ",
+ "eligibility": {
+ "status": "eligible"
+ }
+ },
+ {
+ "method": "cardless_emi",
+ "provider": "walnut369",
+ "eligibility_req_id": "elig_KkCNLzlNeMYQyZ",
+ "eligibility": {
+ "status": "ineligible",
+ "error": {
+ "code": "GATEWAY_ERROR",
+ "description": "The customer has not been approved by the partner.",
+ "source": "business",
+ "step": "inquiry",
+ "reason": "user_not_approved"
+ }
+ }
+ },
+ {
+ "method": "cardless_emi",
+ "provider": "zestmoney",
+ "eligibility_req_id": "elig_KkCNLzlNeMYQyZ",
+ "eligibility": {
+ "status": "ineligible",
+ "error": {
+ "code": "GATEWAY_ERROR",
+ "description": "The customer has exhausted their credit limit.",
+ "source": "business",
+ "step": "inquiry",
+ "reason": "credit_limit_exhausted"
+ }
+ }
+ },
+ {
+ "method": "paylater",
+ "provider": "lazypay",
+ "eligibility_req_id": "elig_KkCNLzlNeMYQyZ",
+ "eligibility": {
+ "status": "ineligible",
+ "error": {
+ "code": "GATEWAY_ERROR",
+ "description": "The order amount is less than the minimum transaction amount.",
+ "source": "business",
+ "step": "inquiry",
+ "reason": "min_amt_required"
+ }
+ }
+ }
+ ]
+}
+```
+
+-------------------------------------------------------------------------------------------------------
+
+### Fetch Eligibility by id
+
+```php
+$api->customer->fetchEligibility("elig_F1cxDoHWD4fkQt");
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|---------------|-------------|---------------------------------------------|
+| customerId* | string | Customer's bank account number |
+| bank_id | string | The bank_id that needs to be deleted. |
+
+**Response:**
+```json
+{
+ "instruments": [
+ {
+ "method": "paylater",
+ "provider": "lazypay",
+ "eligibility_req_id": "elig_LBwGKVvS2X48Lq",
+ "eligibility": {
+ "status": "eligible"
+ }
+ },
+ {
+ "method": "paylater",
+ "provider": "getsimpl",
+ "eligibility_req_id": "elig_LBwGKVvS2X48Lq",
+ "eligibility": {
+ "status": "ineligible",
+ "error": {
+ "code": "GATEWAY_ERROR",
+ "description": "The customer has exhausted their credit limit",
+ "source": "gateway",
+ "step": "inquiry",
+ "reason": "credit_limit_exhausted"
+ }
+ }
+ }
+ ]
+}
+```
+
+-------------------------------------------------------------------------------------------------------
+
**PN: * indicates mandatory fields**
diff --git a/documents/dispute.md b/documents/dispute.md
new file mode 100644
index 00000000..ee275f43
--- /dev/null
+++ b/documents/dispute.md
@@ -0,0 +1,248 @@
+## Document
+
+### Fetch All Disputes
+
+```php
+$api->dispute->all();
+```
+
+**Response:**
+```json
+{
+ "entity": "collection",
+ "count": 1,
+ "items": [
+ {
+ "id": "disp_Esz7KAitoYM7PJ",
+ "entity": "dispute",
+ "payment_id": "pay_EsyWjHrfzb59eR",
+ "amount": 10000,
+ "currency": "INR",
+ "amount_deducted": 0,
+ "reason_code": "pre_arbitration",
+ "respond_by": 1590604200,
+ "status": "open",
+ "phase": "pre_arbitration",
+ "created_at": 1590059211,
+ "evidence": {
+ "amount": 10000,
+ "summary": null,
+ "shipping_proof": null,
+ "billing_proof": null,
+ "cancellation_proof": null,
+ "customer_communication": null,
+ "proof_of_service": null,
+ "explanation_letter": null,
+ "refund_confirmation": null,
+ "access_activity_log": null,
+ "refund_cancellation_policy": null,
+ "term_and_conditions": null,
+ "others": null,
+ "submitted_at": null
+ }
+ }
+ ]
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+### Fetch a Dispute
+
+```php
+$disputeId = "disp_0000000000000";
+
+$api->dispute->fetch($disputeId);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|-------|-----------|--------------------------------------------------|
+| id* | string | The unique identifier of the dispute. |
+
+**Response:**
+```json
+{
+ "id": "disp_AHfqOvkldwsbqt",
+ "entity": "dispute",
+ "payment_id": "pay_EsyWjHrfzb59eR",
+ "amount": 10000,
+ "currency": "INR",
+ "amount_deducted": 0,
+ "reason_code": "pre_arbitration",
+ "respond_by": 1590604200,
+ "status": "open",
+ "phase": "pre_arbitration",
+ "created_at": 1590059211,
+ "evidence": {
+ "amount": 10000,
+ "summary": "goods delivered",
+ "shipping_proof": null,
+ "billing_proof": null,
+ "cancellation_proof": null,
+ "customer_communication": null,
+ "proof_of_service": null,
+ "explanation_letter": null,
+ "refund_confirmation": null,
+ "access_activity_log": null,
+ "refund_cancellation_policy": null,
+ "term_and_conditions": null,
+ "others": null,
+ "submitted_at": null
+ }
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+### Fetch a Dispute
+
+```php
+$disputeId = "disp_0000000000000";
+
+$api->dispute->fetch($disputeId)->accept();
+```
+
+**Response:**
+```json
+{
+ "id": "disp_AHfqOvkldwsbqt",
+ "entity": "dispute",
+ "payment_id": "pay_EsyWjHrfzb59eR",
+ "amount": 10000,
+ "currency": "INR",
+ "amount_deducted": 10000,
+ "reason_code": "pre_arbitration",
+ "respond_by": 1590604200,
+ "status": "lost",
+ "phase": "pre_arbitration",
+ "created_at": 1590059211,
+ "evidence": {
+ "amount": 10000,
+ "summary": null,
+ "shipping_proof": null,
+ "billing_proof": null,
+ "cancellation_proof": null,
+ "customer_communication": null,
+ "proof_of_service": null,
+ "explanation_letter": null,
+ "refund_confirmation": null,
+ "access_activity_log": null,
+ "refund_cancellation_policy": null,
+ "term_and_conditions": null,
+ "others": null,
+ "submitted_at": null
+ }
+}
+```
+-------------------------------------------------------------------------------------------------------
+### Contest a Dispute
+
+```php
+
+//Use this API sample code for draft
+
+$disputeId = "disp_0000000000000";
+
+$api->dispute->fetch($disputeId)->contest(array("amount" => 5000, "summary" => "goods delivered", "shipping_proof" => array("doc_EFtmUsbwpXwBH9", "doc_EFtmUsbwpXwBH8"), "others" => array(array("type" => "receipt_signed_by_customer", "document_ids" => array("doc_EFtmUsbwpXwBH1", "doc_EFtmUsbwpXwBH7"))), "action" => "draft"));
+
+
+//Use this API sample code for submit
+
+$api->dispute->fetch($disputeId)->contest(array("billing_proof" => array("doc_EFtmUsbwpXwBG9", "doc_EFtmUsbwpXwBG8"), "action" => "submit"));
+```
+
+**Response:**
+```json
+
+// Draft
+{
+ "id": "disp_AHfqOvkldwsbqt",
+ "entity": "dispute",
+ "payment_id": "pay_EsyWjHrfzb59eR",
+ "amount": 10000,
+ "currency": "INR",
+ "amount_deducted": 0,
+ "reason_code": "chargeback",
+ "respond_by": 1590604200,
+ "status": "open",
+ "phase": "chargeback",
+ "created_at": 1590059211,
+ "evidence": {
+ "amount": 5000,
+ "summary": "goods delivered",
+ "shipping_proof": [
+ "doc_EFtmUsbwpXwBH9",
+ "doc_EFtmUsbwpXwBH8"
+ ],
+ "billing_proof": null,
+ "cancellation_proof": null,
+ "customer_communication": null,
+ "proof_of_service": null,
+ "explanation_letter": null,
+ "refund_confirmation": null,
+ "access_activity_log": null,
+ "refund_cancellation_policy": null,
+ "term_and_conditions": null,
+ "others": [
+ {
+ "type": "receipt_signed_by_customer",
+ "document_ids": [
+ "doc_EFtmUsbwpXwBH1",
+ "doc_EFtmUsbwpXwBH7"
+ ]
+ }
+ ],
+ "submitted_at": null
+ }
+}
+
+//Submit
+{
+ "id": "disp_AHfqOvkldwsbqt",
+ "entity": "dispute",
+ "payment_id": "pay_EsyWjHrfzb59eR",
+ "amount": 10000,
+ "currency": "INR",
+ "amount_deducted": 0,
+ "reason_code": "chargeback",
+ "respond_by": 1590604200,
+ "status": "under_review",
+ "phase": "chargeback",
+ "created_at": 1590059211,
+ "evidence": {
+ "amount": 5000,
+ "summary": "goods delivered",
+ "shipping_proof": [
+ "doc_EFtmUsbwpXwBH9",
+ "doc_EFtmUsbwpXwBH8"
+ ],
+ "billing_proof": [
+ "doc_EFtmUsbwpXwBG9",
+ "doc_EFtmUsbwpXwBG8"
+ ],
+ "cancellation_proof": null,
+ "customer_communication": null,
+ "proof_of_service": null,
+ "explanation_letter": null,
+ "refund_confirmation": null,
+ "access_activity_log": null,
+ "refund_cancellation_policy": null,
+ "term_and_conditions": null,
+ "others": [
+ {
+ "type": "receipt_signed_by_customer",
+ "document_ids": [
+ "doc_EFtmUsbwpXwBH1",
+ "doc_EFtmUsbwpXwBH7"
+ ]
+ }
+ ],
+ "submitted_at": 1590603200
+ }
+}
+```
+-------------------------------------------------------------------------------------------------------
+**PN: * indicates mandatory fields**
+
+
+**For reference click [here](https://razorpay.com/docs/api/documents)**
\ No newline at end of file
diff --git a/documents/document.md b/documents/document.md
new file mode 100644
index 00000000..9308c775
--- /dev/null
+++ b/documents/document.md
@@ -0,0 +1,71 @@
+## Document
+
+### Create a Document
+
+```php
+
+$payload = array(
+ 'file'=> '/Users/your_name/Downloads/sample_uploaded.pdf'
+ "purpose" => "dispute_evidence"
+);
+
+$api->document->create($payload);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|-------|-----------|--------------------------------------------------|
+| file* | string | The URL generated once the business proof document is uploaded. |
+| purpose | string | Possible value is `dispute_evidence` |
+
+**Response:**
+```json
+{
+ "id": "doc_EsyWjHrfzb59Re",
+ "entity": "document",
+ "purpose": "dispute_evidence",
+ "name": "doc_19_12_2020.jpg",
+ "mime_type": "image/png",
+ "size": 2863,
+ "created_at": 1590604200
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+### Fetch Document Information
+
+```php
+$documentId = "";
+
+$api->document->fetch($documentId);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|-------|-----------|--------------------------------------------------|
+| from | timestamp | timestamp after which the addons were created |
+| to | timestamp | timestamp before which the addons were created |
+| count | integer | number of addons to fetch (default: 10) |
+| skip | integer | number of addons to be skipped (default: 0) |
+
+**Response:**
+```json
+{
+ "entity": "document",
+ "id": "doc_00000000000000",
+ "purpose": "dispute_evidence",
+ "created_at": 1701701378,
+ "mime_type": "application/pdf",
+ "display_name": "ppm_00000000000000",
+ "size": 404678,
+ "url": ""
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+**PN: * indicates mandatory fields**
+
+
+**For reference click [here](https://razorpay.com/docs/api/documents)**
\ No newline at end of file
diff --git a/documents/linkedAccount.md b/documents/linkedAccount.md
new file mode 100644
index 00000000..6d3f910c
--- /dev/null
+++ b/documents/linkedAccount.md
@@ -0,0 +1,198 @@
+## Linked Account
+
+### Create Linked Accounts for Sub-Merchants and Others
+```php
+
+
+$api->setHeader('X-Razorpay-Account', 'acc_sub-merchantId');
+
+$api->account->create(array(
+ "email" => "gauriagain.kumar@example.org",
+ "phone" => "9999999999",
+ "type" => "route",
+ "reference_id" => "124124",
+ "legal_business_name" => "Acme Corp",
+ "business_type" => "partnership",
+ "contact_name" => "Gaurav Kumar",
+ "profile" => array(
+ "category" => "healthcare",
+ "subcategory" => "clinic",
+ "addresses" => array(
+ "registered" => array(
+ "street1" => "507, Koramangala 1st block",
+ "street2" => "MG Road",
+ "city" => "Bengaluru",
+ "state" => "Karnataka",
+ "postal_code" => 560034,
+ "country" => "IN"
+ )
+ ),
+ ),
+ "legal_info" => array(
+ "pan" => "AAACL1234C",
+ "gst" => "18AABCU9603R1ZM"
+ ),
+));
+
+```
+
+**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/partners/route/linked-accounts/#create-linked-accounts-for-sub-merchants-and-others) are supported |
+| legal_info | object | All keys listed [here](https://razorpay.com/docs/partners/route/linked-accounts/#create-linked-accounts-for-sub-merchants-and-others) are supported |
+| 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":"route",
+ "status":"created",
+ "email":"gaurav.kumar@example.com",
+ "profile":{
+ "category":"healthcare",
+ "subcategory":"clinic",
+ "addresses":{
+ "registered":{
+ "street1":"507, Koramangala 1st block",
+ "street2":"MG Road",
+ "city":"Bengaluru",
+ "state":"KARNATAKA",
+ "postal_code":"560034",
+ "country":"IN"
+ }
+ }
+ },
+ "notes":[
+
+ ],
+ "created_at":1611136837,
+ "phone":"9999999999",
+ "contact_name":"Gaurav Kumar",
+ "reference_id":"124124",
+ "business_type":"partnership",
+ "legal_business_name":"Acme Corp",
+ "customer_facing_business_name":"Acme Corp",
+ "legal_info":{
+ "pan":"AAACL1234C",
+ "gst":"18AABCU9603R1ZM"
+ }
+}
+```
+
+-------------------------------------------------------------------------------------------------------
+
+### Fetch a Linked Account of a Sub-Merchant by id
+```php
+$api->setHeader('X-Razorpay-Account', 'acc_sub-merchantId');
+
+$accountId = "acc_GP4lfNA0iIMn5B";
+$api->account->fetch($accountId);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|-------------|-------------|---------------------------------------------|
+| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
+
+**Response:**
+```json
+{
+ "id":"acc_GLGeLkU2JUeyDZ",
+ "type":"route",
+ "reference_id":"123123",
+ "status":"created",
+ "email":"gaurav.kumar@example.com",
+ "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":"Kormanagala",
+ "city":"Bengaluru",
+ "state":"KARNATAKA",
+ "country":"IN",
+ "postal_code":560047
+ }
+ },
+ "business_model":null
+ },
+ "notes":[
+
+ ],
+ "created_at":1611136837,
+ "phone":"9999999998",
+ "business_type":"partnership",
+ "legal_business_name":"Acme Corp",
+ "customer_facing_business_name":"Acme Corp",
+ "legal_info":{
+ "pan":"AAACL1234C",
+ "gst":"18AABCU9603R1ZM"
+ },
+ "apps":{
+ "websites":[
+
+ ],
+ "android":[
+ {
+ "url":null,
+ "name":null
+ }
+ ],
+ "ios":[
+ {
+ "url":null,
+ "name":null
+ }
+ ]
+ },
+ "brand":{
+ "color":null
+ },
+ "contact_name":"Gaurav Kumar",
+ "contact_info":{
+ "chargeback":{
+ "email":null,
+ "phone":null,
+ "policy_url":null
+ },
+ "refund":{
+ "email":null,
+ "phone":null,
+ "policy_url":null
+ },
+ "support":{
+ "email":null,
+ "phone":null,
+ "policy_url":null
+ }
+ }
+}
+```
+
+-------------------------------------------------------------------------------------------------------
+
+**PN: * indicates mandatory fields**
+
+
+**For reference click [here](https://razorpay.com/docs/partners/route/linked-accounts)**
\ No newline at end of file
diff --git a/documents/order.md b/documents/order.md
index b1a9da80..da873278 100644
--- a/documents/order.md
+++ b/documents/order.md
@@ -236,6 +236,182 @@ $api->order->fetch($orderId)->edit(array('notes'=> array('notes_key_1'=>'Beam me
```
-------------------------------------------------------------------------------------------------------
+### Create an order (Magic checkout)
+
+```php
+$api->order->create(array(
+ "amount" => 50000,
+ "currency" => "INR",
+ "receipt" => "receipt#21",
+ "notes" => array(
+ "key1" => "value3",
+ "key2" => "value2"
+ ),
+ "rto_review" => true,
+ "line_items" =>
+ array(array(
+ "type" => "e-commerce",
+ "sku" => "1g234",
+ "variant_id" => "12r34",
+ "price" => "3900",
+ "offer_price" => "3800",
+ "tax_amount" => 0,
+ "quantity" => 1,
+ "name" => "TEST",
+ "description" => "TEST",
+ "weight" => "1700",
+ "dimensions" => array(
+ "length" => "1700",
+ "width" => "1700",
+ "height" => "1700"
+ ),
+ "image_url" => "https://unsplash.com/s/photos/new-wallpaper",
+ "product_url" => "https://unsplash.com/s/photos/new-wallpaper",
+ "notes" => array())),
+ "line_items_total" => "1200",
+ "shipping_fee" => 100,
+ "cod_fee" => 100,
+ "promotions" => array(array(
+ "reference_id" => 1234,
+ "type" => "coupon",
+ "code" => "HDFC2000",
+ "value" => "200",
+ "value_type" => "fixed_amount",
+ "description" => "200 discount on your order"
+ )),
+ "customer" => array(
+ "name" => "Test Rto Order",
+ "contact" => "+919000090000",
+ "email" => "gaurav.kumar@example.com"
+ ),
+ "device_details" => array(
+ "ip" => "127.0.0.1",
+ "user_agent" => "abc"
+ ),
+ "shipping_details" => array(
+ "shipping_address" => array(
+ "line1" => "1",
+ "line2" => "1",
+ "zipcode" =>
+ "305001",
+ "contact" => "+919090909090",
+ "city" => "Ajmer",
+ "state" => "Rajasthan",
+ "country" => "IND",
+ "tag" => "home",
+ "landmark" => "Hathibhata"
+ )
+ )
+ )
+ );
+```
+**Parameters**
+
+| Name | Type | Description |
+|----------|--------|-------------------------------------|
+| amount* | integer | The transaction amount, expressed in the currency subunit, such as paise (in case of INR). |
+| currency* | string | The currency in which the transaction should be made. default value is `INR`|
+| receipt | string | Your receipt id for this order should be passed here. Maximum length of 40 characters. |
+| notes | array | Key-value pair that can be used to store additional information about the entity.|
+| rto_review | boolean | Identifier to mark the order eligible for RTO risk prediction. Possible values is `0` or `1` |
+| line_items | array | All keys listed [here](https://betasite.razorpay.com/docs/razorpay/IN/payments-magic-new-rto-intelligence/payments/magic-checkout/rto-intelligence/#11-create-an-order) are supported |
+| line_items_total | integer | Sum of offer_price for all line items added in the cart in paise. |
+| shipping_fee | integer | Shipping fee charged on the line items in paisa. |
+| cod_fee | integer | COD fee charged on the line items in paisa. |
+| promotions | array | Used to pass all offer or discount related information including coupon code discount, method discount and so on. |
+| customer | array | All keys listed [here](https://betasite.razorpay.com/docs/razorpay/IN/payments-magic-new-rto-intelligence/payments/magic-checkout/rto-intelligence/#11-create-an-order) are supported |
+| device_details | array | All keys listed [here](https://betasite.razorpay.com/docs/razorpay/IN/payments-magic-new-rto-intelligence/payments/magic-checkout/rto-intelligence/#11-create-an-order) are supported |
+| shipping_details | array | All keys listed [here](https://betasite.razorpay.com/docs/razorpay/IN/payments-magic-new-rto-intelligence/payments/magic-checkout/rto-intelligence/#11-create-an-order) are supported |
+
+**Response:**
+```json
+{
+ "id": "order_MpyV7eOsTBn24z",
+ "entity": "order",
+ "amount": 50000,
+ "amount_paid": 0,
+ "amount_due": 50000,
+ "currency": "INR",
+ "receipt": "receipt#22",
+ "status": "created",
+ "attempts": 0,
+ "notes": {
+ "key1": "value3",
+ "key2": "value2"
+ },
+ "created_at": 1697698714
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+### View RTO/Risk Reasons
+
+```php
+$orderId = "order_DaaS6LOUAASb7Y";
+
+$api->order->fetch($orderId)->viewRtoReview();
+```
+**Parameters**
+
+| Name | Type | Description |
+|----------|--------|-------------------------------------|
+| orderId* | string | The id of the order to be retrieve payment info |
+| notes* | array | A key-value pair |
+
+**Response:**
+```json
+{
+ "risk_tier": "high",
+ "rto_reasons": [
+ {
+ "reason": "short_shipping_address",
+ "description": "Short shipping address",
+ "bucket": "address"
+ },
+ {
+ "reason": "address_pincode_state_mismatch",
+ "description": "Incorrect pincode state entered",
+ "bucket": "address"
+ }
+ ]
+}
+```
+-------------------------------------------------------------------------------------------------------
+
+```php
+$orderId = "order_DaaS6LOUAASb7Y";
+
+$api->order->fetch($orderId)->editFulfillment(array(
+ 'payment_method' => 'upi',
+ 'shipping' => array(
+ 'waybill' => '123456789',
+ 'status' => 'rto',
+ 'provider' => 'Bluedart'
+ )
+ )
+);
+```
+**Parameters**
+
+| Name | Type | Description |
+|----------|--------|-------------------------------------|
+| payment_method | string | The id of the order to be retrieve payment info |
+| shipping | array | All keys listed [here](https://betasite.razorpay.com/docs/razorpay/IN/payments-magic-new-rto-intelligence/payments/magic-checkout/rto-intelligence/#13-update-the-fulfillment-details) are supported |
+
+**Response:**
+```json
+{
+ "entity": "order.fulfillment",
+ "order_id": "EKwxwAgItXXXX",
+ "payment_method": "upi",
+ "shipping": {
+ "waybill": "123456789",
+ "status": "rto",
+ "provider": "Bluedart"
+ }
+}
+```
+-------------------------------------------------------------------------------------------------------
**PN: * indicates mandatory fields**
diff --git a/documents/payment.md b/documents/payment.md
index b1389b24..0f1ea199 100644
--- a/documents/payment.md
+++ b/documents/payment.md
@@ -656,48 +656,199 @@ Doc reference [doc](https://razorpay.com/docs/payments/payment-methods/cards/aut
```
-------------------------------------------------------------------------------------------------------
-### Token IIN API
+
+### Fetch a Payment (With Expanded Card Details)
```php
-$tokenIin = "412345";
-$api->iin->fetch($tokenIin);
+$paymentId = "pay_MLzFlOC98cJmHQ";
+
+$api->payment->fetch($paymentId)->expandedDetails(["expand[]"=> "card"]);
```
**Parameters:**
-| Name | Type | Description |
-|------------|--------|-----------------------------------|
-| tokenIin* | string | The token IIN. |
+| Name | Type | Description |
+|-------------|---------|--------------------------------------|
+| paymentId* | integer | Unique identifier of the payment |
+| expand[] | string | Use to expand the card details when the payment method is `card`. |
+
+**Response:**
-**Response:**
```json
{
- "iin": "412345",
- "entity": "iin",
- "network": "Visa",
- "type": "credit",
- "sub_type": "business",
- "issuer_code": "HDFC",
- "issuer_name": "HDFC Bank Ltd",
+ "id": "pay_H9oR0gLCaVlV6m",
+ "entity": "payment",
+ "amount": 100,
+ "currency": "INR",
+ "status": "failed",
+ "order_id": "order_H9o58N6qmLYQKC",
+ "invoice_id": null,
+ "terminal_id": "term_G5kJnYM9GhhLYT",
"international": false,
- "is_tokenized": true,
- "card_iin": "411111",
- "emi":{
- "available": true
- },
- "recurring": {
- "available": true
- },
- "authentication_types": [
- {
- "type":"3ds"
- },
- {
- "type":"otp"
- }
- ]
+ "method": "card",
+ "amount_refunded": 0,
+ "refund_status": null,
+ "captured": false,
+ "description": null,
+ "card_id": "card_H9oR0ocen1cmZq",
+ "card": {
+ "id": "card_H9oR0ocen1cmZq",
+ "entity": "card",
+ "name": "Gaurav",
+ "last4": "1213",
+ "network": "RuPay",
+ "type": "credit",
+ "issuer": "UTIB",
+ "international": false,
+ "emi": false,
+ "sub_type": "business"
+ },
+ "bank": null,
+ "wallet": null,
+ "vpa": null,
+ "email": "gaurav.kumar@example.com",
+ "contact": "+919000090000",
+ "notes": {
+ "email": "gaurav.kumar@example.com",
+ "phone": "09000090000"
+ },
+ "fee": null,
+ "tax": null,
+ "error_code": "BAD_REQUEST_ERROR",
+ "error_description": "Card issuer is invalid",
+ "error_source": "customer",
+ "error_step": "payment_authentication",
+ "error_reason": "incorrect_card_details",
+ "acquirer_data": {
+ "auth_code": null,
+ "authentication_reference_number": "100222021120200000000742753928"
+ },
+ "created_at": 1620807547
+}
+```
+
+-------------------------------------------------------------------------------------------------------
+
+### Fetch a Payment (With Expanded Offers Details)
+
+```php
+$paymentId = "pay_MLzFlOC98cJmHQ";
+
+$api->payment->fetch($paymentId)->expandedDetails(["expand[]"=> "emi"]);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|-------------|---------|--------------------------------------|
+| paymentId* | integer | Unique identifier of the payment |
+| expand[] | string | Use to expand the emi details when the payment method is emi. |
+
+**Response:**
+
+```json
+{
+ "id": "pay_DG4ZdRK8ZnXC3k",
+ "entity": "payment",
+ "amount": 200000,
+ "currency": "INR",
+ "status": "authorized",
+ "order_id": null,
+ "invoice_id": null,
+ "international": false,
+ "method": "emi",
+ "amount_refunded": 0,
+ "refund_status": null,
+ "captured": false,
+ "description": null,
+ "card_id": "card_DG4ZdUO3xABb20",
+ "bank": "ICIC",
+ "wallet": null,
+ "vpa": null,
+ "email": "gaurav@example.com",
+ "contact": "+919972000005",
+ "notes": [],
+ "fee": null,
+ "tax": null,
+ "error_code": null,
+ "error_description": null,
+ "error_source": null,
+ "error_step": null,
+ "error_reason": null,
+ "emi": {
+ "issuer": "ICIC",
+ "rate": 1300,
+ "duration": 6
+ },
+ "acquirer_data": {
+ "auth_code": "828553"
+ },
+ "created_at": 1568026077
+}
+```
+
+-------------------------------------------------------------------------------------------------------
+
+### Fetch a Payment (With Expanded UPI Details)
+
+```php
+$paymentId = "pay_MLzFlOC98cJmHQ";
+
+$api->payment->fetch($paymentId)->expandedDetails(["expand[]"=> "upi"]);
+```
+
+**Parameters:**
+
+| Name | Type | Description |
+|-------------|---------|--------------------------------------|
+| paymentId* | integer | Unique identifier of the payment |
+| expand[] | string | Use to expand the UPI details when the payment method is upi. |
+
+**Response:**
+
+```json
+{
+ "id": "pay_DG4ZdRK8ZnXC3k",
+ "entity": "payment",
+ "amount": 100,
+ "currency": "INR",
+ "status": "captured",
+ "order_id": "order_GjCr5oKh4AVC51",
+ "invoice_id": null,
+ "international": false,
+ "method": "upi",
+ "amount_refunded": 0,
+ "refund_status": null,
+ "captured": true,
+ "description": "Payment for Adidas shoes",
+ "card_id": null,
+ "bank": null,
+ "wallet": null,
+ "vpa": "gaurav.kumar@upi",
+ "email": "gaurav.kumar@example.com",
+ "contact": "9000090000",
+ "customer_id": "cust_K6fNE0WJZWGqtN",
+ "token_id": "token_KOdY$DBYQOv08n",
+ "notes": [],
+ "fee": 1,
+ "tax": 0,
+ "error_code": null,
+ "error_description": null,
+ "error_source": null,
+ "error_step": null,
+ "error_reason": null,
+ "acquirer_data": {
+ "rrn": "303107535132"
+ },
+ "created_at": 1605871409,
+ "upi": {
+ "payer_account_type": "credit_card",
+ "vpa": "gaurav.kumar@upi",
+ "flow": "in_app" // appears only for Turbo UPI Payments.
+ }
}
```
+
-------------------------------------------------------------------------------------------------------
**PN: * indicates mandatory fields**
diff --git a/documents/settlement.md b/documents/settlement.md
index 7339764e..0e59559c 100644
--- a/documents/settlement.md
+++ b/documents/settlement.md
@@ -440,6 +440,128 @@ $api->settlement->fetch($settlementId)->fetchOndemandSettlementById();
**Response:**
For on-demand settlement by ID response please click [here](https://razorpay.com/docs/api/settlements/#fetch-on-demand-settlements-by-id)
+-------------------------------------------------------------------------------------------------------
+### Fetch Instant Settlement With ID With Payout Details
+
+```php
+$settlementId = "setlod_MI0c34SIRVT25W";
+
+$api->settlement->fetchOndemandSettlementById($settlementId,["expand[]"=> "ondemand_payouts"]);
+```
+
+**Parameters:**
+
+
+| Name | Type | Description |
+|-------|-----------|--------------------------------------------------|
+| expand[] | string | Possible value is `ondemand_payouts` |
+
+**Response:**
+```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 buy stock.",
+ "notes": {
+ "notes_key_1": "Tea, Earl Grey, Hot",
+ "notes_key_2": "Tea, Earl Grey, decaf."
+ },
+ "created_at": 1596771429,
+ "ondemand_payouts": {
+ "entity": "collection",
+ "count": 1,
+ "items": [
+ {
+ "id": "setlodp_FNj7g2cbvw8ueO",
+ "entity": "settlement.ondemand_payout",
+ "initiated_at": 1596771430,
+ "processed_at": 1596778752,
+ "reversed_at": null,
+ "amount": 200000,
+ "amount_settled": 199410,
+ "fees": 590,
+ "tax": 90,
+ "utr": "022011173948",
+ "status": "processed",
+ "created_at": 1596771429
+ }
+ ]
+ }
+}
+```
+
+-------------------------------------------------------------------------------------------------------
+### Fetch All Instant Settlements With Payout Details
+
+```php
+$api->settlement->fetchAllOndemandSettlement(["expand[]"=> "ondemand_payouts"]);
+```
+
+**Parameters:**
+
+
+| Name | Type | Description |
+|-------|-----------|--------------------------------------------------|
+| expand[] | string | Possible value is `ondemand_payouts` |
+
+**Response:**
+```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,
+ "ondemand_payouts": {
+ "entity": "collection",
+ "count": 1,
+ "items": [
+ {
+ "id": "setlodp_FNj7g2cbvw8ueO",
+ "entity": "settlement.ondemand_payout",
+ "initiated_at": 1596771430,
+ "processed_at": 1596778752,
+ "reversed_at": null,
+ "amount": 200000,
+ "amount_settled": 199410,
+ "fees": 590,
+ "tax": 90,
+ "utr": "022011173948",
+ "status": "processed",
+ "created_at": 1596771429
+ }
+ ]
+ }
+ }
+ ]
+}
+```
+
-------------------------------------------------------------------------------------------------------
**PN: * indicates mandatory fields**
diff --git a/documents/stakeholder.md b/documents/stakeholder.md
index 83d4bd4a..5ba46ba6 100644
--- a/documents/stakeholder.md
+++ b/documents/stakeholder.md
@@ -267,9 +267,79 @@ $api->account->fetch($accountId)->stakeholders()->fetch($stakeholderId);
}
```
+### Upload stakeholders documents
+
+```php
+$accountId = "acc_00000000000001";
+
+$stakeholderId = "sth_00000000000001";
+
+$payload = [
+ 'file'=> '/Users/your_name/Downloads/sample_uploaded.pdf',
+ "document_type" => "aadhar_front"
+];
+
+$api->account->fetch($accountId)->stakeholders()->uploadStakeholderDoc($stakeholderId, $payload);
+```
+
+**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
+```php
+
+$accountId = "acc_00000000000001";
+
+$stakeholderId = "sth_00000000000001";
+
+$api->account->fetch($accountId)->stakeholders()->fetchStakeholderDoc($stakeholderId);
+```
+
+**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/stakeholder)**
\ No newline at end of file
+**For reference click [here](https://razorpay.com/docs/api/partners/stakeholder)**
+
+
+$result = $api->account->fetch("acc_M83Uw27KXuC7c8")->stakeholders()->fetchStakeholderDoc("sth_M83WuwmrCFa55g", $payload);
+
+
+$result = $api->account->fetch("acc_M83Uw27KXuC7c8")->stakeholders()->uploadStakeholderDoc("sth_M83WuwmrCFa55g", $payload);
\ No newline at end of file
diff --git a/libs/Requests-2.0.4/src/Transport/Curl.php b/libs/Requests-2.0.4/src/Transport/Curl.php
index 5187776e..66b89c1c 100644
--- a/libs/Requests-2.0.4/src/Transport/Curl.php
+++ b/libs/Requests-2.0.4/src/Transport/Curl.php
@@ -390,7 +390,7 @@ private function setup_handle($url, $headers, $data, $options) {
if ($data_format === 'query') {
$url = self::format_get($url, $data);
$data = '';
- } elseif (!is_string($data)) {
+ } elseif (!is_string($data) && !isset($data["file"])){
$data = http_build_query($data, '', '&');
}
}
diff --git a/src/Account.php b/src/Account.php
index 66b6adcb..11eb901a 100644
--- a/src/Account.php
+++ b/src/Account.php
@@ -59,4 +59,20 @@ public function webhooks()
return $webhook;
}
+
+ public function uploadAccountDoc($attributes = array())
+ {
+ $attributes = $this->setFile($attributes);
+
+ $entityUrl = $this->getEntityUrl() .$this->id .'/documents';
+
+ return $this->request('POST', $entityUrl, $attributes, 'v2');
+ }
+
+ public function fetchAccountDoc()
+ {
+ $entityUrl = $this->getEntityUrl() .$this->id .'/documents';
+
+ return $this->request('GET', $entityUrl, null, 'v2');
+ }
}
diff --git a/src/Customer.php b/src/Customer.php
index 45cd6d46..0173d836 100644
--- a/src/Customer.php
+++ b/src/Customer.php
@@ -37,4 +37,32 @@ public function tokens()
return $token;
}
+
+ public function addBankAccount($attributes = array())
+ {
+ $entityUrl = $this->getEntityUrl().$this->id. '/bank_account';
+
+ return $this->request('POST', $entityUrl, $attributes);
+ }
+
+ public function deleteBankAccount($bank_id)
+ {
+ $entityUrl = $this->getEntityUrl() . $this->id. '/bank_account/'. $bank_id;
+
+ return $this->request('DELETE', $entityUrl);
+ }
+
+ public function requestEligibilityCheck($attributes = array())
+ {
+ $entityUrl = $this->getEntityUrl(). '/eligibility';
+
+ return $this->request('POST', $entityUrl, $attributes);
+ }
+
+ public function fetchEligibility($id)
+ {
+ $entityUrl = $this->getEntityUrl(). '/eligibility/'. $id;
+
+ return $this->request('GET', $entityUrl);
+ }
}
diff --git a/src/Dispute.php b/src/Dispute.php
new file mode 100644
index 00000000..25e0e1c1
--- /dev/null
+++ b/src/Dispute.php
@@ -0,0 +1,35 @@
+getEntityUrl(). $this->id. '/accept';
+
+ return $this->request('POST', $entityUrl);
+ }
+
+ public function contest($attributes = array())
+ {
+ $entityUrl = $this->getEntityUrl(). $this->id. '/contest';
+
+ return $this->request('PATCH', $entityUrl, $attributes);
+ }
+}
\ No newline at end of file
diff --git a/src/Document.php b/src/Document.php
new file mode 100644
index 00000000..bb01d52a
--- /dev/null
+++ b/src/Document.php
@@ -0,0 +1,20 @@
+setFile($attributes);
+
+ return parent::create($attributes);
+ }
+
+ public function fetch($id)
+ {
+ return parent::fetch($id);
+ }
+
+}
diff --git a/src/Entity.php b/src/Entity.php
index caf17c5c..2424ebca 100644
--- a/src/Entity.php
+++ b/src/Entity.php
@@ -231,4 +231,16 @@ protected function convertToArray($attributes)
return $array;
}
+
+ public function setFile($attributes)
+ {
+ if(isset($attributes['file'])){
+ $attributes['file'] = new \CURLFILE(
+ $attributes['file'],
+ mime_content_type($attributes['file'])
+ );
+ }
+
+ return $attributes;
+ }
}
diff --git a/src/Iin.php b/src/Iin.php
index c2f26530..ddae6409 100644
--- a/src/Iin.php
+++ b/src/Iin.php
@@ -8,4 +8,11 @@ public function fetch($id)
{
return parent::fetch($id);
}
+
+ public function all($options = array())
+ {
+ $relativeUrl = $this->getEntityUrl(). 'list';
+
+ return $this->request('GET', $relativeUrl, $options);
+ }
}
diff --git a/src/Order.php b/src/Order.php
index 7c429941..50404f1c 100644
--- a/src/Order.php
+++ b/src/Order.php
@@ -48,4 +48,18 @@ public function transfers($options = array())
return $this->request('GET', $relativeUrl, $options);
}
+
+ public function viewRtoReview()
+ {
+ $relativeUrl = $this->getEntityUrl(). $this->id .'/rto_review';
+
+ return $this->request('POST', $relativeUrl);
+ }
+
+ public function editFulfillment($attributes = array())
+ {
+ $relativeUrl = $this->getEntityUrl(). $this->id .'/fulfillment';
+
+ return $this->request('POST', $relativeUrl, $attributes);
+ }
}
diff --git a/src/Payment.php b/src/Payment.php
index 463dea93..38bcd46b 100644
--- a/src/Payment.php
+++ b/src/Payment.php
@@ -223,4 +223,11 @@ public function fetchPaymentMethods()
return $this->request('GET', $relativeUrl);
}
+
+ public function expandedDetails($options = array())
+ {
+ $relativeUrl = $this->getEntityUrl(). $this->id;
+
+ return $this->request('GET', $relativeUrl, $options);
+ }
}
diff --git a/src/Settlement.php b/src/Settlement.php
index d3730f03..1715dac1 100644
--- a/src/Settlement.php
+++ b/src/Settlement.php
@@ -65,23 +65,24 @@ public function settlementRecon($options = array())
/**
* fetch Ondemand Settlement by Id
* @param string $id
+ * @param array $options
* @return array
*/
- public function fetchOndemandSettlementById()
+ public function fetchOndemandSettlementById($id, $options = array())
{
- $relativeUrl = $this->getEntityUrl(). "ondemand/" . $this->id ;
+ $relativeUrl = $this->getEntityUrl(). "ondemand/" . $id;
- return $this->request('GET', $relativeUrl);
+ return $this->request('GET', $relativeUrl, $options);
}
/**
* fetch all Ondemand Settlement
* @return array
*/
- public function fetchAllOndemandSettlement()
+ public function fetchAllOndemandSettlement($options = array())
{
$relativeUrl = $this->getEntityUrl(). "ondemand/";
- return $this->request('GET', $relativeUrl);
+ return $this->request('GET', $relativeUrl, $options);
}
}
diff --git a/src/Stakeholder.php b/src/Stakeholder.php
index 05cf5971..3acc1158 100644
--- a/src/Stakeholder.php
+++ b/src/Stakeholder.php
@@ -31,4 +31,20 @@ public function edit($id, $attributes = array())
return $this->request('PATCH', $entityUrl, $attributes, 'v2');
}
+
+ public function uploadStakeholderDoc($id, $attributes = array())
+ {
+ $attributes = $this->setFile($attributes);
+
+ $entityUrl = 'accounts/'.$this->account_id .'/'.$this->getEntityUrl().'/'.$id.'/documents';
+
+ return $this->request('POST', $entityUrl, $attributes, 'v2');
+ }
+
+ public function fetchStakeholderDoc($id)
+ {
+ $entityUrl = 'accounts/'.$this->account_id .'/'.$this->getEntityUrl().'/'.$id.'/documents';
+
+ return $this->request('GET', $entityUrl, null, 'v2');
+ }
}
diff --git a/tests/CoverageTest.php b/tests/CoverageTest.php
index 411395d5..1467ca0b 100644
--- a/tests/CoverageTest.php
+++ b/tests/CoverageTest.php
@@ -395,17 +395,7 @@ public function testSetHeaderJson()
$order->setup();
$order->testCreateOrderSetHeaderException();
}
-
- /**
- * @covers \Razorpay\Api\Order::create
- */
- public function testSendJsonPayload()
- {
- $order = new ExceptionTest();
- $order->setup();
- $order->testCreateJsonOrderException();
- }
-
+
/**
* @covers \Razorpay\Api\Order::create
*/
diff --git a/tests/CustomerTest.php b/tests/CustomerTest.php
index cc6269f7..4d6d4332 100644
--- a/tests/CustomerTest.php
+++ b/tests/CustomerTest.php
@@ -13,6 +13,8 @@ class CustomerTest extends TestCase
private $customerId = "cust_IEfAt3ruD4OEzo";
+ static private $baId;
+
public function setUp(): void
{
parent::setUp();
@@ -67,4 +69,42 @@ public function testFetchCustomer()
$this->assertTrue(in_array($this->customerId, $data->toArray()));
}
+
+ /**
+ * Add Bank account
+ */
+ public function testBankAccount()
+ {
+ $data = $this->api->customer->fetch($this->customerId)->addBankAccount([
+ "ifsc_code" => "UTIB0000194",
+ "account_number" => "919999999999",
+ "beneficiary_name" => "Pratheek",
+ "beneficiary_address1" => "address 1",
+ "beneficiary_address2" => "address 2",
+ "beneficiary_address3" => "address 3",
+ "beneficiary_address4" => "address 4",
+ "beneficiary_email" => "random@email.com",
+ "beneficiary_mobile" => "8762489310",
+ "beneficiary_city" => "Bangalore",
+ "beneficiary_state" => "KA",
+ "beneficiary_country" => "IN",
+ ]);
+
+ CustomerTest::$baId = $data->id;
+
+ $this->assertTrue(is_array($data->toArray()));
+
+ $this->assertTrue(in_array("bank_account", $data->toArray()));
+ }
+
+ public function testDeleteBankAccount(){
+ if(CustomerTest::$baId)
+ {
+ $data = $this->api->customer->fetch($this->customerId)->deleteBankAccount(CustomerTest::$baId);
+
+ $this->assertTrue(is_array($data->toArray()));
+
+ $this->assertTrue(in_array("bank_account", $data->toArray()));
+ }
+ }
}
\ No newline at end of file
diff --git a/tests/ExceptionTest.php b/tests/ExceptionTest.php
index 35eb16d0..f894e8b5 100644
--- a/tests/ExceptionTest.php
+++ b/tests/ExceptionTest.php
@@ -12,25 +12,6 @@ public function setUp(): void
parent::setUp();
}
- /**
- * Create an order from json payload
- */
- public function testCreateJsonOrderException()
- {
- $payload = $this->payload();
- $attribute = json_encode($payload);
- try
- {
- $data = $this->api->order->create($attribute);
-
- $this->assertTrue(is_array($data->toArray()));
-
- }
- catch(Error $e){
- throw new InvalidArgumentException($e);
- }
- }
-
/**
* Create an order from set header application/json
*/
diff --git a/tests/IinTest.php b/tests/IinTest.php
new file mode 100644
index 00000000..95a85bb7
--- /dev/null
+++ b/tests/IinTest.php
@@ -0,0 +1,16 @@
+api->iin->all();
+
+ $this->assertTrue(is_array($data->toArray()));
+ }
+}
\ No newline at end of file
diff --git a/tests/PartnerTest.php b/tests/PartnerTest.php
index 505b460a..ab92397f 100644
--- a/tests/PartnerTest.php
+++ b/tests/PartnerTest.php
@@ -25,6 +25,12 @@ class PartnerTest extends TestCase
protected static $webhook_id;
+ protected $accId = "acc_M83Uw27KXuC7c8";
+
+ protected $stkId = "sth_M83WuwmrCFa55g";
+
+ protected $docId = "doc_NBpjajKtxrMDg7";
+
public function setUp(): void
{
$apiKey = getenv("RAZORPAY_API_KEY") ? getenv("RAZORPAY_PARTNER_API_KEY") : "";
@@ -279,4 +285,29 @@ public function webhookAttributes(){
],
];
}
+
+ public function testAccountFetchDocument()
+ {
+ $data = $this->instance->account->fetch($this->accId)->fetchAccountDoc();
+
+ $this->assertTrue(is_array($data->toArray()));
+
+ }
+
+ public function testStakeholderFetchDocument()
+ {
+ $data = $this->instance->account->fetch($this->accId)->stakeholders()->fetchStakeholderDoc($this->stkId);
+
+ $this->assertTrue(is_array($data->toArray()));
+
+ }
+
+ public function testFetchDocument()
+ {
+ $data = $this->instance->document->fetch($this->docId);
+
+ $this->assertTrue(is_array($data->toArray()));
+
+ $this->assertArrayHasKey("entity", $data->toArray());
+ }
}