razorpay 3.0.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +2 -2
  3. data/CHANGELOG.md +17 -0
  4. data/README.md +6 -0
  5. data/documents/account.md +449 -0
  6. data/documents/card.md +45 -0
  7. data/documents/generic.md +150 -0
  8. data/documents/payment.md +44 -1
  9. data/documents/productConfiguration.md +444 -0
  10. data/documents/stakeholder.md +334 -0
  11. data/documents/tokens.md +146 -1
  12. data/documents/webhook.md +224 -0
  13. data/lib/razorpay/account.rb +39 -0
  14. data/lib/razorpay/addon.rb +1 -1
  15. data/lib/razorpay/card.rb +4 -0
  16. data/lib/razorpay/constants.rb +28 -2
  17. data/lib/razorpay/generic.rb +39 -0
  18. data/lib/razorpay/iin.rb +15 -0
  19. data/lib/razorpay/order.rb +1 -1
  20. data/lib/razorpay/product.rb +37 -0
  21. data/lib/razorpay/request.rb +22 -16
  22. data/lib/razorpay/stakeholder.rb +39 -0
  23. data/lib/razorpay/token.rb +28 -0
  24. data/lib/razorpay/virtual_account.rb +1 -1
  25. data/lib/razorpay/webhook.rb +50 -0
  26. data/lib/razorpay.rb +7 -0
  27. data/test/fixtures/fake_account.json +78 -0
  28. data/test/fixtures/fake_card_reference.json +5 -0
  29. data/test/fixtures/fake_iin_token.json +23 -0
  30. data/test/fixtures/fake_product.json +138 -0
  31. data/test/fixtures/fake_stakeholder.json +29 -0
  32. data/test/fixtures/fake_tokenise_customer.json +40 -0
  33. data/test/fixtures/fake_webhook.json +79 -0
  34. data/test/fixtures/fake_webhook_by_account_id.json +22 -0
  35. data/test/fixtures/fetch_tnc.json +11 -0
  36. data/test/fixtures/stakeholder_collection.json +35 -0
  37. data/test/fixtures/webhook_by_account_collection.json +35 -0
  38. data/test/fixtures/webhook_collection.json +85 -0
  39. data/test/razorpay/test_account.rb +134 -0
  40. data/test/razorpay/test_card.rb +6 -0
  41. data/test/razorpay/test_customer.rb +8 -8
  42. data/test/razorpay/test_generic.rb +112 -0
  43. data/test/razorpay/test_iin.rb +23 -0
  44. data/test/razorpay/test_order.rb +1 -1
  45. data/test/razorpay/test_product.rb +67 -0
  46. data/test/razorpay/test_settlement.rb +1 -1
  47. data/test/razorpay/test_stakeholder.rb +87 -0
  48. data/test/razorpay/test_token.rb +66 -0
  49. data/test/razorpay/test_transfer.rb +1 -1
  50. data/test/razorpay/test_webhook.rb +132 -0
  51. metadata +52 -2
@@ -0,0 +1,78 @@
1
+ {
2
+ "id": "acc_00000000000001",
3
+ "type": "standard",
4
+ "status": "created",
5
+ "email": "gauriagain.kumar@example.org",
6
+ "profile": {
7
+ "category": "healthcare",
8
+ "subcategory": "clinic",
9
+ "addresses": {
10
+ "registered": {
11
+ "street1": "507, Koramangala 1st block",
12
+ "street2": "MG Road",
13
+ "city": "Bengaluru",
14
+ "state": "KARNATAKA",
15
+ "postal_code": 560034,
16
+ "country": "IN"
17
+ },
18
+ "operation": {
19
+ "street1": "507, Koramangala 6th block",
20
+ "street2": "Kormanagalo",
21
+ "city": "Bengaluru",
22
+ "state": "KARNATAKA",
23
+ "country": "IN",
24
+ "postal_code": 560047
25
+ }
26
+ },
27
+ "business_model": "Online Clothing ( men, women, ethnic, modern ) fashion and lifestyle, accessories, t-shirt, shirt, track pant, shoes."
28
+ },
29
+ "notes": {
30
+ "internal_ref_id": "123123"
31
+ },
32
+ "created_at": 1611136837,
33
+ "phone": "9000090000",
34
+ "business_type": "partnership",
35
+ "legal_business_name": "Acme Corp",
36
+ "customer_facing_business_name": "Example",
37
+ "legal_info": {
38
+ "pan": "AAACL1234C",
39
+ "gst": "18AABCU9603R1ZM"
40
+ },
41
+ "apps": {
42
+ "websites": [
43
+ "https://www.example.org"
44
+ ],
45
+ "android": [
46
+ {
47
+ "url": "playstore.example.org",
48
+ "name": "Example"
49
+ }
50
+ ],
51
+ "ios": [
52
+ {
53
+ "url": "appstore.example.org",
54
+ "name": "Example"
55
+ }
56
+ ]
57
+ },
58
+ "brand": {
59
+ "color": "#FFFFFF"
60
+ },
61
+ "contact_info": {
62
+ "chargeback": {
63
+ "email": "cb@example.org",
64
+ "phone": null,
65
+ "policy_url": null
66
+ },
67
+ "refund": {
68
+ "email": "cb@example.org",
69
+ "phone": null,
70
+ "policy_url": null
71
+ },
72
+ "support": {
73
+ "email": "support@example.org",
74
+ "phone": "9999999998",
75
+ "policy_url": "https://www.google.com"
76
+ }
77
+ }
78
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "network":"Visa",
3
+ "network_reference_id":null,
4
+ "payment_account_reference":"V0010014620077202123799870069"
5
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "iin": "411111",
3
+ "entity": "iin",
4
+ "network": "Visa",
5
+ "type": "credit",
6
+ "sub_type": "consumer",
7
+ "card_iin": "null",
8
+ "issuer_code": "unknown",
9
+ "issuer_name": "unknown",
10
+ "international": true,
11
+ "tokenised": false,
12
+ "emi": {
13
+ "available": false
14
+ },
15
+ "recurring": {
16
+ "available": true
17
+ },
18
+ "authentication_types": [
19
+ {
20
+ "type": "3ds"
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,138 @@
1
+ {
2
+ "requested_configuration": {
3
+ "payment_methods": []
4
+ },
5
+ "active_configuration": {
6
+ "payment_capture": {
7
+ "mode": "automatic",
8
+ "refund_speed": "normal",
9
+ "automatic_expiry_period": 7200
10
+ },
11
+ "settlements": {
12
+ "account_number": null,
13
+ "ifsc_code": null,
14
+ "beneficiary_name": null
15
+ },
16
+ "checkout": {
17
+ "theme_color": "#FFFFFF",
18
+ "flash_checkout": true
19
+ },
20
+ "refund": {
21
+ "default_refund_speed": "normal"
22
+ },
23
+ "notifications": {
24
+ "whatsapp": true,
25
+ "sms": false,
26
+ "email": [
27
+ "b963e252-1201-45b0-9c39-c53eceb0cfd6_load@gmail.com"
28
+ ]
29
+ },
30
+ "payment_methods": {
31
+ "netbanking": {
32
+ "enabled": true,
33
+ "instrument": [
34
+ {
35
+ "type": "retail",
36
+ "bank": [
37
+ "hdfc",
38
+ "sbin",
39
+ "utib",
40
+ "icic",
41
+ "scbl",
42
+ "yesb"
43
+ ]
44
+ }
45
+ ]
46
+ },
47
+ "wallet": {
48
+ "enabled": true,
49
+ "instrument": [
50
+ "airtelmoney",
51
+ "freecharge",
52
+ "jiomoney",
53
+ "olamoney",
54
+ "payzapp",
55
+ "mobikwik"
56
+ ]
57
+ },
58
+ "upi": {
59
+ "enabled": true,
60
+ "instrument": [
61
+ "upi"
62
+ ]
63
+ }
64
+ }
65
+ },
66
+ "requirements": [
67
+ {
68
+ "field_reference": "individual_proof_of_address",
69
+ "resolution_url": "/accounts/acc_prd_00000000000001/stakeholders/{stakeholderId}/documents",
70
+ "status": "required",
71
+ "reason_code": "document_missing"
72
+ },
73
+ {
74
+ "field_reference": "individual_proof_of_identification",
75
+ "resolution_url": "/accounts/acc_prd_00000000000001/stakeholders/{stakeholderId}/documents",
76
+ "status": "required",
77
+ "reason_code": "document_missing"
78
+ },
79
+ {
80
+ "field_reference": "business_proof_of_identification",
81
+ "resolution_url": "/accounts/acc_prd_00000000000001/documents",
82
+ "status": "required",
83
+ "reason_code": "document_missing"
84
+ },
85
+ {
86
+ "field_reference": "settlements.beneficiary_name",
87
+ "resolution_url": "/accounts/acc_prd_00000000000001/products/acc_prd_HEgNpywUFctQ9e",
88
+ "status": "required",
89
+ "reason_code": "field_missing"
90
+ },
91
+ {
92
+ "field_reference": "settlements.account_number",
93
+ "resolution_url": "/accounts/acc_prd_00000000000001/products/acc_prd_HEgNpywUFctQ9e",
94
+ "status": "required",
95
+ "reason_code": "field_missing"
96
+ },
97
+ {
98
+ "field_reference": "settlements.ifsc_code",
99
+ "resolution_url": "/accounts/acc_prd_00000000000001/products/acc_prd_HEgNpywUFctQ9e",
100
+ "status": "required",
101
+ "reason_code": "field_missing"
102
+ },
103
+ {
104
+ "field_reference": "contact_name",
105
+ "resolution_url": "/accounts/acc_prd_00000000000001",
106
+ "status": "required",
107
+ "reason_code": "field_missing"
108
+ },
109
+ {
110
+ "field_reference": "name",
111
+ "resolution_url": "/accounts/acc_prd_00000000000001/stakeholders",
112
+ "status": "required",
113
+ "reason_code": "field_missing"
114
+ },
115
+ {
116
+ "field_reference": "customer_facing_business_name",
117
+ "resolution_url": "/accounts/acc_prd_00000000000001",
118
+ "status": "required",
119
+ "reason_code": "field_missing"
120
+ },
121
+ {
122
+ "field_reference": "kyc.pan",
123
+ "resolution_url": "/accounts/acc_prd_00000000000001/stakeholders",
124
+ "status": "required",
125
+ "reason_code": "field_missing"
126
+ }
127
+ ],
128
+ "tnc": {
129
+ "id": "tnc_00000000000001",
130
+ "accepted": true,
131
+ "accepted_at": 1641550798
132
+ },
133
+ "id": "acc_prd_00000000000001",
134
+ "account_id": "acc_00000000000001",
135
+ "product_name": "payment_gateway",
136
+ "activation_status": "needs_clarification",
137
+ "requested_at": 1625478849
138
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "entity": "stakeholder",
3
+ "relationship": {
4
+ "director": true
5
+ },
6
+ "phone": {
7
+ "primary": "9000090000",
8
+ "secondary": "9000090000"
9
+ },
10
+ "notes": {
11
+ "random_key_by_partner": "random_value"
12
+ },
13
+ "kyc": {
14
+ "pan": "AVOPB1111K"
15
+ },
16
+ "id": "sth_00000000000001",
17
+ "name": "Gaurav Kumar",
18
+ "email": "gaurav.kumar@example.com",
19
+ "percentage_ownership": 10,
20
+ "addresses": {
21
+ "residential": {
22
+ "street": "506, Koramangala 1st block",
23
+ "city": "Bengaluru",
24
+ "state": "Karnataka",
25
+ "postal_code": "560034",
26
+ "country": "IN"
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "id": "token_00000000000001",
3
+ "entity": "token",
4
+ "customer_id": "cust_1Aa00000000001",
5
+ "method": "card",
6
+ "card": {
7
+ "last4": "1111",
8
+ "network": "Visa",
9
+ "type": "debit",
10
+ "issuer": "HDFC",
11
+ "international": false,
12
+ "emi": true,
13
+ "sub_type": "consumer",
14
+ "token_iin": "453335"
15
+ },
16
+ "compliant_with_tokenisation_guidelines": true,
17
+ "service_provider_tokens": [
18
+ {
19
+ "id": "spt_1234abcd",
20
+ "entity": "service_provider_token",
21
+ "provider_type": "network",
22
+ "provider_name": "Visa",
23
+ "interoperable": true,
24
+ "status": "active",
25
+ "status_reason": null,
26
+ "provider_data": {
27
+ "token_reference_number": "sas7wqaoidasdfssdjjk",
28
+ "payment_account_reference": "8324ssdas7wqaoidassdjjk",
29
+ "token_iin": "453335",
30
+ "token_expiry_month": 12,
31
+ "token_expiry_year": 2030
32
+ }
33
+ }
34
+ ],
35
+ "expired_at": 1748716199,
36
+ "status": "active",
37
+ "status_reason": null,
38
+ "notes": []
39
+ }
40
+
@@ -0,0 +1,79 @@
1
+ {
2
+ "id": "H000000000000H",
3
+ "created_at": 1665648343,
4
+ "updated_at": 1695729722,
5
+ "service": "api-test",
6
+ "owner_id": "S000000000000H",
7
+ "owner_type": "merchant",
8
+ "disabled_at": 1665736246,
9
+ "url": "https://www.linkedin.com",
10
+ "created_by": "Hn1ukgebfkBJ4L",
11
+ "secret_exists": true,
12
+ "created_by_email": "gaurav.kumar@example.com",
13
+ "entity": "webhook",
14
+ "active": true,
15
+ "events": {
16
+ "payment.authorized": false,
17
+ "payment.failed": false,
18
+ "payment.captured": false,
19
+ "payment.dispute.created": false,
20
+ "order.paid": false,
21
+ "invoice.paid": false,
22
+ "invoice.partially_paid": false,
23
+ "invoice.expired": false,
24
+ "subscription.authenticated": false,
25
+ "subscription.paused": false,
26
+ "subscription.resumed": false,
27
+ "subscription.activated": false,
28
+ "subscription.pending": false,
29
+ "subscription.halted": false,
30
+ "subscription.charged": false,
31
+ "subscription.cancelled": false,
32
+ "subscription.completed": false,
33
+ "subscription.updated": false,
34
+ "settlement.processed": false,
35
+ "virtual_account.credited": false,
36
+ "virtual_account.created": false,
37
+ "virtual_account.closed": false,
38
+ "qr_code.closed": false,
39
+ "qr_code.created": false,
40
+ "qr_code.credited": false,
41
+ "payment.dispute.won": false,
42
+ "payment.dispute.lost": false,
43
+ "payment.dispute.closed": false,
44
+ "payment.dispute.under_review": false,
45
+ "payment.dispute.action_required": false,
46
+ "fund_account.validation.completed": false,
47
+ "fund_account.validation.failed": false,
48
+ "payout.processed": false,
49
+ "payout.reversed": false,
50
+ "payment.downtime.started": false,
51
+ "payment.downtime.updated": false,
52
+ "payment.downtime.resolved": false,
53
+ "payout.initiated": false,
54
+ "refund.speed_changed": false,
55
+ "refund.processed": false,
56
+ "refund.failed": false,
57
+ "refund.created": true,
58
+ "transfer.processed": false,
59
+ "transfer.failed": false,
60
+ "account.under_review": false,
61
+ "account.needs_clarification": false,
62
+ "account.activated": false,
63
+ "account.rejected": false,
64
+ "account.updated": false,
65
+ "payout.updated": false,
66
+ "payout.rejected": false,
67
+ "payout.pending": false,
68
+ "payment_link.paid": false,
69
+ "payment_link.partially_paid": false,
70
+ "payment_link.expired": false,
71
+ "payment_link.cancelled": false,
72
+ "zapier.payment_page.paid.v1": false,
73
+ "shiprocket.payment_page.paid.v1": false,
74
+ "product.route.under_review": false,
75
+ "product.route.activated": false,
76
+ "product.route.needs_clarification": false,
77
+ "product.route.rejected": false
78
+ }
79
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "id": "H000000000000H",
3
+ "created_at": 1654605478,
4
+ "updated_at": 1654605478,
5
+ "owner_id": "JOGUdtKu3dB03d",
6
+ "owner_type": "merchant",
7
+ "context": [],
8
+ "disabled_at": 0,
9
+ "url": "https://google.com",
10
+ "alert_email": "gaurav.kumar@example.com",
11
+ "secret_exists": true,
12
+ "entity": "webhook",
13
+ "active": true,
14
+ "events": [
15
+ "payment.authorized",
16
+ "payment.failed",
17
+ "payment.captured",
18
+ "payment.dispute.created",
19
+ "refund.failed",
20
+ "refund.created"
21
+ ]
22
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "entity": "tnc_map",
3
+ "product_name": "payments",
4
+ "id": "tnc_map_00000000000001",
5
+ "tnc": {
6
+ "terms": "https://razorpay.com/terms",
7
+ "privacy": "https://razorpay.com/privacy",
8
+ "agreement": "https://razorpay.com/agreement"
9
+ },
10
+ "last_published_at": 1640589653
11
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "entity": "collection",
3
+ "items": [
4
+ {
5
+ "id": "GZ13yPHLJof9IE",
6
+ "entity": "stakeholder",
7
+ "relationship": {
8
+ "director": true
9
+ },
10
+ "phone": {
11
+ "primary": "9000090000",
12
+ "secondary": "9000090000"
13
+ },
14
+ "notes": {
15
+ "random_key_by_partner": "random_value"
16
+ },
17
+ "kyc": {
18
+ "pan": "AVOPB1111K"
19
+ },
20
+ "name": "Gaurav Kumar",
21
+ "email": "gaurav.kumar@acme.org",
22
+ "percentage_ownership": 10,
23
+ "addresses": {
24
+ "residential": {
25
+ "street": "506, Koramangala 1st block",
26
+ "city": "Bengaluru",
27
+ "state": "Karnataka",
28
+ "postal_code": "560034",
29
+ "country": "in"
30
+ }
31
+ }
32
+ }
33
+ ],
34
+ "count": 1
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "entity": "collection",
3
+ "items": [
4
+ {
5
+ "id": "GZ13yPHLJof9IE",
6
+ "entity": "stakeholder",
7
+ "relationship": {
8
+ "director": true
9
+ },
10
+ "phone": {
11
+ "primary": "9000090000",
12
+ "secondary": "9000090000"
13
+ },
14
+ "notes": {
15
+ "random_key_by_partner": "random_value"
16
+ },
17
+ "kyc": {
18
+ "pan": "AVOPB1111K"
19
+ },
20
+ "name": "Gaurav Kumar",
21
+ "email": "gaurav.kumar@acme.org",
22
+ "percentage_ownership": 10,
23
+ "addresses": {
24
+ "residential": {
25
+ "street": "506, Koramangala 1st block",
26
+ "city": "Bengaluru",
27
+ "state": "Karnataka",
28
+ "postal_code": "560034",
29
+ "country": "in"
30
+ }
31
+ }
32
+ }
33
+ ],
34
+ "count": 1
35
+ }
@@ -0,0 +1,85 @@
1
+ {
2
+ "entity": "collection",
3
+ "count": 1,
4
+ "items": [
5
+ {
6
+ "id": "KTBSNfvnYlcKnH",
7
+ "created_at": 1665648343,
8
+ "updated_at": 1695729722,
9
+ "service": "api-test",
10
+ "owner_id": "Hn1ukn2d32Fqww",
11
+ "owner_type": "merchant",
12
+ "disabled_at": 1665736246,
13
+ "url": "https://www.linkedin.com",
14
+ "created_by": "Hn1ukgebfkBJ4L",
15
+ "secret_exists": true,
16
+ "created_by_email": "ankit.das@razorpay.com",
17
+ "entity": "webhook",
18
+ "active": true,
19
+ "events": {
20
+ "payment.authorized": false,
21
+ "payment.failed": false,
22
+ "payment.captured": false,
23
+ "payment.dispute.created": false,
24
+ "order.paid": false,
25
+ "invoice.paid": false,
26
+ "invoice.partially_paid": false,
27
+ "invoice.expired": false,
28
+ "subscription.authenticated": false,
29
+ "subscription.paused": false,
30
+ "subscription.resumed": false,
31
+ "subscription.activated": false,
32
+ "subscription.pending": false,
33
+ "subscription.halted": false,
34
+ "subscription.charged": false,
35
+ "subscription.cancelled": false,
36
+ "subscription.completed": false,
37
+ "subscription.updated": false,
38
+ "settlement.processed": false,
39
+ "virtual_account.credited": false,
40
+ "virtual_account.created": false,
41
+ "virtual_account.closed": false,
42
+ "qr_code.closed": false,
43
+ "qr_code.created": false,
44
+ "qr_code.credited": false,
45
+ "payment.dispute.won": false,
46
+ "payment.dispute.lost": false,
47
+ "payment.dispute.closed": false,
48
+ "payment.dispute.under_review": false,
49
+ "payment.dispute.action_required": false,
50
+ "fund_account.validation.completed": false,
51
+ "fund_account.validation.failed": false,
52
+ "payout.processed": false,
53
+ "payout.reversed": false,
54
+ "payment.downtime.started": false,
55
+ "payment.downtime.updated": false,
56
+ "payment.downtime.resolved": false,
57
+ "payout.initiated": false,
58
+ "refund.speed_changed": false,
59
+ "refund.processed": false,
60
+ "refund.failed": false,
61
+ "refund.created": true,
62
+ "transfer.processed": false,
63
+ "transfer.failed": false,
64
+ "account.under_review": false,
65
+ "account.needs_clarification": false,
66
+ "account.activated": false,
67
+ "account.rejected": false,
68
+ "account.updated": false,
69
+ "payout.updated": false,
70
+ "payout.rejected": false,
71
+ "payout.pending": false,
72
+ "payment_link.paid": false,
73
+ "payment_link.partially_paid": false,
74
+ "payment_link.expired": false,
75
+ "payment_link.cancelled": false,
76
+ "zapier.payment_page.paid.v1": false,
77
+ "shiprocket.payment_page.paid.v1": false,
78
+ "product.route.under_review": false,
79
+ "product.route.activated": false,
80
+ "product.route.needs_clarification": false,
81
+ "product.route.rejected": false
82
+ }
83
+ }
84
+ ]
85
+ }