bloom_remit_client 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/push.yml +27 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +8 -0
- data/Gemfile +2 -1
- data/README.md +61 -0
- data/bloom_remit_client.gemspec +5 -5
- data/lib/bloom_remit_client.rb +40 -50
- data/lib/bloom_remit_client/client.rb +6 -133
- data/lib/bloom_remit_client/models/txn.rb +39 -0
- data/lib/bloom_remit_client/models/txn_preview.rb +15 -0
- data/lib/bloom_remit_client/requests/base_request.rb +18 -0
- data/lib/bloom_remit_client/requests/create_txn_preview_request.rb +24 -0
- data/lib/bloom_remit_client/requests/create_txn_request.rb +79 -0
- data/lib/bloom_remit_client/responses/base_response.rb +18 -0
- data/lib/bloom_remit_client/responses/create_txn_preview_response.rb +16 -0
- data/lib/bloom_remit_client/responses/create_txn_response.rb +11 -0
- data/lib/bloom_remit_client/version.rb +1 -1
- metadata +23 -50
- data/.travis.yml +0 -9
- data/lib/bloom_remit_client/coercers/path.rb +0 -11
- data/lib/bloom_remit_client/concerns/has_base_authentification.rb +0 -16
- data/lib/bloom_remit_client/models/biller.rb +0 -16
- data/lib/bloom_remit_client/models/credit.rb +0 -12
- data/lib/bloom_remit_client/models/deposit_strategy.rb +0 -11
- data/lib/bloom_remit_client/models/payment.rb +0 -23
- data/lib/bloom_remit_client/models/recipient.rb +0 -18
- data/lib/bloom_remit_client/models/remittance.rb +0 -22
- data/lib/bloom_remit_client/models/user.rb +0 -21
- data/lib/bloom_remit_client/requests/base.rb +0 -55
- data/lib/bloom_remit_client/requests/billers/list.rb +0 -23
- data/lib/bloom_remit_client/requests/credit/history.rb +0 -20
- data/lib/bloom_remit_client/requests/credit/list.rb +0 -20
- data/lib/bloom_remit_client/requests/deposit_strategies/list.rb +0 -21
- data/lib/bloom_remit_client/requests/payments/create.rb +0 -31
- data/lib/bloom_remit_client/requests/rate/show.rb +0 -29
- data/lib/bloom_remit_client/requests/recipients/create.rb +0 -32
- data/lib/bloom_remit_client/requests/recipients/list.rb +0 -34
- data/lib/bloom_remit_client/requests/remittances/calculate.rb +0 -33
- data/lib/bloom_remit_client/requests/remittances/create.rb +0 -30
- data/lib/bloom_remit_client/requests/requests_sender.rb +0 -35
- data/lib/bloom_remit_client/requests/senders/create.rb +0 -30
- data/lib/bloom_remit_client/requests/txns/create.rb +0 -30
- data/lib/bloom_remit_client/requests/url_builder.rb +0 -51
- data/lib/bloom_remit_client/responses/base.rb +0 -31
- data/lib/bloom_remit_client/responses/billers/list.rb +0 -17
- data/lib/bloom_remit_client/responses/deposit_strategies/list.rb +0 -20
- data/lib/bloom_remit_client/responses/payments/create.rb +0 -17
- data/lib/bloom_remit_client/responses/recipients/create.rb +0 -20
- data/lib/bloom_remit_client/responses/recipients/list.rb +0 -20
- data/lib/bloom_remit_client/responses/remittances/calculate.rb +0 -69
- data/lib/bloom_remit_client/responses/remittances/create.rb +0 -20
- data/lib/bloom_remit_client/responses/senders/create.rb +0 -21
- data/lib/bloom_remit_client/responses/txns/create.rb +0 -20
@@ -1,18 +0,0 @@
|
|
1
|
-
module BloomRemitClient
|
2
|
-
class Recipient
|
3
|
-
|
4
|
-
include Virtus.model
|
5
|
-
attribute :id, String
|
6
|
-
attribute :first_name, String
|
7
|
-
attribute :last_name, String
|
8
|
-
attribute :mobile, String
|
9
|
-
attribute :email, String
|
10
|
-
attribute :address, String
|
11
|
-
attribute :city, String
|
12
|
-
attribute :state, String
|
13
|
-
attribute :country, String
|
14
|
-
attribute :postal_code, String
|
15
|
-
attribute :created_at, Time
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module BloomRemitClient
|
2
|
-
class Remittance
|
3
|
-
|
4
|
-
include Virtus.model
|
5
|
-
attribute :id, String
|
6
|
-
attribute :recipient_id, String
|
7
|
-
attribute :orig_currency, String
|
8
|
-
attribute :dest_currency, String
|
9
|
-
attribute :paid_in_orig_currency, Float
|
10
|
-
attribute :receivable_in_dest_currency, Float
|
11
|
-
attribute :status, String
|
12
|
-
attribute :payout_method, String
|
13
|
-
attribute :partner_id, String
|
14
|
-
attribute :flat_fee_in_orig_currency, Float
|
15
|
-
attribute :forex_margin, Float
|
16
|
-
attribute :account_name, String
|
17
|
-
attribute :account_number, String
|
18
|
-
attribute :callback_url, String
|
19
|
-
attribute :sender_id, String
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module BloomRemitClient
|
2
|
-
class User
|
3
|
-
|
4
|
-
include Virtus.model
|
5
|
-
attribute :id, String
|
6
|
-
attribute :email, String
|
7
|
-
attribute :first_name, String
|
8
|
-
attribute :last_name, String
|
9
|
-
attribute :passport_number, String
|
10
|
-
attribute :passport_expiry_date, String
|
11
|
-
attribute :tin, String
|
12
|
-
attribute :mobile, String
|
13
|
-
attribute :address, String
|
14
|
-
attribute :city, String
|
15
|
-
attribute :state, String
|
16
|
-
attribute :zip_code, String
|
17
|
-
attribute :country, String
|
18
|
-
attribute :birthdate, String
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module BloomRemitClient
|
3
|
-
module Requests
|
4
|
-
class Base
|
5
|
-
include Virtus.model
|
6
|
-
include ActiveModel::Validations
|
7
|
-
attribute :host, String
|
8
|
-
validates :host, presence: true
|
9
|
-
|
10
|
-
def call
|
11
|
-
RequestsSender.call(params)
|
12
|
-
end
|
13
|
-
|
14
|
-
def call!
|
15
|
-
raise(ArgumentError, errors.full_messages) if invalid?
|
16
|
-
call
|
17
|
-
end
|
18
|
-
|
19
|
-
def params
|
20
|
-
{
|
21
|
-
type: type,
|
22
|
-
body: body,
|
23
|
-
url: {
|
24
|
-
host: host,
|
25
|
-
path: path,
|
26
|
-
query_params: query_params
|
27
|
-
}
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def type
|
34
|
-
raise NotImplementedError, 'For subclass only!'
|
35
|
-
end
|
36
|
-
|
37
|
-
def path
|
38
|
-
raise NotImplementedError, 'For subclass only!'
|
39
|
-
end
|
40
|
-
|
41
|
-
def body
|
42
|
-
return unless body_params.present?
|
43
|
-
body_params.to_json
|
44
|
-
end
|
45
|
-
|
46
|
-
def body_params
|
47
|
-
{}
|
48
|
-
end
|
49
|
-
|
50
|
-
def query_params
|
51
|
-
attributes.slice(:api_secret)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module BloomRemitClient
|
2
|
-
module Requests
|
3
|
-
module Billers
|
4
|
-
class List < Base
|
5
|
-
|
6
|
-
include Concerns::HasBaseAuthentification
|
7
|
-
|
8
|
-
PATH = "/api/v2/billers.json"
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
def type
|
13
|
-
Requests::GET
|
14
|
-
end
|
15
|
-
|
16
|
-
def path
|
17
|
-
PATH
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module BloomRemitClient
|
3
|
-
module Requests
|
4
|
-
module Credit
|
5
|
-
class History < Requests::Base
|
6
|
-
include Concerns::HasBaseAuthentification
|
7
|
-
|
8
|
-
private
|
9
|
-
|
10
|
-
def type
|
11
|
-
Requests::GET
|
12
|
-
end
|
13
|
-
|
14
|
-
def path
|
15
|
-
Requests.normalize_path(::BloomRemitClient::Credit::PATH, attributes.slice(:api_token), 'history')
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module BloomRemitClient
|
3
|
-
module Requests
|
4
|
-
module Credit
|
5
|
-
class List < Requests::Base
|
6
|
-
include Concerns::HasBaseAuthentification
|
7
|
-
|
8
|
-
private
|
9
|
-
|
10
|
-
def type
|
11
|
-
Requests::GET
|
12
|
-
end
|
13
|
-
|
14
|
-
def path
|
15
|
-
Requests.normalize_path(::BloomRemitClient::Credit::PATH, attributes.slice(:api_token))
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module BloomRemitClient
|
2
|
-
module Requests
|
3
|
-
module Payments
|
4
|
-
class Create < Base
|
5
|
-
|
6
|
-
include Concerns::HasBaseAuthentification
|
7
|
-
|
8
|
-
PATH = "/api/v2/payments.json"
|
9
|
-
|
10
|
-
attribute :payment, Hash
|
11
|
-
attribute :sender_id, String
|
12
|
-
attribute :agent_id, String
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def path
|
17
|
-
PATH
|
18
|
-
end
|
19
|
-
|
20
|
-
def type
|
21
|
-
POST
|
22
|
-
end
|
23
|
-
|
24
|
-
def body_params
|
25
|
-
attributes.slice(*%i[api_token agent_id sender_id payment])
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module BloomRemitClient
|
3
|
-
module Requests
|
4
|
-
module Rate
|
5
|
-
class Show < Requests::Base
|
6
|
-
|
7
|
-
include Concerns::HasBaseAuthentification
|
8
|
-
|
9
|
-
PATH = '/api/v1/rates'
|
10
|
-
|
11
|
-
attribute :currency, String
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def type
|
16
|
-
Requests::GET
|
17
|
-
end
|
18
|
-
|
19
|
-
def path
|
20
|
-
PATH
|
21
|
-
end
|
22
|
-
|
23
|
-
def query_params
|
24
|
-
attributes.slice(:api_secret, :currency).merge(partner_id: api_token)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module BloomRemitClient
|
2
|
-
module Requests
|
3
|
-
module Recipients
|
4
|
-
class Create < Base
|
5
|
-
|
6
|
-
include Concerns::HasBaseAuthentification
|
7
|
-
|
8
|
-
PATH = "/api/v1/partners/:api_token/senders/:sender_id/recipients.json"
|
9
|
-
|
10
|
-
attribute :recipient, Hash
|
11
|
-
attribute :agent_id, String
|
12
|
-
attribute :sender_id, String
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def path
|
17
|
-
PATH.gsub(":api_token", self.api_token).
|
18
|
-
gsub(":sender_id", self.sender_id)
|
19
|
-
end
|
20
|
-
|
21
|
-
def type
|
22
|
-
POST
|
23
|
-
end
|
24
|
-
|
25
|
-
def body_params
|
26
|
-
attributes.slice(*%i[agent_id recipient])
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module BloomRemitClient
|
2
|
-
module Requests
|
3
|
-
module Recipients
|
4
|
-
class List < Base
|
5
|
-
|
6
|
-
include Concerns::HasBaseAuthentification
|
7
|
-
|
8
|
-
PATH = "/api/v1/partners/:api_token/senders/:sender_id/recipients.json"
|
9
|
-
|
10
|
-
# attribute :recipient, Hash
|
11
|
-
# attribute :agent_id, String
|
12
|
-
attribute :sender_id, String
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def path
|
17
|
-
Requests.normalize_path(PATH, attributes.slice(
|
18
|
-
:api_token,
|
19
|
-
:sender_id,
|
20
|
-
))
|
21
|
-
end
|
22
|
-
|
23
|
-
def type
|
24
|
-
GET
|
25
|
-
end
|
26
|
-
|
27
|
-
def body_params
|
28
|
-
attributes.slice(*%i[recipient_id])
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module BloomRemitClient
|
2
|
-
module Requests
|
3
|
-
module Remittances
|
4
|
-
class Calculate < Base
|
5
|
-
|
6
|
-
include Concerns::HasBaseAuthentification
|
7
|
-
|
8
|
-
PATH = "/api/v1//partners/:api_token/remittances/calculate.json"
|
9
|
-
|
10
|
-
attribute :origin_amount, Float
|
11
|
-
attribute :origin_currency, String
|
12
|
-
attribute :destination_amount, Float
|
13
|
-
attribute :destination_currency, String
|
14
|
-
attribute :payout_method, String
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def path
|
19
|
-
PATH.gsub(":api_token", self.api_token)
|
20
|
-
end
|
21
|
-
|
22
|
-
def type
|
23
|
-
POST
|
24
|
-
end
|
25
|
-
|
26
|
-
def body_params
|
27
|
-
attributes
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module BloomRemitClient
|
3
|
-
module Requests
|
4
|
-
module Remittances
|
5
|
-
class Create < Base
|
6
|
-
include Concerns::HasBaseAuthentification
|
7
|
-
PATH = '/api/v1/partners/:api_token/senders/:sender_id/remittances'
|
8
|
-
|
9
|
-
attribute :remittance, Hash
|
10
|
-
attribute :sender_id, String
|
11
|
-
attribute :recipient_id, String
|
12
|
-
attribute :agent_id, String
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def path
|
17
|
-
Requests.normalize_path(PATH, attributes.slice(:api_token, :sender_id))
|
18
|
-
end
|
19
|
-
|
20
|
-
def type
|
21
|
-
POST
|
22
|
-
end
|
23
|
-
|
24
|
-
def body_params
|
25
|
-
attributes.slice(:agent_id, :recipient_id, :remittance)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module BloomRemitClient
|
3
|
-
module Requests
|
4
|
-
class RequestsSender
|
5
|
-
class << self
|
6
|
-
def default_headers
|
7
|
-
@default_headers ||= {
|
8
|
-
'Content-Type' => Requests::CONTENT_TYPE_JSON_UTF8,
|
9
|
-
'Accept' => Requests::CONTENT_TYPE_JSON
|
10
|
-
}
|
11
|
-
end
|
12
|
-
|
13
|
-
def call(params)
|
14
|
-
new(params).call
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
include Virtus.model
|
19
|
-
include ActiveModel::Validations
|
20
|
-
|
21
|
-
attribute :type, String
|
22
|
-
attribute :body, String
|
23
|
-
attribute :headers, Hash,
|
24
|
-
lazy: true,
|
25
|
-
default: ->(object, _) { object.class.default_headers }
|
26
|
-
attribute :url, Requests::UrlBuilder
|
27
|
-
|
28
|
-
validates :type, presence: true, inclusion: Requests::REQUEST_TYPES
|
29
|
-
|
30
|
-
def call
|
31
|
-
HTTParty.send(type, url.(), body: body, headers: headers)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|