remitano 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +12 -1
- data/lib/remitano/client/merchant_charges.rb +13 -3
- data/lib/remitano/version.rb +1 -1
- data/spec/client/merchant_charges_spec.rb +42 -6
- data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/valid_params_currency_is_coin/returns_created_charge.yml +55 -0
- data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/valid_params_currency_is_fiat/returns_created_charge.yml +55 -0
- metadata +4 -3
- data/spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/valid_params/returns_created_charge.yml +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24e8c36290375607bbe4756eb87a067b83aad43d65cb2a17fc9c609f786c28b1
|
4
|
+
data.tar.gz: 907e3d596439e7cdbc9a6532465f8cb3f0150a6aa83a12b6704e6707907d43cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 200294dd5c029dd351a74cfaf5e008ac1eca68c2d50022a400c725dead107d7d3d4cd9322a6fabb73bf4ee2396d698aca0c9309128a93c6912a54b157faa5470
|
7
|
+
data.tar.gz: 229c0dcd269e2826a097ded83a8d3cb96979b46d758716ada0c705be4a38b8dfc576e369cb8f6f040ed16f99e3feccdde84724603374a7e47ddeb4323d314330
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -52,6 +52,8 @@ Visit https://developers.remitano.com/api-explorer - Merchant section for more i
|
|
52
52
|
client.merchant_charges.get(id)
|
53
53
|
```
|
54
54
|
##### Create charge
|
55
|
+
1. With coin currency
|
56
|
+
Note: For now, we only support `usdt` as the price coin currency.
|
55
57
|
```ruby
|
56
58
|
client.merchant_charges.create(
|
57
59
|
coin_currency: "usdt",
|
@@ -60,7 +62,16 @@ client.merchant_charges.create(
|
|
60
62
|
description: "Example charge" # optional
|
61
63
|
)
|
62
64
|
```
|
63
|
-
|
65
|
+
2. With fiat currency
|
66
|
+
Note: We support fiat currency of 56 countries that Remitano are supporting, i.e., `USD`, `AUD`. (You could find entire list in our [developer docs](https://developers.remitano.com/docs/getting-started/getting-started)).
|
67
|
+
```ruby
|
68
|
+
client.merchant_charges.create(
|
69
|
+
fiat_currency: "AUD",
|
70
|
+
fiat_amount: 10.99,
|
71
|
+
cancelled_or_completed_callback_url: "https://example.com/payments/callback?id=example", # optional
|
72
|
+
description: "Example charge" # optional
|
73
|
+
)
|
74
|
+
```
|
64
75
|
|
65
76
|
##### Get paginated charge list
|
66
77
|
```ruby
|
@@ -12,13 +12,23 @@ module Remitano
|
|
12
12
|
config.net.get("/merchant/merchant_charges/#{id}").execute
|
13
13
|
end
|
14
14
|
|
15
|
-
def create(
|
16
|
-
|
17
|
-
|
15
|
+
def create(
|
16
|
+
coin_currency: nil, coin_amount: nil,
|
17
|
+
fiat_currency: nil, fiat_amount: nil,
|
18
|
+
cancelled_or_completed_callback_url: nil, description: nil
|
19
|
+
)
|
20
|
+
params = {
|
18
21
|
coin_currency: coin_currency,
|
19
22
|
coin_amount: coin_amount,
|
23
|
+
fiat_currency: fiat_currency,
|
24
|
+
fiat_amount: fiat_amount,
|
20
25
|
cancelled_or_completed_callback_url: cancelled_or_completed_callback_url,
|
21
26
|
description: description
|
27
|
+
}
|
28
|
+
params.reject! { |_k, v| v.nil? }
|
29
|
+
config.net.post(
|
30
|
+
"/merchant/merchant_charges",
|
31
|
+
params
|
22
32
|
).execute
|
23
33
|
end
|
24
34
|
|
data/lib/remitano/version.rb
CHANGED
@@ -43,7 +43,7 @@ describe "Remitano::Client#merchant_charges" do
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
context "valid params" do
|
46
|
+
context "valid params, currency is coin" do
|
47
47
|
it "returns created charge" do
|
48
48
|
client = Remitano::Client.default
|
49
49
|
|
@@ -54,14 +54,50 @@ describe "Remitano::Client#merchant_charges" do
|
|
54
54
|
description: "Example charge"
|
55
55
|
)
|
56
56
|
expect(result).to eq(
|
57
|
-
"cancelled_or_completed_callback_url" => "http://sample.com/123/callback",
|
57
|
+
"cancelled_or_completed_callback_url" => "http://sample.com/123/callback?remitano_id=146",
|
58
|
+
"cancelled_or_completed_redirect_url" => nil,
|
58
59
|
"coin_amount" => 10.99,
|
59
60
|
"coin_currency" => "usdt",
|
60
|
-
"created_at_timestamp" =>
|
61
|
+
"created_at_timestamp" => 1627286204,
|
62
|
+
"description" => "Example charge",
|
63
|
+
"expired_at_timestamp" => 1627287104,
|
64
|
+
"fiat_amount" => nil,
|
65
|
+
"fiat_currency" => nil,
|
66
|
+
"id" => 146,
|
67
|
+
"payer_name" => nil,
|
68
|
+
"payload" => nil,
|
69
|
+
"ref" => "MDR1591502249",
|
70
|
+
"remitano_payment_url" => "http://localhost:3200/payment_gateway/pay/MDR1591502249",
|
71
|
+
"status" => "pending"
|
72
|
+
)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context "valid params, currency is fiat" do
|
77
|
+
it "returns created charge" do
|
78
|
+
client = Remitano::Client.default
|
79
|
+
|
80
|
+
result = client.merchant_charges.create(
|
81
|
+
fiat_currency: "AUD",
|
82
|
+
fiat_amount: 10.99,
|
83
|
+
cancelled_or_completed_callback_url: "http://sample.com/123/callback",
|
84
|
+
description: "Example charge"
|
85
|
+
)
|
86
|
+
expect(result).to eq(
|
87
|
+
"cancelled_or_completed_callback_url" => "http://sample.com/123/callback?remitano_id=144",
|
88
|
+
"cancelled_or_completed_redirect_url" => nil,
|
89
|
+
"coin_amount" => 7.33,
|
90
|
+
"coin_currency" => "usdt",
|
91
|
+
"created_at_timestamp" => 1627285893,
|
92
|
+
"expired_at_timestamp" => 1627286793,
|
93
|
+
"fiat_amount" => 10.99,
|
94
|
+
"fiat_currency" => "AUD",
|
61
95
|
"description" => "Example charge",
|
62
|
-
"id" =>
|
63
|
-
"
|
64
|
-
"
|
96
|
+
"id" => 144,
|
97
|
+
"payer_name" => nil,
|
98
|
+
"payload" => nil,
|
99
|
+
"ref" => "MDR0289485559",
|
100
|
+
"remitano_payment_url" => "http://localhost:3200/payment_gateway/pay/MDR0289485559",
|
65
101
|
"status" => "pending"
|
66
102
|
)
|
67
103
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: REMITANO_SERVER/api/v1/merchant/merchant_charges
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"cancelled_or_completed_callback_url":"http://sample.com/123/callback","description":"Example
|
9
|
+
charge","coin_currency":"usdt","coin_amount":10.99,"usec":0}'
|
10
|
+
headers:
|
11
|
+
Accept:
|
12
|
+
- "*/*"
|
13
|
+
User-Agent:
|
14
|
+
- rest-client/2.1.0 (darwin18.6.0 x86_64) ruby/2.4.3p205
|
15
|
+
Content-Type:
|
16
|
+
- application/json
|
17
|
+
Date:
|
18
|
+
- Mon, 26 Jul 2021 07:56:44 GMT
|
19
|
+
Authorization:
|
20
|
+
- APIAuth REMITANO_KEY:H0a9sNH3X5kemqIxI6a6PS9QuKs=
|
21
|
+
Content-Length:
|
22
|
+
- '155'
|
23
|
+
Accept-Encoding:
|
24
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
25
|
+
Host:
|
26
|
+
- localhost:3100
|
27
|
+
response:
|
28
|
+
status:
|
29
|
+
code: 201
|
30
|
+
message: Created
|
31
|
+
headers:
|
32
|
+
Content-Type:
|
33
|
+
- application/json
|
34
|
+
Etag:
|
35
|
+
- W/"dbcb2caee3c5fe1732f3d1d375ca9d94"
|
36
|
+
Cache-Control:
|
37
|
+
- max-age=0, private, must-revalidate
|
38
|
+
Set-Cookie:
|
39
|
+
- _admin_session=20565d740c296a4e2f0749e58408ef37; path=/; expires=Thu, 26 Aug
|
40
|
+
2021 07:56:44 -0000; HttpOnly; SameSite=Lax
|
41
|
+
X-Request-Id:
|
42
|
+
- 4f2f4f62-7219-4cff-a0d6-e5e9196a5fd3
|
43
|
+
X-Runtime:
|
44
|
+
- '0.069376'
|
45
|
+
Vary:
|
46
|
+
- Origin
|
47
|
+
Content-Length:
|
48
|
+
- '477'
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: '{"id":146,"coin_currency":"usdt","coin_amount":10.99,"fiat_currency":null,"fiat_amount":null,"status":"pending","ref":"MDR1591502249","description":"Example
|
52
|
+
charge","cancelled_or_completed_callback_url":"http://sample.com/123/callback?remitano_id=146","cancelled_or_completed_redirect_url":null,"remitano_payment_url":"http://localhost:3200/payment_gateway/pay/MDR1591502249","created_at_timestamp":1627286204,"expired_at_timestamp":1627287104,"payer_name":null,"payload":null}'
|
53
|
+
http_version:
|
54
|
+
recorded_at: Mon, 26 Jul 2021 07:56:44 GMT
|
55
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,55 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: REMITANO_SERVER/api/v1/merchant/merchant_charges
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"cancelled_or_completed_callback_url":"http://sample.com/123/callback","description":"Example
|
9
|
+
charge","fiat_currency":"AUD","fiat_amount":10.99,"usec":0}'
|
10
|
+
headers:
|
11
|
+
Accept:
|
12
|
+
- "*/*"
|
13
|
+
User-Agent:
|
14
|
+
- rest-client/2.1.0 (darwin18.6.0 x86_64) ruby/2.4.3p205
|
15
|
+
Content-Type:
|
16
|
+
- application/json
|
17
|
+
Date:
|
18
|
+
- Mon, 26 Jul 2021 07:51:33 GMT
|
19
|
+
Authorization:
|
20
|
+
- APIAuth REMITANO_KEY:KD03wd4SZ3NB442kXIPrFHWVXPc=
|
21
|
+
Content-Length:
|
22
|
+
- '154'
|
23
|
+
Accept-Encoding:
|
24
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
25
|
+
Host:
|
26
|
+
- localhost:3100
|
27
|
+
response:
|
28
|
+
status:
|
29
|
+
code: 201
|
30
|
+
message: Created
|
31
|
+
headers:
|
32
|
+
Content-Type:
|
33
|
+
- application/json
|
34
|
+
Etag:
|
35
|
+
- W/"e189359c5e2e6db3ea9f5067272010fe"
|
36
|
+
Cache-Control:
|
37
|
+
- max-age=0, private, must-revalidate
|
38
|
+
Set-Cookie:
|
39
|
+
- _admin_session=bacd8e8e16b16168db05943a4a3ae910; path=/; expires=Thu, 26 Aug
|
40
|
+
2021 07:51:33 -0000; HttpOnly; SameSite=Lax
|
41
|
+
X-Request-Id:
|
42
|
+
- f85f6eee-e33f-4303-b95c-c29c45c9b6a6
|
43
|
+
X-Runtime:
|
44
|
+
- '0.181979'
|
45
|
+
Vary:
|
46
|
+
- Origin
|
47
|
+
Content-Length:
|
48
|
+
- '478'
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: '{"id":144,"coin_currency":"usdt","coin_amount":7.33,"fiat_currency":"AUD","fiat_amount":10.99,"status":"pending","ref":"MDR0289485559","description":"Example
|
52
|
+
charge","cancelled_or_completed_callback_url":"http://sample.com/123/callback?remitano_id=144","cancelled_or_completed_redirect_url":null,"remitano_payment_url":"http://localhost:3200/payment_gateway/pay/MDR0289485559","created_at_timestamp":1627285893,"expired_at_timestamp":1627286793,"payer_name":null,"payload":null}'
|
53
|
+
http_version:
|
54
|
+
recorded_at: Mon, 26 Jul 2021 07:51:33 GMT
|
55
|
+
recorded_with: VCR 4.0.0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remitano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phuong Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -276,7 +276,8 @@ files:
|
|
276
276
|
- spec/coin_accounts_spec.rb
|
277
277
|
- spec/fiat_accounts_spec.rb
|
278
278
|
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/invalid_params/raises_error.yml
|
279
|
-
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/
|
279
|
+
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/valid_params_currency_is_coin/returns_created_charge.yml
|
280
|
+
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_create/valid_params_currency_is_fiat/returns_created_charge.yml
|
280
281
|
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_get/object_exists/returns_charge_data.yml
|
281
282
|
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_get/object_not_found/raises_error.yml
|
282
283
|
- spec/fixtures/vcr_cassettes/Remitano_Client_merchant_charges/_list/filter_by_status/returns_status_matched_merchant_charges.yml
|
@@ -1,55 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: REMITANO_SERVER/api/v1/merchant/merchant_charges
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: '{"coin_currency":"usdt","coin_amount":10.99,"cancelled_or_completed_callback_url":"http://sample.com/123/callback","description":"Example
|
9
|
-
charge","usec":0}'
|
10
|
-
headers:
|
11
|
-
Accept:
|
12
|
-
- "*/*"
|
13
|
-
Accept-Encoding:
|
14
|
-
- gzip, deflate
|
15
|
-
User-Agent:
|
16
|
-
- rest-client/2.0.2 (darwin18.6.0 x86_64) ruby/2.4.3p205
|
17
|
-
Content-Type:
|
18
|
-
- application/json
|
19
|
-
Date:
|
20
|
-
- Sun, 30 May 2021 16:52:25 GMT
|
21
|
-
Authorization:
|
22
|
-
- APIAuth REMITANO_KEY:Z9lVNAYWeb3R79N83MzGM+5MHOg=
|
23
|
-
Content-Length:
|
24
|
-
- '155'
|
25
|
-
Host:
|
26
|
-
- localhost:3100
|
27
|
-
response:
|
28
|
-
status:
|
29
|
-
code: 201
|
30
|
-
message: Created
|
31
|
-
headers:
|
32
|
-
Content-Type:
|
33
|
-
- application/json
|
34
|
-
Etag:
|
35
|
-
- W/"7504d0925da5f3d935e6148038113712"
|
36
|
-
Cache-Control:
|
37
|
-
- max-age=0, private, must-revalidate
|
38
|
-
Set-Cookie:
|
39
|
-
- _admin_session=fcfc0dc721c0a312b88341d2b8b42ea4; path=/; expires=Wed, 30 Jun
|
40
|
-
2021 16:52:25 -0000; HttpOnly; SameSite=Lax
|
41
|
-
X-Request-Id:
|
42
|
-
- f3cd882c-014e-43bb-a55f-4a5cd1c6a24b
|
43
|
-
X-Runtime:
|
44
|
-
- '0.462043'
|
45
|
-
Vary:
|
46
|
-
- Origin
|
47
|
-
Content-Length:
|
48
|
-
- '303'
|
49
|
-
body:
|
50
|
-
encoding: UTF-8
|
51
|
-
string: '{"id":64,"coin_currency":"usdt","coin_amount":10.99,"status":"pending","ref":"MDR1341467273","description":"Example
|
52
|
-
charge","cancelled_or_completed_callback_url":"http://sample.com/123/callback","remitano_payment_url":"localhost:3200/payment_gateway/pay/MDR1341467273","created_at_timestamp":1622393545}'
|
53
|
-
http_version:
|
54
|
-
recorded_at: Sun, 30 May 2021 16:52:25 GMT
|
55
|
-
recorded_with: VCR 4.0.0
|