razorpay 2.4.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ruby.yml +38 -0
- data/CHANGELOG.md +19 -0
- data/README.md +29 -140
- data/documents/Invoice.md +531 -0
- data/documents/addon.md +169 -0
- data/documents/card.md +611 -0
- data/documents/customer.md +161 -0
- data/documents/emandate.md +484 -0
- data/documents/fund.md +87 -0
- data/documents/items.md +184 -0
- data/documents/order.md +230 -0
- data/documents/papernach.md +718 -0
- data/documents/payment.md +636 -0
- data/documents/paymentLink.md +1045 -0
- data/documents/paymentVerification.md +79 -0
- data/documents/plan.md +184 -0
- data/documents/qrcode.md +441 -0
- data/documents/refund.md +324 -0
- data/documents/registerEmandate.md +445 -0
- data/documents/registerNach.md +661 -0
- data/documents/settlement.md +477 -0
- data/documents/subscriptions.md +750 -0
- data/documents/tokens.md +208 -0
- data/documents/transfers.md +684 -0
- data/documents/upi.md +548 -0
- data/documents/virtualAccount.md +586 -0
- data/lib/razorpay/addon.rb +4 -0
- data/lib/razorpay/constants.rb +1 -1
- data/lib/razorpay/customer.rb +15 -0
- data/lib/razorpay/fund_account.rb +19 -0
- data/lib/razorpay/invoice.rb +8 -0
- data/lib/razorpay/item.rb +34 -0
- data/lib/razorpay/order.rb +10 -0
- data/lib/razorpay/payment.rb +52 -0
- data/lib/razorpay/payment_link.rb +36 -0
- data/lib/razorpay/qr_code.rb +34 -0
- data/lib/razorpay/refund.rb +4 -0
- data/lib/razorpay/request.rb +13 -6
- data/lib/razorpay/settlement.rb +39 -0
- data/lib/razorpay/subscription.rb +24 -0
- data/lib/razorpay/subscription_registration.rb +16 -0
- data/lib/razorpay/transfer.rb +35 -0
- data/lib/razorpay/utility.rb +7 -2
- data/lib/razorpay/virtual_account.rb +14 -6
- data/lib/razorpay.rb +7 -0
- data/test/fixtures/addon_collection.json +60 -0
- data/test/fixtures/create_json_payment.json +13 -0
- data/test/fixtures/delete_token.json +3 -0
- data/test/fixtures/downtimes_collection.json +21 -0
- data/test/fixtures/empty.json +2 -0
- data/test/fixtures/fake_addon.json +3 -3
- data/test/fixtures/fake_direct_transfer.json +32 -0
- data/test/fixtures/fake_downtime.json +14 -0
- data/test/fixtures/fake_fund_account.json +18 -0
- data/test/fixtures/fake_instant_settlement.json +19 -0
- data/test/fixtures/fake_item.json +9 -0
- data/test/fixtures/fake_order_transfers.json +88 -0
- data/test/fixtures/fake_otp_generate.json +19 -0
- data/test/fixtures/fake_otp_resend.json +7 -0
- data/test/fixtures/fake_otp_submit.json +5 -0
- data/test/fixtures/fake_payment_link.json +40 -0
- data/test/fixtures/fake_pending_update.json +30 -0
- data/test/fixtures/fake_qrcode.json +20 -0
- data/test/fixtures/fake_qrcode_close.json +22 -0
- data/test/fixtures/fake_recurring.json +5 -0
- data/test/fixtures/fake_refund.json +1 -1
- data/test/fixtures/fake_settlement.json +11 -0
- data/test/fixtures/fake_settlement_on_demand.json +39 -0
- data/test/fixtures/fake_subscription_pause.json +19 -0
- data/test/fixtures/fake_subscription_registration.json +91 -0
- data/test/fixtures/fake_subscription_resume.json +19 -0
- data/test/fixtures/fake_token.json +31 -0
- data/test/fixtures/fake_transfer.json +18 -0
- data/test/fixtures/fake_transfer_reverse.json +15 -0
- data/test/fixtures/fake_update_payment.json +39 -0
- data/test/fixtures/fake_virtual_account_allowed.json +46 -0
- data/test/fixtures/fake_virtual_account_receiver.json +46 -0
- data/test/fixtures/fund_collection.json +20 -0
- data/test/fixtures/item_collection.json +24 -0
- data/test/fixtures/payment_collection.json +1 -1
- data/test/fixtures/payment_link_collection.json +43 -0
- data/test/fixtures/payment_link_response.json +3 -0
- data/test/fixtures/qrcode_collection.json +50 -0
- data/test/fixtures/qrcode_payments_collection.json +74 -0
- data/test/fixtures/settlement_collection.json +26 -0
- data/test/fixtures/settlement_instant_collection.json +84 -0
- data/test/fixtures/settlement_report_collection.json +117 -0
- data/test/fixtures/success.json +3 -0
- data/test/fixtures/tokens_collection.json +36 -0
- data/test/fixtures/transfer_settlements_collection.json +38 -0
- data/test/fixtures/transfers_collection.json +41 -0
- data/test/razorpay/test_addon.rb +15 -15
- data/test/razorpay/test_customer.rb +27 -3
- data/test/razorpay/test_fund_account.rb +42 -0
- data/test/razorpay/test_invoice.rb +15 -2
- data/test/razorpay/test_item.rb +66 -0
- data/test/razorpay/test_order.rb +24 -1
- data/test/razorpay/test_payment.rb +184 -8
- data/test/razorpay/test_payment_link.rb +83 -0
- data/test/razorpay/test_plan.rb +2 -2
- data/test/razorpay/test_qr_code.rb +63 -0
- data/test/razorpay/test_refund.rb +16 -2
- data/test/razorpay/test_settlement.rb +76 -0
- data/test/razorpay/test_subscription.rb +72 -9
- data/test/razorpay/test_subscription_registration.rb +58 -0
- data/test/razorpay/test_transfer.rb +77 -0
- data/test/razorpay/test_utility.rb +32 -0
- data/test/razorpay/test_virtual_account.rb +64 -17
- data/test/test_helper.rb +6 -0
- metadata +138 -9
- data/.travis.yml +0 -22
- data/test/razorpay/test_errors.rb +0 -19
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"entity": "collection",
|
3
|
+
"count": 1,
|
4
|
+
"items": [
|
5
|
+
{
|
6
|
+
"id": "item_J7lZCyxMVeEtYB",
|
7
|
+
"active": true,
|
8
|
+
"name": "Test item",
|
9
|
+
"description": null,
|
10
|
+
"amount": 1000,
|
11
|
+
"unit_amount": 1000,
|
12
|
+
"currency": "INR",
|
13
|
+
"type": "invoice",
|
14
|
+
"unit": null,
|
15
|
+
"tax_inclusive": false,
|
16
|
+
"hsn_code": null,
|
17
|
+
"sac_code": null,
|
18
|
+
"tax_rate": null,
|
19
|
+
"tax_id": null,
|
20
|
+
"tax_group_id": null,
|
21
|
+
"created_at": 1647434940
|
22
|
+
}
|
23
|
+
]
|
24
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"entity": "collection",
|
3
|
+
"count": 3,
|
4
|
+
"items": [
|
5
|
+
{
|
6
|
+
"accept_partial": false,
|
7
|
+
"entity": "payment_link",
|
8
|
+
"amount": 100,
|
9
|
+
"amount_paid": 0,
|
10
|
+
"cancelled_at": 0,
|
11
|
+
"created_at": 1602523443,
|
12
|
+
"currency": "INR",
|
13
|
+
"customer": {
|
14
|
+
"contact": "9999999999",
|
15
|
+
"email": "gaurav.kumar@razorpay.com",
|
16
|
+
"name": "Gaurav Kumar"
|
17
|
+
},
|
18
|
+
"description": "Payment for policy no #23456",
|
19
|
+
"expire_by": 0,
|
20
|
+
"expired_at": 0,
|
21
|
+
"first_min_partial_amount": 0,
|
22
|
+
"id": "plink_Fo4T7Ht271epg3",
|
23
|
+
"notes": {
|
24
|
+
"policy_name": "Jeevan Bima"
|
25
|
+
},
|
26
|
+
"notify": {
|
27
|
+
"email": false,
|
28
|
+
"sms": true
|
29
|
+
},
|
30
|
+
"payments": [],
|
31
|
+
"reference_id": "#41956",
|
32
|
+
"reminder_enable": true,
|
33
|
+
"reminders": {
|
34
|
+
"status": "in_progress"
|
35
|
+
},
|
36
|
+
"short_url": "https://rzp.io/i/LXnmFr3a",
|
37
|
+
"status": "created",
|
38
|
+
"updated_at": 1602523443,
|
39
|
+
"upi_link": true,
|
40
|
+
"user_id": ""
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
{
|
2
|
+
"entity": "collection",
|
3
|
+
"count": 2,
|
4
|
+
"items": [
|
5
|
+
{
|
6
|
+
"id": "qr_HO2jGkWReVBMNu",
|
7
|
+
"entity": "qr_code",
|
8
|
+
"created_at": 1623914648,
|
9
|
+
"name": "Store_1",
|
10
|
+
"usage": "single_use",
|
11
|
+
"type": "upi_qr",
|
12
|
+
"image_url": "https://rzp.io/i/w2CEwYmkAu",
|
13
|
+
"payment_amount": 300,
|
14
|
+
"status": "active",
|
15
|
+
"description": "For Store 1",
|
16
|
+
"fixed_amount": true,
|
17
|
+
"payments_amount_received": 0,
|
18
|
+
"payments_count_received": 0,
|
19
|
+
"notes": {
|
20
|
+
"purpose": "Test UPI QR code notes"
|
21
|
+
},
|
22
|
+
"customer_id": "cust_HKsR5se84c5LTO",
|
23
|
+
"close_by": 1681615838,
|
24
|
+
"closed_at": null,
|
25
|
+
"close_reason": null
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"id": "qr_HO2e0813YlchUn",
|
29
|
+
"entity": "qr_code",
|
30
|
+
"created_at": 1623914349,
|
31
|
+
"name": "Acme Groceries",
|
32
|
+
"usage": "multiple_use",
|
33
|
+
"type": "upi_qr",
|
34
|
+
"image_url": "https://rzp.io/i/X6QM7LL",
|
35
|
+
"payment_amount": null,
|
36
|
+
"status": "closed",
|
37
|
+
"description": "Buy fresh groceries",
|
38
|
+
"fixed_amount": false,
|
39
|
+
"payments_amount_received": 200,
|
40
|
+
"payments_count_received": 1,
|
41
|
+
"notes": {
|
42
|
+
"Branch": "Bangalore - Rajaji Nagar"
|
43
|
+
},
|
44
|
+
"customer_id": "cust_HKsR5se84c5LTO",
|
45
|
+
"close_by": 1625077799,
|
46
|
+
"closed_at": 1623914515,
|
47
|
+
"close_reason": "on_demand"
|
48
|
+
}
|
49
|
+
]
|
50
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
{
|
2
|
+
"entity": "collection",
|
3
|
+
"count": 2,
|
4
|
+
"items": [
|
5
|
+
{
|
6
|
+
"id": "pay_HMtDKn3TnF4D8x",
|
7
|
+
"entity": "payment",
|
8
|
+
"amount": 500,
|
9
|
+
"currency": "INR",
|
10
|
+
"status": "captured",
|
11
|
+
"order_id": null,
|
12
|
+
"invoice_id": null,
|
13
|
+
"international": false,
|
14
|
+
"method": "upi",
|
15
|
+
"amount_refunded": 0,
|
16
|
+
"refund_status": null,
|
17
|
+
"captured": true,
|
18
|
+
"description": "QRv2 Payment",
|
19
|
+
"card_id": null,
|
20
|
+
"bank": null,
|
21
|
+
"wallet": null,
|
22
|
+
"vpa": "gauri.kumari@okhdfcbank",
|
23
|
+
"email": "gauri.kumari@example.com",
|
24
|
+
"contact": "+919999999999",
|
25
|
+
"customer_id": "cust_HKsR5se84c5LTO",
|
26
|
+
"notes": [],
|
27
|
+
"fee": 0,
|
28
|
+
"tax": 0,
|
29
|
+
"error_code": null,
|
30
|
+
"error_description": null,
|
31
|
+
"error_source": null,
|
32
|
+
"error_step": null,
|
33
|
+
"error_reason": null,
|
34
|
+
"acquirer_data": {
|
35
|
+
"rrn": "116514257019"
|
36
|
+
},
|
37
|
+
"created_at": 1623662800
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"id": "pay_HMsr242ZnaLumA",
|
41
|
+
"entity": "payment",
|
42
|
+
"amount": 1000,
|
43
|
+
"currency": "INR",
|
44
|
+
"status": "refunded",
|
45
|
+
"order_id": null,
|
46
|
+
"invoice_id": null,
|
47
|
+
"international": false,
|
48
|
+
"method": "upi",
|
49
|
+
"amount_refunded": 1000,
|
50
|
+
"refund_status": "full",
|
51
|
+
"captured": true,
|
52
|
+
"description": "QRv2 Payment",
|
53
|
+
"card_id": null,
|
54
|
+
"bank": null,
|
55
|
+
"wallet": null,
|
56
|
+
"vpa": "gauri.kumari@okhdfcbank",
|
57
|
+
"email": "gauri.kumari@example.com",
|
58
|
+
"contact": "+919999999999",
|
59
|
+
"customer_id": "cust_HKsR5se84c5LTO",
|
60
|
+
"notes": [],
|
61
|
+
"fee": 0,
|
62
|
+
"tax": 0,
|
63
|
+
"error_code": null,
|
64
|
+
"error_description": null,
|
65
|
+
"error_source": null,
|
66
|
+
"error_step": null,
|
67
|
+
"error_reason": null,
|
68
|
+
"acquirer_data": {
|
69
|
+
"rrn": "116514090501"
|
70
|
+
},
|
71
|
+
"created_at": 1623661533
|
72
|
+
}
|
73
|
+
]
|
74
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"entity": "collection",
|
3
|
+
"count": 2,
|
4
|
+
"items": [
|
5
|
+
{
|
6
|
+
"id": "setl_DGlQ1Rj8os78Ec",
|
7
|
+
"entity": "settlement",
|
8
|
+
"amount": 9973635,
|
9
|
+
"status": "processed",
|
10
|
+
"fees": 471699,
|
11
|
+
"tax": 42070,
|
12
|
+
"utr": "1568176960vxp0rj",
|
13
|
+
"created_at": 1568176960
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"id": "setl_4xbSwsPABDJ8oK",
|
17
|
+
"entity": "settlement",
|
18
|
+
"amount": 50000,
|
19
|
+
"status": "processed",
|
20
|
+
"fees": 123,
|
21
|
+
"tax": 12,
|
22
|
+
"utr": "RZRP173069230702",
|
23
|
+
"created_at": 1509622306
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
{
|
2
|
+
"entity": "collection",
|
3
|
+
"count": 2,
|
4
|
+
"items": [
|
5
|
+
{
|
6
|
+
"id": "setlod_FNj7g2YS5J67Rz",
|
7
|
+
"entity": "settlement.ondemand",
|
8
|
+
"amount_requested": 200000,
|
9
|
+
"amount_settled": 199410,
|
10
|
+
"amount_pending": 0,
|
11
|
+
"amount_reversed": 0,
|
12
|
+
"fees": 590,
|
13
|
+
"tax": 90,
|
14
|
+
"currency": "INR",
|
15
|
+
"settle_full_balance": false,
|
16
|
+
"status": "processed",
|
17
|
+
"description": "Need this to make vendor payments.",
|
18
|
+
"notes": {
|
19
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
20
|
+
"notes_key_2": "Tea, Earl Grey… decaf."
|
21
|
+
},
|
22
|
+
"created_at": 1596771429,
|
23
|
+
"ondemand_payouts": {
|
24
|
+
"entity": "collection",
|
25
|
+
"count": 1,
|
26
|
+
"items": [
|
27
|
+
{
|
28
|
+
"id": "setlodp_FNj7g2cbvw8ueO",
|
29
|
+
"entity": "settlement.ondemand_payout",
|
30
|
+
"initiated_at": 1596771430,
|
31
|
+
"processed_at": 1596778752,
|
32
|
+
"reversed_at": null,
|
33
|
+
"amount": 200000,
|
34
|
+
"amount_settled": 199410,
|
35
|
+
"fees": 590,
|
36
|
+
"tax": 90,
|
37
|
+
"utr": "022011173948",
|
38
|
+
"status": "processed",
|
39
|
+
"created_at": 1596771429
|
40
|
+
}
|
41
|
+
]
|
42
|
+
}
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"id": "setlod_FJOp0jOWlalIvt",
|
46
|
+
"entity": "settlement.ondemand",
|
47
|
+
"amount_requested": 300000,
|
48
|
+
"amount_settled": 299114,
|
49
|
+
"amount_pending": 0,
|
50
|
+
"amount_reversed": 0,
|
51
|
+
"fees": 886,
|
52
|
+
"tax": 136,
|
53
|
+
"currency": "INR",
|
54
|
+
"settle_full_balance": false,
|
55
|
+
"status": "processed",
|
56
|
+
"description": "Need this to buy stock.",
|
57
|
+
"notes": {
|
58
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
59
|
+
"notes_key_2": "Tea, Earl Grey… decaf."
|
60
|
+
},
|
61
|
+
"created_at": 1595826576,
|
62
|
+
"ondemand_payouts": {
|
63
|
+
"entity": "collection",
|
64
|
+
"count": 1,
|
65
|
+
"items": [
|
66
|
+
{
|
67
|
+
"id": "setlodp_FJOp0jTqoZdGen",
|
68
|
+
"entity": "settlement.ondemand_payout",
|
69
|
+
"initiated_at": 1595826577,
|
70
|
+
"processed_at": 1595826588,
|
71
|
+
"reversed_at": null,
|
72
|
+
"amount": 300000,
|
73
|
+
"amount_settled": 299114,
|
74
|
+
"fees": 886,
|
75
|
+
"tax": 136,
|
76
|
+
"utr": "020910199316",
|
77
|
+
"status": "processed",
|
78
|
+
"created_at": 1595826576
|
79
|
+
}
|
80
|
+
]
|
81
|
+
}
|
82
|
+
}
|
83
|
+
]
|
84
|
+
}
|
@@ -0,0 +1,117 @@
|
|
1
|
+
{
|
2
|
+
"entity": "collection",
|
3
|
+
"count": 4,
|
4
|
+
"items": [
|
5
|
+
{
|
6
|
+
"entity_id": "pay_DEXrnipqTmWVGE",
|
7
|
+
"type": "payment",
|
8
|
+
"debit": 0,
|
9
|
+
"credit": 97100,
|
10
|
+
"amount": 100000,
|
11
|
+
"currency": "INR",
|
12
|
+
"fee": 2900,
|
13
|
+
"tax": 0,
|
14
|
+
"on_hold": false,
|
15
|
+
"settled": true,
|
16
|
+
"created_at": 1567692556,
|
17
|
+
"settled_at": 1568176960,
|
18
|
+
"settlement_id": "setl_DGlQ1Rj8os78Ec",
|
19
|
+
"posted_at": null,
|
20
|
+
"credit_type": "default",
|
21
|
+
"description": "Recurring Payment via Subscription",
|
22
|
+
"notes": "{}",
|
23
|
+
"payment_id": null,
|
24
|
+
"settlement_utr": "1568176960vxp0rj",
|
25
|
+
"order_id": "order_DEXrnRiR3SNDHA",
|
26
|
+
"order_receipt": null,
|
27
|
+
"method": "card",
|
28
|
+
"card_network": "MasterCard",
|
29
|
+
"card_issuer": "KARB",
|
30
|
+
"card_type": "credit",
|
31
|
+
"dispute_id": null
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"entity_id": "rfnd_DGRcGzZSLyEdg1",
|
35
|
+
"type": "refund",
|
36
|
+
"debit": 242500,
|
37
|
+
"credit": 0,
|
38
|
+
"amount": 242500,
|
39
|
+
"currency": "INR",
|
40
|
+
"fee": 0,
|
41
|
+
"tax": 0,
|
42
|
+
"on_hold": false,
|
43
|
+
"settled": true,
|
44
|
+
"created_at": 1568107224,
|
45
|
+
"settled_at": 1568176960,
|
46
|
+
"settlement_id": "setl_DGlQ1Rj8os78Ec",
|
47
|
+
"posted_at": null,
|
48
|
+
"credit_type": "default",
|
49
|
+
"description": null,
|
50
|
+
"notes": "{}",
|
51
|
+
"payment_id": "pay_DEXq1pACSqFxtS",
|
52
|
+
"settlement_utr": "1568176960vxp0rj",
|
53
|
+
"order_id": "order_DEXpmZgffXNvuI",
|
54
|
+
"order_receipt": null,
|
55
|
+
"method": "card",
|
56
|
+
"card_network": "MasterCard",
|
57
|
+
"card_issuer": "KARB",
|
58
|
+
"card_type": "credit",
|
59
|
+
"dispute_id": null
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"entity_id": "trf_DEUoCEtdsJgvl7",
|
63
|
+
"type": "transfer",
|
64
|
+
"debit": 100296,
|
65
|
+
"credit": 0,
|
66
|
+
"amount": 100000,
|
67
|
+
"currency": "INR",
|
68
|
+
"fee": 296,
|
69
|
+
"tax": 46,
|
70
|
+
"on_hold": false,
|
71
|
+
"settled": true,
|
72
|
+
"created_at": 1567681786,
|
73
|
+
"settled_at": 1568176960,
|
74
|
+
"settlement_id": "setl_DGlQ1Rj8os78Ec",
|
75
|
+
"posted_at": null,
|
76
|
+
"credit_type": "default",
|
77
|
+
"description": null,
|
78
|
+
"notes": null,
|
79
|
+
"payment_id": "pay_DEApNNTR6xmqJy",
|
80
|
+
"settlement_utr": "1568176960vxp0rj",
|
81
|
+
"order_id": null,
|
82
|
+
"order_receipt": null,
|
83
|
+
"method": null,
|
84
|
+
"card_network": null,
|
85
|
+
"card_issuer": null,
|
86
|
+
"card_type": null,
|
87
|
+
"dispute_id": null
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"entity_id": "adj_EhcHONhX4ChgNC",
|
91
|
+
"type": "adjustment",
|
92
|
+
"debit": 0,
|
93
|
+
"credit": 1012,
|
94
|
+
"amount": 1012,
|
95
|
+
"currency": "INR",
|
96
|
+
"fee": 0,
|
97
|
+
"tax": 0,
|
98
|
+
"on_hold": false,
|
99
|
+
"settled": true,
|
100
|
+
"created_at": 1567681786,
|
101
|
+
"settled_at": 1568176960,
|
102
|
+
"settlement_id": "setl_DGlQ1Rj8os78Ec",
|
103
|
+
"posted_at": null,
|
104
|
+
"description": "test reason",
|
105
|
+
"notes": null,
|
106
|
+
"payment_id": null,
|
107
|
+
"settlement_utr": null,
|
108
|
+
"order_id": null,
|
109
|
+
"order_receipt": null,
|
110
|
+
"method": null,
|
111
|
+
"card_network": null,
|
112
|
+
"card_issuer": null,
|
113
|
+
"card_type": null,
|
114
|
+
"dispute_id": null
|
115
|
+
}
|
116
|
+
]
|
117
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"entity": "collection",
|
3
|
+
"count": 1,
|
4
|
+
"items": [
|
5
|
+
{
|
6
|
+
"id": "token_Ip8u7q7FA77Q30",
|
7
|
+
"entity": "token",
|
8
|
+
"token": "BZpWWtYHnSJfoi",
|
9
|
+
"bank": "HDFC",
|
10
|
+
"wallet": null,
|
11
|
+
"method": "emandate",
|
12
|
+
"vpa": null,
|
13
|
+
"recurring": true,
|
14
|
+
"recurring_details": {
|
15
|
+
"status": "confirmed",
|
16
|
+
"failure_reason": null
|
17
|
+
},
|
18
|
+
"auth_type": "debitcard",
|
19
|
+
"mrn": null,
|
20
|
+
"used_at": 1647012394,
|
21
|
+
"created_at": 1643368664,
|
22
|
+
"bank_details": {
|
23
|
+
"beneficiary_name": "Gaurav Kumar",
|
24
|
+
"account_number": "11214311215411",
|
25
|
+
"ifsc": "HDFC0001233",
|
26
|
+
"account_type": "savings"
|
27
|
+
},
|
28
|
+
"max_amount": 50000,
|
29
|
+
"expired_at": 2147483647,
|
30
|
+
"notes": [
|
31
|
+
|
32
|
+
],
|
33
|
+
"dcc_enabled": false
|
34
|
+
}
|
35
|
+
]
|
36
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
{
|
2
|
+
"entity":"collection",
|
3
|
+
"count":1,
|
4
|
+
"items":[
|
5
|
+
{
|
6
|
+
"id":"trf_DGSTeXzBkEVh48",
|
7
|
+
"entity":"transfer",
|
8
|
+
"transfer_status":"processed",
|
9
|
+
"settlement_status":null,
|
10
|
+
"source":"pay_DGSRhvMbOqeCe7",
|
11
|
+
"recipient":"acc_CMaomTz4o0FOFz",
|
12
|
+
"amount":500,
|
13
|
+
"currency":"INR",
|
14
|
+
"amount_reversed":0,
|
15
|
+
"notes":[
|
16
|
+
|
17
|
+
],
|
18
|
+
"fees":2,
|
19
|
+
"tax":0,
|
20
|
+
"on_hold":false,
|
21
|
+
"on_hold_until":null,
|
22
|
+
"recipient_settlement_id":"setl_DHYJ3dRPqQkAgV",
|
23
|
+
"created_at":1568110256,
|
24
|
+
"linked_account_notes":[
|
25
|
+
|
26
|
+
],
|
27
|
+
"processed_at":1568110297,
|
28
|
+
"error":{
|
29
|
+
"code":null,
|
30
|
+
"description":null,
|
31
|
+
"field":null,
|
32
|
+
"source":null,
|
33
|
+
"step":null,
|
34
|
+
"reason":null
|
35
|
+
}
|
36
|
+
}
|
37
|
+
]
|
38
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"entity": "collection",
|
3
|
+
"count": 1,
|
4
|
+
"items": [
|
5
|
+
{
|
6
|
+
"id": "trf_J0FrZYPql4riDx",
|
7
|
+
"entity": "transfer",
|
8
|
+
"status": "processed",
|
9
|
+
"source": "pay_I6i1edcUUytu9p",
|
10
|
+
"recipient": "acc_I0QRP7PpvaHhpB",
|
11
|
+
"amount": 100,
|
12
|
+
"currency": "INR",
|
13
|
+
"amount_reversed": 0,
|
14
|
+
"fees": 1,
|
15
|
+
"tax": 0,
|
16
|
+
"notes": {
|
17
|
+
"name": "Saurav Kumar",
|
18
|
+
"roll_no": "IEC2011026"
|
19
|
+
},
|
20
|
+
"linked_account_notes": [
|
21
|
+
"roll_no"
|
22
|
+
],
|
23
|
+
"on_hold": true,
|
24
|
+
"on_hold_until": null,
|
25
|
+
"settlement_status": "on_hold",
|
26
|
+
"recipient_settlement_id": null,
|
27
|
+
"created_at": 1645794911,
|
28
|
+
"processed_at": 1645794911,
|
29
|
+
"error": {
|
30
|
+
"code": null,
|
31
|
+
"description": null,
|
32
|
+
"reason": null,
|
33
|
+
"field": null,
|
34
|
+
"step": null,
|
35
|
+
"id": "trf_J0FrZYPql4riDx",
|
36
|
+
"source": null,
|
37
|
+
"metadata": null
|
38
|
+
}
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|
data/test/razorpay/test_addon.rb
CHANGED
@@ -6,8 +6,8 @@ module Razorpay
|
|
6
6
|
class Item < Razorpay::Entity; end
|
7
7
|
|
8
8
|
def setup
|
9
|
-
@subscription_id = '
|
10
|
-
@addon_id = '
|
9
|
+
@subscription_id = 'sub_00000000000001'
|
10
|
+
@addon_id = 'ao_IrSY3UIqDRx7df'
|
11
11
|
|
12
12
|
# Any request that ends with addons/addon_id
|
13
13
|
stub_get(%r{addons\/#{Regexp.quote(@addon_id)}$}, 'fake_addon')
|
@@ -22,12 +22,19 @@ module Razorpay
|
|
22
22
|
assert_instance_of Razorpay::Addon, addon, 'Addon not an instance of Addon class'
|
23
23
|
assert_equal @addon_id, addon.id, 'Addon IDs do not match'
|
24
24
|
assert_equal 1, addon.quantity, 'Addon quantity is accessible'
|
25
|
-
assert_equal
|
25
|
+
assert_equal @subscription_id, addon.subscription_id, 'Addon subscription_id is accessible'
|
26
26
|
assert_nil addon.invoice_id, 'Addon invoice_id is accessible'
|
27
27
|
|
28
28
|
assert_addon_item_details(addon)
|
29
29
|
end
|
30
30
|
|
31
|
+
def test_fetch_all_addon
|
32
|
+
stub_get(/addons$/, 'addon_collection')
|
33
|
+
addons = Razorpay::Addon.all
|
34
|
+
assert_instance_of Razorpay::Collection, addons, 'Addons should be an array'
|
35
|
+
refute_empty addons.items, 'Addon should be more than one'
|
36
|
+
end
|
37
|
+
|
31
38
|
def test_add_addons_to_subscription
|
32
39
|
addon_attrs = {
|
33
40
|
item: {
|
@@ -37,14 +44,14 @@ module Razorpay
|
|
37
44
|
quantity: 1
|
38
45
|
}
|
39
46
|
|
40
|
-
stub_post(%r{subscriptions\/#{@subscription_id}\/addons$}, 'fake_addon',
|
47
|
+
stub_post(%r{subscriptions\/#{@subscription_id}\/addons$}, 'fake_addon', addon_attrs.to_json)
|
41
48
|
|
42
|
-
addon = Razorpay::Addon.create(@subscription_id, addon_attrs)
|
49
|
+
addon = Razorpay::Addon.create(@subscription_id, addon_attrs.to_json)
|
43
50
|
assert_instance_of Razorpay::Addon, addon, 'Addon not an instance of Addon class'
|
44
51
|
|
45
|
-
assert_equal
|
52
|
+
assert_equal @addon_id, addon.id, 'Addon IDs do not match'
|
46
53
|
assert_equal 1, addon.quantity, 'Addon quantity is accessible'
|
47
|
-
assert_equal
|
54
|
+
assert_equal @subscription_id, addon.subscription_id, 'Addon subscription_id is accessible'
|
48
55
|
assert_nil addon.invoice_id, 'Addon invoice_id is accessible'
|
49
56
|
|
50
57
|
assert_addon_item_details(addon)
|
@@ -55,18 +62,11 @@ module Razorpay
|
|
55
62
|
def assert_addon_item_details(addon)
|
56
63
|
addon_item = Item.new(addon.item)
|
57
64
|
|
58
|
-
assert_equal '
|
65
|
+
assert_equal 'item_00000000000001', addon_item.id, 'Addon Item id is accessible'
|
59
66
|
assert_equal 'fake_item_name', addon_item.name, 'Addon Item name is accessible'
|
60
67
|
assert_equal 'fake_item_description', addon_item.description, 'Addon Item description is accessible'
|
61
68
|
assert_equal 'INR', addon_item.currency, 'Addon Item currency is accessible'
|
62
69
|
assert_equal 500, addon_item.amount, 'Addon Item amount is accessible'
|
63
70
|
end
|
64
|
-
|
65
|
-
def create_addon_stub_url_params
|
66
|
-
%w(
|
67
|
-
item[name]=fake_addon_name&item[currency]=INR&item[amount]=5000&
|
68
|
-
item[description]=fake_addon_description&quantity=1
|
69
|
-
).join
|
70
|
-
end
|
71
71
|
end
|
72
72
|
end
|
@@ -5,10 +5,9 @@ module Razorpay
|
|
5
5
|
class RazorpayCustomerTest < Minitest::Test
|
6
6
|
def setup
|
7
7
|
@customer_id = 'cust_6vRXClWqnLhV14'
|
8
|
-
|
8
|
+
@token_id = "token_FHfn3rIiM1Z8nr"
|
9
9
|
# Any request that ends with customers/customer_id
|
10
10
|
stub_get(%r{customers/#{@customer_id}$}, 'fake_customer')
|
11
|
-
stub_get(/customers$/, 'customer_collection')
|
12
11
|
end
|
13
12
|
|
14
13
|
def test_customer_should_be_defined
|
@@ -32,14 +31,39 @@ module Razorpay
|
|
32
31
|
end
|
33
32
|
|
34
33
|
def test_fetch_all_customers
|
34
|
+
stub_get(/customers$/, 'customer_collection')
|
35
35
|
customers = Razorpay::Customer.all
|
36
36
|
assert_instance_of Razorpay::Collection, customers
|
37
37
|
end
|
38
38
|
|
39
39
|
def test_fetch_specific_customer
|
40
|
+
stub_get(%r{customers/#{@customer_id}$}, 'fake_customer')
|
40
41
|
customer = Razorpay::Customer.fetch(@customer_id)
|
41
42
|
assert_instance_of Razorpay::Customer, customer
|
42
|
-
assert_equal
|
43
|
+
assert_equal "test@razorpay.com", customer.email
|
44
|
+
end
|
45
|
+
|
46
|
+
# def test_customer_fetch_tokens
|
47
|
+
# stub_get(%r{customers/#{@customer_id}$}, 'fake_customer')
|
48
|
+
# stub_get(%r{customers/cust_6vRXClWqnLhV14/tokens$}, 'tokens_collection')
|
49
|
+
# tokens = Razorpay::Customer.fetch(@customer_id).fetchTokens
|
50
|
+
# assert_instance_of Razorpay::Collection, tokens, 'Tokens should be an array'
|
51
|
+
# refute_empty tokens.items, 'tokens should be more than one'
|
52
|
+
# end
|
53
|
+
|
54
|
+
def test_customer_fetch_token
|
55
|
+
stub_get(%r{customers/#{@customer_id}$}, 'fake_customer')
|
56
|
+
stub_get(%r{customers/cust_6vRXClWqnLhV14/tokens/token_FHfn3rIiM1Z8nr$}, 'fake_token')
|
57
|
+
token = Razorpay::Customer.fetch(@customer_id).fetchToken("token_FHfn3rIiM1Z8nr")
|
58
|
+
assert_instance_of Razorpay::Entity, token, 'Token not an instance of Razorpay::Entity class'
|
59
|
+
assert_equal "token_FHfn3rIiM1Z8nr", token.id
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_customer_delete_token
|
63
|
+
stub_get(%r{customers/#{@customer_id}$}, 'fake_customer')
|
64
|
+
stub_delete(%r{customers/cust_6vRXClWqnLhV14/tokens/token_FHfn3rIiM1Z8nr$}, 'delete_token')
|
65
|
+
token = Razorpay::Customer.fetch(@customer_id).deleteToken("token_FHfn3rIiM1Z8nr")
|
66
|
+
assert token.deleted
|
43
67
|
end
|
44
68
|
end
|
45
69
|
end
|