razorpay 3.2.1 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +18 -1
  4. data/documents/customer.md +242 -0
  5. data/documents/dispute.md +301 -0
  6. data/documents/documents.md +65 -0
  7. data/documents/oauth_token.md +142 -0
  8. data/documents/order.md +71 -0
  9. data/documents/payment.md +253 -0
  10. data/documents/transfers.md +40 -0
  11. data/lib/razorpay/constants.rb +6 -1
  12. data/lib/razorpay/customer.rb +16 -0
  13. data/lib/razorpay/dispute.rb +26 -0
  14. data/lib/razorpay/document.rb +19 -0
  15. data/lib/razorpay/oauth_token.rb +109 -0
  16. data/lib/razorpay/order.rb +8 -0
  17. data/lib/razorpay/payload_validator.rb +93 -0
  18. data/lib/razorpay/payment.rb +4 -0
  19. data/lib/razorpay/request.rb +24 -7
  20. data/lib/razorpay/transfer.rb +4 -0
  21. data/lib/razorpay/utility.rb +24 -0
  22. data/lib/razorpay/validation_config.rb +11 -0
  23. data/lib/razorpay.rb +10 -1
  24. data/test/fixtures/dispute_collection.json +67 -0
  25. data/test/fixtures/dispute_error.json +10 -0
  26. data/test/fixtures/document_error.json +10 -0
  27. data/test/fixtures/error_customer.json +10 -0
  28. data/test/fixtures/error_eligibility.json +10 -0
  29. data/test/fixtures/error_eligibility_check.json +10 -0
  30. data/test/fixtures/fake_bank_account.json +9 -0
  31. data/test/fixtures/fake_dispute.json +29 -0
  32. data/test/fixtures/fake_document.json +9 -0
  33. data/test/fixtures/fake_eligiblity.json +79 -0
  34. data/test/fixtures/fake_fulfillment.json +10 -0
  35. data/test/fixtures/fake_oauth_token.json +8 -0
  36. data/test/fixtures/fake_payment_expanded_details.json +38 -0
  37. data/test/fixtures/fake_payment_expanded_details_card.json +50 -0
  38. data/test/fixtures/fake_revoke_token.json +3 -0
  39. data/test/fixtures/fake_rto.json +15 -0
  40. data/test/fixtures/order_error.json +10 -0
  41. data/test/fixtures/payment_error.json +10 -0
  42. data/test/fixtures/reversals_collection.json +22 -0
  43. data/test/fixtures/transfer_error.json +10 -0
  44. data/test/razorpay/test_customer.rb +105 -0
  45. data/test/razorpay/test_dispute.rb +98 -0
  46. data/test/razorpay/test_document.rb +27 -0
  47. data/test/razorpay/test_oauth_token.rb +105 -0
  48. data/test/razorpay/test_order.rb +43 -1
  49. data/test/razorpay/test_payload_validator.rb +61 -0
  50. data/test/razorpay/test_payment.rb +23 -1
  51. data/test/razorpay/test_razorpay.rb +17 -0
  52. data/test/razorpay/test_transfer.rb +17 -0
  53. data/test/razorpay/test_utility.rb +34 -0
  54. metadata +59 -3
@@ -0,0 +1,142 @@
1
+ ### OAuthToken
2
+
3
+ ```rb
4
+ require "razorpay"
5
+ ```
6
+
7
+ ### Generate Authorize Url
8
+ ```rb
9
+ body = {
10
+ submerchant_id: '<SUBMERCHANT_MID>',
11
+ timestamp: Time.now.to_i
12
+ }
13
+ onboarding_signature = Razorpay::Utility.generate_onboarding_signature(body, '<YOUR_CLIENT_SECRET>')
14
+
15
+ options = {
16
+ 'client_id' => '<YOUR_CLIENT_ID>',
17
+ 'redirect_uri' => 'https://example.com/razorpay_callback',
18
+ 'scopes' => ["read_write"],
19
+ 'state' => 'NOBYtv8r6c75ex6WZ',
20
+ 'onboarding_signature' => onboarding_signature
21
+ }
22
+ authorize_url = Razorpay::OAuthToken.get_auth_url(options)
23
+ ```
24
+
25
+ **Parameters:**
26
+
27
+ | Name | Type | Description |
28
+ |----------------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
29
+ | client_id* | string | Unique client identifier. |
30
+ | redirect_uri* | string | Callback URL used by Razorpay to redirect after the user approves or denies the authorisation request. The client should whitelist the 'redirect_uri'. |
31
+ | scopes* | array | Defines what access your application is requesting from the user. You can request one or multiple scopes by adding them to an array as indicated above. |
32
+ | state* | string | A random string generated by your service. This parameter helps prevent cross-site request forgery (CSRF) attacks. |
33
+ | onboarding_signature | string | A cryptographic string generated by your service using generateOnboardingSignature method in Utils class. Only applicable for accounts created with pre-fill KYC |
34
+
35
+ **Response:**
36
+ ```
37
+ "https://auth.razorpay.com/authorize?response_type=code&client_id=<YOUR_CLIENT_ID>&redirect_uri=https:%2F%2Fexample.com%2Frazorpay_callback&scope[]=read_only&scope[]=rx_read_write&state=NOBYtv8r6c75ex6WZ&onboarding_signature=<GENERATED_ONBOARDING_SIGNATURE>"
38
+ ```
39
+
40
+ -------------------------------------------------------------------------------------------------------
41
+ ### Get Access token
42
+ ```rb
43
+ options = {
44
+ 'client_id' => '<YOUR_CLIENT_ID>',
45
+ 'client_secret' => '<YOUR_CLIENT_SECRET>',
46
+ 'redirect_uri' => 'https://example.com/razorpay_callback',
47
+ 'grant_type' => 'authorization_code',
48
+ 'code' => '<AUTHORIZATION_CODE>',
49
+ 'mode' => 'test'
50
+ }
51
+ oauth_token = Razorpay::OAuthToken.get_access_token(options)
52
+ ```
53
+
54
+ **Parameters:**
55
+
56
+ | Name | Type | Description |
57
+ |----------------|--------|------------------------------------------------------------------------------------------------------------------------------|
58
+ | client_id* | string | Unique client identifier. |
59
+ | client_secret* | string | Client secret string. |
60
+ | redirect_uri* | string | Specifies the same redirect_uri used in the authorisation request. |
61
+ | grant_type* | string | Defines the grant type for the request. Possible value are:<ul><li>authorization_code</li><li>client_credentials</li></ul> |
62
+ | code* | string | Decoded authorisation code received in the last step. Note: Pass this parameter only when grant_type is 'authorization_code' |
63
+ | mode | string | The type of mode. Possible values: <ul><li>test</li><li>live (default)</li></ul> |
64
+
65
+ **Response:**
66
+ ```json
67
+ {
68
+ "public_token": "rzp_test_oauth_9xu1rkZqoXlClS",
69
+ "token_type": "Bearer",
70
+ "expires_in": 7862400,
71
+ "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IkY1Z0NQYkhhRzRjcUpnIn0.eyJhdWQiOiJGNFNNeEgxanMxbkpPZiIsImp0aSI6IkY1Z0NQYkhhRzRjcUpnIiwiaWF0IjoxNTkyODMxMDExLCJuYmYiOjE1OTI4MzEwMTEsInN1YiI6IiIsImV4cCI6MTYwMDc3OTgxMSwidXNlcl9pZCI6IkYycVBpejJEdzRPRVFwIiwibWVyY2hhbnRfaWQiOiJGMnFQaVZ3N0lNV01GSyIsInNjb3BlcyI6WyJyZWFkX29ubHkiXX0.Wwqt5czhoWpVzP5_aoiymKXoGj-ydo-4A_X2jf_7rrSvk4pXdqzbA5BMrHxPdPbeFQWV6vsnsgbf99Q3g-W4kalHyH67LfAzc3qnJ-mkYDkFY93tkeG-MCco6GJW-Jm8xhaV9EPUak7z9J9jcdluu9rNXYMtd5qxD8auyRYhEgs",
72
+ "refresh_token": "def50200f42e07aded65a323f6c53181d802cc797b62cc5e78dd8038d6dff253e5877da9ad32f463a4da0ad895e3de298cbce40e162202170e763754122a6cb97910a1f58e2378ee3492dc295e1525009cccc45635308cce8575bdf373606c453ebb5eb2bec062ca197ac23810cf9d6cf31fbb9fcf5b7d4de9bf524c89a4aa90599b0151c9e4e2fa08acb6d2fe17f30a6cfecdfd671f090787e821f844e5d36f5eacb7dfb33d91e83b18216ad0ebeba2bef7721e10d436c3984daafd8654ed881c581d6be0bdc9ebfaee0dc5f9374d7184d60aae5aa85385690220690e21bc93209fb8a8cc25a6abf1108d8277f7c3d38217b47744d7",
73
+ "razorpay_account_id": "acc_Dhk2qDbmu6FwZH"
74
+ }
75
+ ```
76
+
77
+ -------------------------------------------------------------------------------------------------------
78
+
79
+ ### Get Access token using refresh token
80
+ ```rb
81
+ options = {
82
+ 'client_id' => '<YOUR_CLIENT_ID>',
83
+ 'client_secret' => '<YOUR_CLIENT_SECRET>',
84
+ 'refresh_token' => 'def5020096e1c470c901d34cd60fa53abdaf3662sa0'
85
+ }
86
+ oauth_token = Razorpay::OAuthToken.refresh_token(options)
87
+ ```
88
+
89
+ **Parameters:**
90
+
91
+ | Name | Type | Description |
92
+ |----------------|-----------|--------------------------------------------|
93
+ | client_id* | string | Unique client identifier. |
94
+ | client_secret* | string | Client secret string. |
95
+ | refresh_token* | string | The previously-stored refresh token value. |
96
+
97
+ **Response:**
98
+ ```json
99
+ {
100
+ "public_token": "rzp_test_oauth_9xu1rkZqoXlClS",
101
+ "token_type": "Bearer",
102
+ "expires_in": 7862400,
103
+ "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6Ijl4dTF",
104
+ "refresh_token": "def5020096e1c470c901d34cd60fa53abdaf36620e823ffa53"
105
+ }
106
+ ```
107
+
108
+ -------------------------------------------------------------------------------------------------------
109
+
110
+ ### Revoke a token
111
+ ```rb
112
+ options = {
113
+ 'client_id' => '<YOUR_CLIENT_ID>',
114
+ 'client_secret' => '<YOUR_CLIENT_SECRET>',
115
+ 'token' => 'def5020096e1c470c901d34cd60fa53abdaf36620e823ffa53'
116
+ 'token_type_hint' => 'access_token'
117
+ }
118
+ response = Razorpay::OAuthToken.revoke_token(options)
119
+ ```
120
+
121
+ **Parameters:**
122
+
123
+ | Name | Type | Description |
124
+ |------------------|----------|----------------------------------------------------------------------------------------------------------|
125
+ | client_id* | string | Unique client identifier. |
126
+ | client_secret* | string | Client secret string. |
127
+ | token_type_hint* | string | The type of token for the request. Possible values: <ul><li>access_token</li><li>refresh_token</li></ul> |
128
+ | token* | string | The token whose access should be revoked. |
129
+
130
+ **Response:**
131
+ ```json
132
+ {
133
+ "message": "Token Revoked"
134
+ }
135
+ ```
136
+ -------------------------------------------------------------------------------------------------------
137
+
138
+ **PN: * indicates mandatory fields**
139
+ <br>
140
+ <br>
141
+ **For reference click [here](https://razorpay.com/docs/partners/platform/onboard-businesses/integrate-oauth/integration-steps)**
142
+
data/documents/order.md CHANGED
@@ -275,6 +275,77 @@ Razorpay::Order.edit(orderId,para_attr)
275
275
  -------------------------------------------------------------------------------------------------------
276
276
 
277
277
 
278
+ ### View RTO/Risk Reasons
279
+
280
+ ```go
281
+ orderId = "order_XXXXXXXXXXXXX1"
282
+
283
+ Razorpay::Order.view_rto(orderId)
284
+ ```
285
+ **Parameters**
286
+
287
+ | Name | Type | Description |
288
+ |----------|--------|------------------------------------- |
289
+ | orderId* | string | The unique identifier of an order to access the fulfillment information. |
290
+
291
+ **Response:**
292
+ ```json
293
+ {
294
+ "risk_tier": "high",
295
+ "rto_reasons": [
296
+ {
297
+ "reason": "short_shipping_address",
298
+ "description": "Short shipping address",
299
+ "bucket": "address"
300
+ },
301
+ {
302
+ "reason": "address_pincode_state_mismatch",
303
+ "description": "Incorrect pincode state entered",
304
+ "bucket": "address"
305
+ }
306
+ ]
307
+ }
308
+ ```
309
+ -------------------------------------------------------------------------------------------------------
310
+
311
+ ### Update the Fulfillment Details
312
+
313
+ ```rb
314
+ order_id = "order_XXXXXXXXXXXXX1"
315
+
316
+ para_attr = {
317
+ "payment_method": "upi",
318
+ "shipping": {
319
+ "waybill": "123456789",
320
+ "status": "rto",
321
+ "provider": "Bluedart"
322
+ }
323
+ }
324
+
325
+ Razorpay::Order.edit_fulfillment(order_id, para_attr)
326
+ ```
327
+ **Parameters**
328
+
329
+ | Name | Type | Description |
330
+ |----------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
331
+ | orderId* | string | The unique identifier of an order to access the fulfillment information. |
332
+ | payment_method | string | Payment Method opted by the customer to complete the payment. Possible values is `upi`, `card`, `wallet`, `netbanking`, `cod`, `emi`, `cardless_emi`, `paylater`, `recurring`, `other`. |
333
+ | shipping | object | Contains the shipping data. [here](https://razorpay.com/docs/payments/magic-checkout/rto-intelligence/#step-3-update-the-fulfillment-details) are supported |
334
+
335
+ **Response:**
336
+ ```json
337
+ {
338
+ "entity": "order.fulfillment",
339
+ "order_id": "EKwxwAgItXXXX",
340
+ "payment_method": "upi",
341
+ "shipping": {
342
+ "waybill": "123456789",
343
+ "status": "rto",
344
+ "provider": "Bluedart"
345
+ }
346
+ }
347
+ ```
348
+ -------------------------------------------------------------------------------------------------------
278
349
  **PN: * indicates mandatory fields**
279
350
  <br>
280
351
  <br>
data/documents/payment.md CHANGED
@@ -863,6 +863,259 @@ Razorpay::Iin.fetch(tokenIin);
863
863
  }
864
864
  ```
865
865
  -------------------------------------------------------------------------------------------------------
866
+ -------------------------------------------------------------------------------------------------------
867
+
868
+ ### Fetch a Payment (With Expanded EMI Details)
869
+
870
+ ```rb
871
+ Razorpay::Payment.expand_details("pay_XXXXXXXXXXXXXX",{"expand[]": "emi"})
872
+ ```
873
+
874
+ **Parameters:**
875
+
876
+ | Name | Type | Description |
877
+ |-------------|---------|------------------------------------------------------------------|
878
+ | paymentId* | integer | Unique identifier of the payment |
879
+ | expand[] | string | Use to expand the `emi` details when the payment method is emi. |
880
+
881
+ **Response:** <br>
882
+
883
+ ```json
884
+ {
885
+ "id": "pay_DG4ZdRK8ZnXC3k",
886
+ "entity": "payment",
887
+ "amount": 200000,
888
+ "currency": "INR",
889
+ "status": "authorized",
890
+ "order_id": null,
891
+ "invoice_id": null,
892
+ "international": false,
893
+ "method": "emi",
894
+ "amount_refunded": 0,
895
+ "refund_status": null,
896
+ "captured": false,
897
+ "description": null,
898
+ "card_id": "card_DG4ZdUO3xABb20",
899
+ "bank": "ICIC",
900
+ "wallet": null,
901
+ "vpa": null,
902
+ "email": "gaurav@example.com",
903
+ "contact": "+919972000005",
904
+ "notes": [],
905
+ "fee": null,
906
+ "tax": null,
907
+ "error_code": null,
908
+ "error_description": null,
909
+ "error_source": null,
910
+ "error_step": null,
911
+ "error_reason": null,
912
+ "emi": {
913
+ "issuer": "ICIC",
914
+ "rate": 1300,
915
+ "duration": 6
916
+ },
917
+ "acquirer_data": {
918
+ "auth_code": "828553"
919
+ },
920
+ "created_at": 1568026077
921
+ }
922
+ ```
923
+ -------------------------------------------------------------------------------------------------------
924
+
925
+ ### Fetch a Payment (With Expanded Card Details)
926
+
927
+ ```rb
928
+ Razorpay::Payment.expand_details("pay_XXXXXXXXXXXXXX", {"expand[]": "card"})
929
+ ```
930
+
931
+ **Parameters:**
932
+
933
+ | Name | Type | Description |
934
+ |-------------|---------|---------------------------------------------------------------------|
935
+ | paymentId* | integer | Unique identifier of the payment |
936
+ | expand[] | string | Use to expand the card details when the payment method is `card`. |
937
+
938
+ **Response:** <br>
939
+
940
+ ```json
941
+ {
942
+ "id": "pay_H9oR0gLCaVlV6m",
943
+ "entity": "payment",
944
+ "amount": 100,
945
+ "currency": "INR",
946
+ "status": "failed",
947
+ "order_id": "order_H9o58N6qmLYQKC",
948
+ "invoice_id": null,
949
+ "terminal_id": "term_G5kJnYM9GhhLYT",
950
+ "international": false,
951
+ "method": "card",
952
+ "amount_refunded": 0,
953
+ "refund_status": null,
954
+ "captured": false,
955
+ "description": null,
956
+ "card_id": "card_H9oR0ocen1cmZq",
957
+ "card": {
958
+ "id": "card_H9oR0ocen1cmZq",
959
+ "entity": "card",
960
+ "name": "Gaurav",
961
+ "last4": "1213",
962
+ "network": "RuPay",
963
+ "type": "credit",
964
+ "issuer": "UTIB",
965
+ "international": false,
966
+ "emi": false,
967
+ "sub_type": "business"
968
+ },
969
+ "bank": null,
970
+ "wallet": null,
971
+ "vpa": null,
972
+ "email": "gaurav.kumar@example.com",
973
+ "contact": "+919000090000",
974
+ "notes": {
975
+ "email": "gaurav.kumar@example.com",
976
+ "phone": "09000090000"
977
+ },
978
+ "fee": null,
979
+ "tax": null,
980
+ "error_code": "BAD_REQUEST_ERROR",
981
+ "error_description": "Card issuer is invalid",
982
+ "error_source": "customer",
983
+ "error_step": "payment_authentication",
984
+ "error_reason": "incorrect_card_details",
985
+ "acquirer_data": {
986
+ "auth_code": null,
987
+ "authentication_reference_number": "100222021120200000000742753928"
988
+ },
989
+ "created_at": 1620807547
990
+ }
991
+ ```
992
+
993
+ -------------------------------------------------------------------------------------------------------
994
+
995
+ ### Fetch a Payment (With Expanded Offers Details)
996
+
997
+ ```rb
998
+ Razorpay::Payment.expand_details("pay_XXXXXXXXXXXXXX", {"expand[]": "offers"})
999
+ ```
1000
+
1001
+ **Parameters:**
1002
+
1003
+ | Name | Type | Description |
1004
+ |-------------|---------|----------------------------------------------------------------|
1005
+ | paymentId* | integer | Unique identifier of the payment |
1006
+ | expand[] | string | Use to expand the offers applied to a payment. |
1007
+
1008
+ **Response:** <br>
1009
+
1010
+ ```json
1011
+ {
1012
+ "id": "pay_G8VaL2Z68LRtDs",
1013
+ "entity": "payment",
1014
+ "amount": 900,
1015
+ "currency": "INR",
1016
+ "status": "captured",
1017
+ "order_id": "order_G8VXfKDWDEOHHd",
1018
+ "invoice_id": null,
1019
+ "international": false,
1020
+ "method": "netbanking",
1021
+ "amount_refunded": 0,
1022
+ "refund_status": null,
1023
+ "captured": true,
1024
+ "offers": {
1025
+ "entity": "collection",
1026
+ "count": 1,
1027
+ "items": [
1028
+ {
1029
+ "id": "offer_G8VXOp0qNuEXzh"
1030
+ }
1031
+ ]
1032
+ },
1033
+ "description": "Purchase Shoes",
1034
+ "card_id": null,
1035
+ "bank": "KKBK",
1036
+ "wallet": null,
1037
+ "vpa": null,
1038
+ "email": "gaurav.kumar@example.com",
1039
+ "contact": "+919000090000",
1040
+ "customer_id": "cust_DitrYCFtCIokBO",
1041
+ "notes": [],
1042
+ "fee": 22,
1043
+ "tax": 4,
1044
+ "error_code": null,
1045
+ "error_description": null,
1046
+ "error_source": null,
1047
+ "error_step": null,
1048
+ "error_reason": null,
1049
+ "acquirer_data": {
1050
+ "bank_transaction_id": "0125836177",
1051
+ "authentication_reference_number": "100222021120200000000742753928"
1052
+ },
1053
+ "created_at": 1606985740
1054
+ }
1055
+ ```
1056
+
1057
+ -------------------------------------------------------------------------------------------------------
1058
+
1059
+ ### Fetch a Payment (With Expanded UPI Details)
1060
+
1061
+ ```rb
1062
+ Razorpay::Payment.expand_details("pay_XXXXXXXXXXXXXX", {"expand[]": "upi"})
1063
+ ```
1064
+
1065
+ **Parameters:**
1066
+
1067
+ | Name | Type | Description |
1068
+ |-------------|---------|---------------------------------------------------------------|
1069
+ | paymentId* | integer | Unique identifier of the payment |
1070
+ | expand[] | string | Use to expand the UPI details when the payment method is upi. |
1071
+
1072
+ **Response:** <br>
1073
+
1074
+ ```json
1075
+ {
1076
+ "id": "pay_DG4ZdRK8ZnXC3k",
1077
+ "entity": "payment",
1078
+ "amount": 100,
1079
+ "currency": "INR",
1080
+ "status": "captured",
1081
+ "order_id": "order_GjCr5oKh4AVC51",
1082
+ "invoice_id": null,
1083
+ "international": false,
1084
+ "method": "upi",
1085
+ "amount_refunded": 0,
1086
+ "refund_status": null,
1087
+ "captured": true,
1088
+ "description": "Payment for Adidas shoes",
1089
+ "card_id": null,
1090
+ "bank": null,
1091
+ "wallet": null,
1092
+ "vpa": "gaurav.kumar@upi",
1093
+ "email": "gaurav.kumar@example.com",
1094
+ "contact": "9000090000",
1095
+ "customer_id": "cust_K6fNE0WJZWGqtN",
1096
+ "token_id": "token_KOdY$DBYQOv08n",
1097
+ "notes": [],
1098
+ "fee": 1,
1099
+ "tax": 0,
1100
+ "error_code": null,
1101
+ "error_description": null,
1102
+ "error_source": null,
1103
+ "error_step": null,
1104
+ "error_reason": null,
1105
+ "acquirer_data": {
1106
+ "rrn": "303107535132"
1107
+ },
1108
+ "created_at": 1605871409,
1109
+ "upi": {
1110
+ "payer_account_type": "credit_card",
1111
+ "vpa": "gaurav.kumar@upi",
1112
+ "flow": "in_app" // appears only for Turbo UPI Payments.
1113
+ }
1114
+ }
1115
+ ```
1116
+
1117
+ -------------------------------------------------------------------------------------------------------
1118
+
866
1119
  **PN: * indicates mandatory fields**
867
1120
  <br>
868
1121
  <br>
@@ -775,6 +775,46 @@ Razorpay::Transfer.fetch(transferId).edit(para_attr)
775
775
 
776
776
  -------------------------------------------------------------------------------------------------------
777
777
 
778
+ ### Fetch Reversals for a Transfer
779
+ ```rb
780
+ transferId = "trf_JhemwjNekar9Za"
781
+ Razorpay::Transfer.reversals(transferId)
782
+ ```
783
+
784
+ **Parameters:**
785
+
786
+ | Name | Type | Description |
787
+ |---------------|-------------|---------------------------------------------|
788
+ | transferId* | string | The id of the transfer to be fetched |
789
+
790
+ **Response:**
791
+ ```json
792
+ {
793
+ "entity":"collection",
794
+ "count":1,
795
+ "items":[
796
+ {
797
+ "id":"rvrsl_Lt09xvyzskI7KZ",
798
+ "entity":"reversal",
799
+ "transfer_id":"trf_Lt048W7cgLdo1u",
800
+ "amount":50000,
801
+ "fee":0,
802
+ "tax":0,
803
+ "currency":"INR",
804
+ "notes":[
805
+
806
+ ],
807
+ "initiator_id":"Ghri4beeOuMTAb",
808
+ "customer_refund_id":null,
809
+ "utr":null,
810
+ "created_at":1684822489
811
+ }
812
+ ]
813
+ }
814
+ ```
815
+
816
+ -------------------------------------------------------------------------------------------------------
817
+
778
818
  **PN: * indicates mandatory fields**
779
819
  <br>
780
820
  <br>
@@ -2,5 +2,10 @@
2
2
  module Razorpay
3
3
  BASE_URI = 'https://api.razorpay.com'.freeze
4
4
  TEST_URL = 'https://api.razorpay.com/'.freeze
5
- VERSION = '3.2.1'.freeze
5
+ VERSION = '3.2.3'.freeze
6
+ AUTH_URL = 'https://auth.razorpay.com'.freeze
7
+ API_HOST = 'API'.freeze
8
+ AUTH_HOST = 'AUTH'.freeze
9
+ PRIVATE_AUTH = 'Private'.freeze
10
+ OAUTH = 'OAuth'.freeze
6
11
  end
@@ -38,5 +38,21 @@ module Razorpay
38
38
  def deleteToken(tokenId)
39
39
  self.class.request.delete "#{id}/tokens/#{tokenId}"
40
40
  end
41
+
42
+ def self.add_bank_account(id, options = {})
43
+ request.post "#{id}/bank_account", options
44
+ end
45
+
46
+ def self.delete_bank_account(id, bankAccountId)
47
+ request.delete "#{id}/bank_account/#{bankAccountId}"
48
+ end
49
+
50
+ def self.request_eligibility_check(options = {})
51
+ request.post "eligibility", options
52
+ end
53
+
54
+ def self.fetch_eligibility(eligibilityId)
55
+ request.get "eligibility/#{eligibilityId}"
56
+ end
41
57
  end
42
58
  end
@@ -0,0 +1,26 @@
1
+ require 'razorpay/request'
2
+ require 'razorpay/entity'
3
+
4
+ module Razorpay
5
+ class Dispute < Entity
6
+ def self.request
7
+ Razorpay::Request.new('disputes')
8
+ end
9
+
10
+ def self.fetch(id)
11
+ request.fetch id
12
+ end
13
+
14
+ def self.all(options = {})
15
+ request.all options
16
+ end
17
+
18
+ def self.accept(id, options={})
19
+ request.post "#{id}/accept", options
20
+ end
21
+
22
+ def self.contest(id, options)
23
+ request.patch "#{id}/contest", options
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,19 @@
1
+ require 'razorpay/request'
2
+ require 'razorpay/entity'
3
+
4
+ module Razorpay
5
+ # Document API allows you to create and fetch document on Razorpay
6
+ class Document < Entity
7
+ def self.request
8
+ Razorpay::Request.new('documents')
9
+ end
10
+
11
+ def self.create(options)
12
+ request.create options
13
+ end
14
+
15
+ def self.fetch(id)
16
+ request.fetch id
17
+ end
18
+ end
19
+ end