razorpay 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +2 -2
- data/CHANGELOG.md +13 -0
- data/README.md +4 -0
- data/documents/account.md +449 -0
- data/documents/card.md +45 -0
- data/documents/payment.md +44 -1
- data/documents/productConfiguration.md +444 -0
- data/documents/stakeholder.md +334 -0
- data/documents/tokens.md +146 -1
- data/documents/webhook.md +224 -0
- data/lib/razorpay/account.rb +39 -0
- data/lib/razorpay/addon.rb +1 -1
- data/lib/razorpay/card.rb +4 -0
- data/lib/razorpay/constants.rb +2 -2
- data/lib/razorpay/iin.rb +15 -0
- data/lib/razorpay/order.rb +1 -1
- data/lib/razorpay/product.rb +37 -0
- data/lib/razorpay/request.rb +16 -16
- data/lib/razorpay/stakeholder.rb +39 -0
- data/lib/razorpay/token.rb +28 -0
- data/lib/razorpay/virtual_account.rb +1 -1
- data/lib/razorpay/webhook.rb +50 -0
- data/lib/razorpay.rb +6 -0
- data/test/fixtures/fake_account.json +78 -0
- data/test/fixtures/fake_card_reference.json +5 -0
- data/test/fixtures/fake_iin_token.json +23 -0
- data/test/fixtures/fake_product.json +138 -0
- data/test/fixtures/fake_stakeholder.json +29 -0
- data/test/fixtures/fake_tokenise_customer.json +40 -0
- data/test/fixtures/fake_webhook.json +79 -0
- data/test/fixtures/fake_webhook_by_account_id.json +22 -0
- data/test/fixtures/fetch_tnc.json +11 -0
- data/test/fixtures/stakeholder_collection.json +35 -0
- data/test/fixtures/webhook_by_account_collection.json +35 -0
- data/test/fixtures/webhook_collection.json +85 -0
- data/test/razorpay/test_account.rb +134 -0
- data/test/razorpay/test_card.rb +6 -0
- data/test/razorpay/test_customer.rb +8 -8
- data/test/razorpay/test_iin.rb +23 -0
- data/test/razorpay/test_order.rb +1 -1
- data/test/razorpay/test_product.rb +67 -0
- data/test/razorpay/test_settlement.rb +1 -1
- data/test/razorpay/test_stakeholder.rb +87 -0
- data/test/razorpay/test_token.rb +66 -0
- data/test/razorpay/test_transfer.rb +1 -1
- data/test/razorpay/test_webhook.rb +132 -0
- metadata +47 -1
@@ -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
|
+
}
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Razorpay
|
4
|
+
# Tests for Razorpay::Account
|
5
|
+
class RazorpayAccountonTest < Minitest::Test
|
6
|
+
class Account < Razorpay::Entity; end
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@account_id = 'acc_00000000000001'
|
10
|
+
@email = 'gauriagain.kumar@example.org'
|
11
|
+
# Any request that ends with account/account_id
|
12
|
+
stub_get(%r{/v2/accounts\/#{Regexp.quote(@account_id)}$}, 'fake_account')
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_account_should_be_defined
|
16
|
+
refute_nil Razorpay::Account
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_account_should_be_available
|
20
|
+
account = Razorpay::Account.fetch(@account_id)
|
21
|
+
assert_instance_of Razorpay::Entity, account, 'Account not an instance of Entity class'
|
22
|
+
assert_equal @account_id, account.id, 'Account IDs do not match'
|
23
|
+
assert_equal @email, account.email, 'Account email is accessible'
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_account_should_be_created
|
27
|
+
|
28
|
+
payload = create_account_payload()
|
29
|
+
|
30
|
+
stub_post(/accounts$/,'fake_account',payload.to_json)
|
31
|
+
|
32
|
+
account = Razorpay::Account.create payload.to_json
|
33
|
+
assert_instance_of Razorpay::Entity, account
|
34
|
+
assert_equal @account_id, account.id
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_account_edit
|
38
|
+
|
39
|
+
param_attr = {
|
40
|
+
"notes": {
|
41
|
+
"internal_ref_id": "111111"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
stub_patch(%r{accounts/#{@account_id}$}, 'fake_account', param_attr.to_json)
|
46
|
+
|
47
|
+
account = Razorpay::Account.edit(@account_id, param_attr.to_json)
|
48
|
+
assert_instance_of Razorpay::Entity, account
|
49
|
+
assert_equal @account_id, account.id
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_delete_account
|
53
|
+
stub_delete(%r{accounts/#{@account_id}$}, 'fake_account')
|
54
|
+
account = Razorpay::Account.delete(@account_id)
|
55
|
+
assert_instance_of Razorpay::Entity, account
|
56
|
+
assert_equal @account_id, account.id
|
57
|
+
end
|
58
|
+
|
59
|
+
def create_account_payload
|
60
|
+
return {
|
61
|
+
"email": "gauriagainqzy.kumar@example.org",
|
62
|
+
"phone": "9000090000",
|
63
|
+
"legal_business_name": "Acme Corp",
|
64
|
+
"business_type": "partnership",
|
65
|
+
"customer_facing_business_name": "Example",
|
66
|
+
"profile": {
|
67
|
+
"category": "healthcare",
|
68
|
+
"subcategory": "clinic",
|
69
|
+
"description": "Healthcare E-commerce platform",
|
70
|
+
"addresses": {
|
71
|
+
"operation": {
|
72
|
+
"street1": "507, Koramangala 6th block",
|
73
|
+
"street2": "Kormanagala",
|
74
|
+
"city": "Bengaluru",
|
75
|
+
"state": "Karnataka",
|
76
|
+
"postal_code": 560047,
|
77
|
+
"country": "IN"
|
78
|
+
},
|
79
|
+
"registered": {
|
80
|
+
"street1": "507, Koramangala 1st block",
|
81
|
+
"street2": "MG Road",
|
82
|
+
"city": "Bengaluru",
|
83
|
+
"state": "Karnataka",
|
84
|
+
"postal_code": 560034,
|
85
|
+
"country": "IN"
|
86
|
+
}
|
87
|
+
},
|
88
|
+
"business_model": "Online Clothing ( men, women, ethnic, modern ) fashion and lifestyle, accessories, t-shirt, shirt, track pant, shoes."
|
89
|
+
},
|
90
|
+
"legal_info": {
|
91
|
+
"pan": "AAACL1234C",
|
92
|
+
"gst": "18AABCU9603R1ZM"
|
93
|
+
},
|
94
|
+
"brand": {
|
95
|
+
"color": "FFFFFF"
|
96
|
+
},
|
97
|
+
"notes": {
|
98
|
+
"internal_ref_id": "111111"
|
99
|
+
},
|
100
|
+
"contact_name": "Gaurav Kumar",
|
101
|
+
"contact_info": {
|
102
|
+
"chargeback": {
|
103
|
+
"email": "cb@example.org"
|
104
|
+
},
|
105
|
+
"refund": {
|
106
|
+
"email": "cb@example.org"
|
107
|
+
},
|
108
|
+
"support": {
|
109
|
+
"email": "support@example.org",
|
110
|
+
"phone": "9999999998",
|
111
|
+
"policy_url": "https://www.google.com"
|
112
|
+
}
|
113
|
+
},
|
114
|
+
"apps": {
|
115
|
+
"websites": [
|
116
|
+
"https://www.example.org"
|
117
|
+
],
|
118
|
+
"android": [
|
119
|
+
{
|
120
|
+
"url": "playstore.example.org",
|
121
|
+
"name": "Example"
|
122
|
+
}
|
123
|
+
],
|
124
|
+
"ios": [
|
125
|
+
{
|
126
|
+
"url": "appstore.example.org",
|
127
|
+
"name": "Example"
|
128
|
+
}
|
129
|
+
]
|
130
|
+
}
|
131
|
+
}
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
data/test/razorpay/test_card.rb
CHANGED
@@ -19,5 +19,11 @@ module Razorpay
|
|
19
19
|
assert_instance_of Razorpay::Card, card, 'card not an instance of Razorpay::Card class'
|
20
20
|
assert_equal @card_id, card.id, 'card IDs do not match'
|
21
21
|
end
|
22
|
+
|
23
|
+
def test_request_card_reference_should_be_fetched
|
24
|
+
stub_post(%r{cards/fingerprints$}, 'fake_card_reference', {"number": "4111111111111111"})
|
25
|
+
card = Razorpay::Card.request_card_reference({"number": "4111111111111111"})
|
26
|
+
assert_instance_of Razorpay::Entity, card, 'card not an instance of Razorpay::Card class'
|
27
|
+
end
|
22
28
|
end
|
23
29
|
end
|
@@ -43,19 +43,19 @@ module Razorpay
|
|
43
43
|
assert_equal "test@razorpay.com", customer.email
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
53
|
|
54
54
|
def test_customer_fetch_token
|
55
55
|
stub_get(%r{customers/#{@customer_id}$}, 'fake_customer')
|
56
56
|
stub_get(%r{customers/cust_6vRXClWqnLhV14/tokens/token_FHfn3rIiM1Z8nr$}, 'fake_token')
|
57
57
|
token = Razorpay::Customer.fetch(@customer_id).fetchToken("token_FHfn3rIiM1Z8nr")
|
58
|
-
assert_instance_of Razorpay::
|
58
|
+
assert_instance_of Razorpay::Token, token, 'Token not an instance of Razorpay::Entity class'
|
59
59
|
assert_equal "token_FHfn3rIiM1Z8nr", token.id
|
60
60
|
end
|
61
61
|
|