mangopay4-ruby-sdk 3.44.0
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.
- checksums.yaml +7 -0
- data/.github/workflows/ruby_cd.yml +34 -0
- data/.github/workflows/ruby_ci.yml +30 -0
- data/.gitignore +30 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +640 -0
- data/Gemfile +2 -0
- data/LICENSE +20 -0
- data/README.md +162 -0
- data/Rakefile +5 -0
- data/bin/mangopay +9 -0
- data/lib/generators/mangopay/install_generator.rb +60 -0
- data/lib/generators/templates/mangopay.rb.erb +5 -0
- data/lib/mangopay/acquiring.rb +56 -0
- data/lib/mangopay/authorization_token.rb +89 -0
- data/lib/mangopay/bank_account.rb +49 -0
- data/lib/mangopay/bankingaliases.rb +29 -0
- data/lib/mangopay/bankingaliases_iban.rb +16 -0
- data/lib/mangopay/card.rb +54 -0
- data/lib/mangopay/card_registration.rb +9 -0
- data/lib/mangopay/client.rb +94 -0
- data/lib/mangopay/conversion.rb +49 -0
- data/lib/mangopay/deposit.rb +36 -0
- data/lib/mangopay/dispute.rb +152 -0
- data/lib/mangopay/errors.rb +66 -0
- data/lib/mangopay/event.rb +18 -0
- data/lib/mangopay/filter_parameters.rb +56 -0
- data/lib/mangopay/hook.rb +9 -0
- data/lib/mangopay/http_calls.rb +88 -0
- data/lib/mangopay/identity_verification.rb +16 -0
- data/lib/mangopay/json.rb +14 -0
- data/lib/mangopay/kyc_document.rb +83 -0
- data/lib/mangopay/legal_user.rb +21 -0
- data/lib/mangopay/legal_user_sca.rb +25 -0
- data/lib/mangopay/mandate.rb +42 -0
- data/lib/mangopay/natural_user.rb +20 -0
- data/lib/mangopay/natural_user_sca.rb +25 -0
- data/lib/mangopay/pay_in.rb +415 -0
- data/lib/mangopay/pay_out.rb +41 -0
- data/lib/mangopay/payment_method_metadata.rb +13 -0
- data/lib/mangopay/pre_authorization.rb +17 -0
- data/lib/mangopay/recipient.rb +35 -0
- data/lib/mangopay/refund.rb +19 -0
- data/lib/mangopay/regulatory.rb +22 -0
- data/lib/mangopay/report.rb +24 -0
- data/lib/mangopay/report_v2.rb +21 -0
- data/lib/mangopay/resource.rb +21 -0
- data/lib/mangopay/settlement.rb +21 -0
- data/lib/mangopay/transaction.rb +24 -0
- data/lib/mangopay/transfer.rb +20 -0
- data/lib/mangopay/ubo.rb +26 -0
- data/lib/mangopay/ubo_declaration.rb +32 -0
- data/lib/mangopay/user.rb +100 -0
- data/lib/mangopay/version.rb +3 -0
- data/lib/mangopay/virtual_account.rb +44 -0
- data/lib/mangopay/wallet.rb +17 -0
- data/lib/mangopay.rb +456 -0
- data/mangopay.gemspec +30 -0
- data/spec/mangopay/acquiring_spec.rb +176 -0
- data/spec/mangopay/authorization_token_spec.rb +70 -0
- data/spec/mangopay/bank_account_spec.rb +105 -0
- data/spec/mangopay/bankingaliases_spec.rb +29 -0
- data/spec/mangopay/card_registration_spec.rb +123 -0
- data/spec/mangopay/client_spec.png +0 -0
- data/spec/mangopay/client_spec.rb +213 -0
- data/spec/mangopay/configuration_spec.rb +249 -0
- data/spec/mangopay/conversion_spec.rb +96 -0
- data/spec/mangopay/deposit_spec.rb +107 -0
- data/spec/mangopay/dispute_spec.png +0 -0
- data/spec/mangopay/dispute_spec.rb +294 -0
- data/spec/mangopay/event_spec.rb +33 -0
- data/spec/mangopay/fetch_filters_spec.rb +63 -0
- data/spec/mangopay/hook_spec.rb +37 -0
- data/spec/mangopay/idempotency_spec.rb +41 -0
- data/spec/mangopay/identity_verification_spec.rb +47 -0
- data/spec/mangopay/kyc_document_spec.png +0 -0
- data/spec/mangopay/kyc_document_spec.rb +118 -0
- data/spec/mangopay/log_requests_filter_spec.rb +26 -0
- data/spec/mangopay/mandate_spec.rb +99 -0
- data/spec/mangopay/payin_applepay_direct_spec.rb +21 -0
- data/spec/mangopay/payin_bancontact_web_spec.rb +30 -0
- data/spec/mangopay/payin_bankwire_direct_spec.rb +74 -0
- data/spec/mangopay/payin_bankwire_external_instruction_spec.rb +104 -0
- data/spec/mangopay/payin_bizum_web_spec.rb +54 -0
- data/spec/mangopay/payin_blik_web_spec.rb +41 -0
- data/spec/mangopay/payin_card_direct_spec.rb +69 -0
- data/spec/mangopay/payin_card_web_spec.rb +64 -0
- data/spec/mangopay/payin_directdebit_direct_spec.rb +37 -0
- data/spec/mangopay/payin_directdebit_web_spec.rb +38 -0
- data/spec/mangopay/payin_giropay_web_spec.rb +30 -0
- data/spec/mangopay/payin_googlepay_direct_spec.rb +21 -0
- data/spec/mangopay/payin_ideal_web_spec.rb +30 -0
- data/spec/mangopay/payin_intent_spec.rb +151 -0
- data/spec/mangopay/payin_klarna_web_spec.rb +32 -0
- data/spec/mangopay/payin_mbway_web_spec.rb +32 -0
- data/spec/mangopay/payin_multibanco_web_spec.rb +31 -0
- data/spec/mangopay/payin_paybybank_web_spec.rb +56 -0
- data/spec/mangopay/payin_payconiq_web_spec.rb +31 -0
- data/spec/mangopay/payin_paypal_web_spec.rb +113 -0
- data/spec/mangopay/payin_preauthorized_direct_spec.rb +118 -0
- data/spec/mangopay/payin_satispay_web_spec.rb +32 -0
- data/spec/mangopay/payin_swish_web_spec.rb +30 -0
- data/spec/mangopay/payin_twint_web_spec.rb +30 -0
- data/spec/mangopay/payment_method_metadata_spec.rb +15 -0
- data/spec/mangopay/payout_bankwire_spec.rb +93 -0
- data/spec/mangopay/preauthorization_spec.rb +51 -0
- data/spec/mangopay/recipient_spec.rb +134 -0
- data/spec/mangopay/recurring_payin_spec.rb +222 -0
- data/spec/mangopay/refund_spec.rb +34 -0
- data/spec/mangopay/regulatory_spec.rb +26 -0
- data/spec/mangopay/report_spec.rb +40 -0
- data/spec/mangopay/report_v2_spec.rb +117 -0
- data/spec/mangopay/report_wallets_spec.rb +40 -0
- data/spec/mangopay/settlement_sample.csv +8 -0
- data/spec/mangopay/settlement_spec.rb +38 -0
- data/spec/mangopay/shared_resources.rb +1380 -0
- data/spec/mangopay/transaction_spec.rb +59 -0
- data/spec/mangopay/transfer_spec.rb +77 -0
- data/spec/mangopay/ubo_declaration_spec.rb +44 -0
- data/spec/mangopay/ubo_spec.rb +39 -0
- data/spec/mangopay/user_spec.rb +444 -0
- data/spec/mangopay/virtual_account_spec.rb +52 -0
- data/spec/mangopay/wallet_spec.rb +100 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/tmp/.keep +0 -0
- metadata +280 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module MangoPay
|
|
2
|
+
|
|
3
|
+
# See https://docs.mangopay.com/api-references/mandates/
|
|
4
|
+
class Mandate < Resource
|
|
5
|
+
include HTTPCalls::Fetch
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
|
|
9
|
+
# +params+: hash; see https://docs.mangopay.com/api-references/mandates/
|
|
10
|
+
def create(params, idempotency_key = nil)
|
|
11
|
+
url = "#{MangoPay.api_path}/mandates/directdebit/web"
|
|
12
|
+
MangoPay.request(:post, url, params, {}, idempotency_key)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def cancel(id)
|
|
16
|
+
url = "#{MangoPay.api_path}/mandates/#{id}/cancel"
|
|
17
|
+
MangoPay.request(:put, url)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def fetch_for_user(user_id, filters = {})
|
|
21
|
+
url = "#{MangoPay.api_path}/users/#{user_id}/mandates"
|
|
22
|
+
MangoPay.request(:get, url, {}, filters)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def fetch_for_user_bank_account(user_id, bank_account_id, filters = {})
|
|
26
|
+
url = "#{MangoPay.api_path}/users/#{user_id}/bankaccounts/#{bank_account_id}/mandates"
|
|
27
|
+
MangoPay.request(:get, url, {}, filters)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Fetches list of transactions belonging to given +mandate_id+.
|
|
31
|
+
#
|
|
32
|
+
# Optional +filters+ is a hash accepting following keys:
|
|
33
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
|
34
|
+
# - +Status+: TransactionStatus {CREATED, SUCCEEDED, FAILED}
|
|
35
|
+
# - +ResultCode+: string representing the transaction result
|
|
36
|
+
def transactions(mandate_id, filters = {})
|
|
37
|
+
url = url(mandate_id) + '/transactions'
|
|
38
|
+
MangoPay.request(:get, url, {}, filters)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module MangoPay
|
|
2
|
+
|
|
3
|
+
# See http://docs.mangopay.com/api-references/users/natural-users/
|
|
4
|
+
class NaturalUser < User
|
|
5
|
+
|
|
6
|
+
def self.url(id = nil)
|
|
7
|
+
if id
|
|
8
|
+
"#{MangoPay.api_path}/users/natural/#{CGI.escape(id.to_s)}"
|
|
9
|
+
else
|
|
10
|
+
"#{MangoPay.api_path}/users/natural"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
def close(user_id)
|
|
16
|
+
MangoPay.request(:delete, url(user_id))
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module MangoPay
|
|
2
|
+
|
|
3
|
+
# See https://docs.mangopay.com/api-reference/users/natural-user-object-sca
|
|
4
|
+
class NaturalUserSca < User
|
|
5
|
+
|
|
6
|
+
def self.url(id = nil)
|
|
7
|
+
if id
|
|
8
|
+
"#{MangoPay.api_path}/sca/users/natural/#{CGI.escape(id.to_s)}"
|
|
9
|
+
else
|
|
10
|
+
"#{MangoPay.api_path}/sca/users/natural"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
def categorize(user_id, params)
|
|
16
|
+
url = "#{MangoPay.api_path}/sca/users/natural/#{user_id}/category"
|
|
17
|
+
MangoPay.request(:put, url, params)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def close(user_id)
|
|
21
|
+
MangoPay.request(:delete, url(user_id))
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
module MangoPay
|
|
2
|
+
|
|
3
|
+
# See http://docs.mangopay.com/api-references/payins/
|
|
4
|
+
class PayIn < Resource
|
|
5
|
+
include HTTPCalls::Fetch
|
|
6
|
+
include HTTPCalls::Refund
|
|
7
|
+
|
|
8
|
+
# Fetches list of refunds belonging to the given +pay_in_id+.
|
|
9
|
+
#
|
|
10
|
+
# Optional +filters+ is a hash accepting following keys:
|
|
11
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
|
12
|
+
# - +Status+: TransactionStatus {CREATED, SUCCEEDED, FAILED}
|
|
13
|
+
# - +ResultCode+: string representing the transaction result
|
|
14
|
+
def self.refunds(pay_in_id, filters = {})
|
|
15
|
+
url = url(pay_in_id) + '/refunds'
|
|
16
|
+
MangoPay.request(:get, url, {}, filters)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
module Card
|
|
20
|
+
|
|
21
|
+
# See http://docs.mangopay.com/api-references/payins/payins-card-web/
|
|
22
|
+
class Web < Resource
|
|
23
|
+
include HTTPCalls::Create
|
|
24
|
+
|
|
25
|
+
def self.url(*)
|
|
26
|
+
"#{MangoPay.api_path}/payins/card/#{CGI.escape(class_name.downcase)}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.extended(pay_in_id)
|
|
30
|
+
MangoPay.request(:get, extended_url(pay_in_id), {}, {})
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# See https://docs.mangopay.com/endpoints/v2.01/payins#e847_view-card-details-for-a-payin-web
|
|
34
|
+
# example: data = MangoPay::PayIn::Card::Web.extended(12639078)
|
|
35
|
+
def self.extended_url(pay_in_id)
|
|
36
|
+
escaped_pay_in_id = CGI.escape(pay_in_id.to_s)
|
|
37
|
+
"#{MangoPay.api_path}/payins/card/web/#{escaped_pay_in_id}/extended"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# See http://docs.mangopay.com/api-references/payins/payindirectcard/
|
|
42
|
+
class Direct < Resource
|
|
43
|
+
include HTTPCalls::Create
|
|
44
|
+
|
|
45
|
+
def self.url(*)
|
|
46
|
+
"#{MangoPay.api_path}/payins/card/#{CGI.escape(class_name.downcase)}"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
module PreAuthorized
|
|
53
|
+
|
|
54
|
+
# See http://docs.mangopay.com/api-references/payins/preauthorized-payin/
|
|
55
|
+
class Direct < Resource
|
|
56
|
+
include HTTPCalls::Create
|
|
57
|
+
|
|
58
|
+
def self.url(*)
|
|
59
|
+
"#{MangoPay.api_path}/payins/preauthorized/direct"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.create_pre_authorized_deposit_pay_in(params, idempotency_key = nil)
|
|
63
|
+
MangoPay.request(:post, "#{MangoPay.api_path}/payins/deposit-preauthorized/direct/full-capture", params, {}, idempotency_key)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.create_deposit_preauthorized_pay_in_prior_to_complement(params, idempotency_key = nil)
|
|
67
|
+
MangoPay.request(:post, "#{MangoPay.api_path}/payins/deposit-preauthorized/direct/capture-with-complement", params, {}, idempotency_key)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.create_deposit_preauthorized_pay_in_complement(params, idempotency_key = nil)
|
|
71
|
+
MangoPay.request(:post, "#{MangoPay.api_path}/payins/deposit-preauthorized/direct/complement", params, {}, idempotency_key)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
module BankWire
|
|
78
|
+
|
|
79
|
+
# See http://docs.mangopay.com/api-references/payins/payinbankwire/
|
|
80
|
+
class Direct < Resource
|
|
81
|
+
include HTTPCalls::Create
|
|
82
|
+
|
|
83
|
+
def self.url(*)
|
|
84
|
+
"#{MangoPay.api_path}/payins/bankwire/direct"
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
class ExternalInstruction < Resource
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
module DirectDebit
|
|
94
|
+
|
|
95
|
+
# See http://docs.mangopay.com/api-references/payins/direct-debit-pay-in-web/
|
|
96
|
+
class Web < Resource
|
|
97
|
+
include HTTPCalls::Create
|
|
98
|
+
|
|
99
|
+
def self.url(*)
|
|
100
|
+
"#{MangoPay.api_path}/payins/directdebit/#{CGI.escape(class_name.downcase)}"
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# See https://docs.mangopay.com/api-references/payins/direct-debit-pay-in-direct/
|
|
105
|
+
class Direct < Resource
|
|
106
|
+
include HTTPCalls::Create
|
|
107
|
+
|
|
108
|
+
def self.url(*)
|
|
109
|
+
"#{MangoPay.api_path}/payins/directdebit/#{CGI.escape(class_name.downcase)}"
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
module PayPal
|
|
116
|
+
|
|
117
|
+
# See https://docs.mangopay.com/api-references/payins/paypal-payin/
|
|
118
|
+
# # <b>DEPRECATED</b>: 'create' function is now deprecated.
|
|
119
|
+
# Please use the 'create_v2' function - MangoPay::PayIn::PayPal::Web.create_new(params)
|
|
120
|
+
class Web < Resource
|
|
121
|
+
include HTTPCalls::Create
|
|
122
|
+
|
|
123
|
+
def self.url(*)
|
|
124
|
+
"#{MangoPay.api_path}/payins/paypal/#{CGI.escape(class_name.downcase)}"
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def self.create_v2(params, idempotency_key = nil)
|
|
128
|
+
MangoPay.request(:post, "#{MangoPay.api_path}/payins/payment-methods/paypal", params, {}, idempotency_key)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Add tracking information to a PayPal PayIn (add the tracking number and carrier for LineItems shipments.)
|
|
132
|
+
# Caution – Tracking information cannot be edited
|
|
133
|
+
# You can’t modify the TrackingNumber, Carrier, or NotifyBuyer once added.
|
|
134
|
+
# You can only send a unique tracking number once.
|
|
135
|
+
def self.add_paypal_tracking_information(pay_in_id, params, idempotency_key = nil)
|
|
136
|
+
MangoPay.request(:put, "#{MangoPay.api_path}/payins/#{pay_in_id}/trackings", params, {}, idempotency_key)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def self.create_data_collection(params, idempotency_key = nil)
|
|
140
|
+
MangoPay.request(:post, "#{MangoPay.api_path}/payins/payment-methods/paypal/data-collection", params, {}, idempotency_key)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def self.get_data_collection(data_collection_id, idempotency_key = nil)
|
|
144
|
+
MangoPay.request(:get, "#{MangoPay.api_path}/payins/payment-methods/paypal/data-collection/#{data_collection_id}")
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
module Payconiq
|
|
151
|
+
|
|
152
|
+
class Web < Resource
|
|
153
|
+
include HTTPCalls::Create
|
|
154
|
+
|
|
155
|
+
def self.url(*)
|
|
156
|
+
"#{MangoPay.api_path}/payins/payment-methods/payconiq"
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def self.create_legacy(params, idempotency_key = nil)
|
|
160
|
+
MangoPay.request(:post, "#{MangoPay.api_path}/payins/payconiq/web", params, {}, idempotency_key)
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
module ApplePay
|
|
167
|
+
class Direct < Resource
|
|
168
|
+
include HTTPCalls::Create
|
|
169
|
+
|
|
170
|
+
def self.url(*)
|
|
171
|
+
"#{MangoPay.api_path}/payins/applepay/#{CGI.escape(class_name.downcase)}"
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
module GooglePay
|
|
177
|
+
class Direct < Resource
|
|
178
|
+
include HTTPCalls::Create
|
|
179
|
+
|
|
180
|
+
def self.url(*)
|
|
181
|
+
"#{MangoPay.api_path}/payins/payment-methods/googlepay"
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
module Mbway
|
|
187
|
+
class Web < Resource
|
|
188
|
+
include HTTPCalls::Create
|
|
189
|
+
|
|
190
|
+
def self.url(*)
|
|
191
|
+
"#{MangoPay.api_path}/payins/payment-methods/mbway"
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
module Multibanco
|
|
197
|
+
class Web < Resource
|
|
198
|
+
include HTTPCalls::Create
|
|
199
|
+
|
|
200
|
+
def self.url(*)
|
|
201
|
+
"#{MangoPay.api_path}/payins/payment-methods/multibanco"
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
module Blik
|
|
207
|
+
class Web < Resource
|
|
208
|
+
include HTTPCalls::Create
|
|
209
|
+
|
|
210
|
+
def self.url(*)
|
|
211
|
+
"#{MangoPay.api_path}/payins/payment-methods/blik"
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
module Satispay
|
|
217
|
+
class Web < Resource
|
|
218
|
+
include HTTPCalls::Create
|
|
219
|
+
|
|
220
|
+
def self.url(*)
|
|
221
|
+
"#{MangoPay.api_path}/payins/payment-methods/satispay"
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
module Klarna
|
|
227
|
+
class Web < Resource
|
|
228
|
+
include HTTPCalls::Create
|
|
229
|
+
|
|
230
|
+
def self.url(*)
|
|
231
|
+
"#{MangoPay.api_path}/payins/payment-methods/klarna"
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
module Ideal
|
|
237
|
+
class Web < Resource
|
|
238
|
+
include HTTPCalls::Create
|
|
239
|
+
|
|
240
|
+
def self.url(*)
|
|
241
|
+
"#{MangoPay.api_path}/payins/payment-methods/ideal"
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
module Giropay
|
|
247
|
+
class Web < Resource
|
|
248
|
+
include HTTPCalls::Create
|
|
249
|
+
|
|
250
|
+
def self.url(*)
|
|
251
|
+
"#{MangoPay.api_path}/payins/payment-methods/giropay"
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
module Bancontact
|
|
257
|
+
class Web < Resource
|
|
258
|
+
include HTTPCalls::Create
|
|
259
|
+
|
|
260
|
+
def self.url(*)
|
|
261
|
+
"#{MangoPay.api_path}/payins/payment-methods/bancontact"
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
module Bizum
|
|
267
|
+
class Web < Resource
|
|
268
|
+
include HTTPCalls::Create
|
|
269
|
+
|
|
270
|
+
def self.url(*)
|
|
271
|
+
"#{MangoPay.api_path}/payins/payment-methods/bizum"
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
module Twint
|
|
277
|
+
class Web < Resource
|
|
278
|
+
include HTTPCalls::Create
|
|
279
|
+
|
|
280
|
+
def self.url(*)
|
|
281
|
+
"#{MangoPay.api_path}/payins/payment-methods/twint"
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
module Swish
|
|
287
|
+
class Web < Resource
|
|
288
|
+
include HTTPCalls::Create
|
|
289
|
+
|
|
290
|
+
def self.url(*)
|
|
291
|
+
"#{MangoPay.api_path}/payins/payment-methods/swish"
|
|
292
|
+
end
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
module PayByBank
|
|
297
|
+
class Web < Resource
|
|
298
|
+
include HTTPCalls::Create
|
|
299
|
+
|
|
300
|
+
def self.url(*)
|
|
301
|
+
"#{MangoPay.api_path}/payins/payment-methods/openbanking"
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
class << self
|
|
305
|
+
def get_supported_banks(filters = {})
|
|
306
|
+
MangoPay.request(:get, "#{MangoPay.api_path}/payment-methods/openbanking/metadata/supported-banks", {}, filters)
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
module RecurringPayments
|
|
313
|
+
class Recurring < Resource
|
|
314
|
+
include HTTPCalls::Create
|
|
315
|
+
include HTTPCalls::Fetch
|
|
316
|
+
include HTTPCalls::Update
|
|
317
|
+
|
|
318
|
+
def self.url(*args)
|
|
319
|
+
if args.any?
|
|
320
|
+
"#{MangoPay.api_path}/recurringpayinregistrations/#{args.first}"
|
|
321
|
+
else
|
|
322
|
+
"#{MangoPay.api_path}/recurringpayinregistrations"
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
class CIT < Resource
|
|
328
|
+
include HTTPCalls::Create
|
|
329
|
+
|
|
330
|
+
def self.url(*)
|
|
331
|
+
"#{MangoPay.api_path}/payins/recurring/card/direct"
|
|
332
|
+
end
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
class MIT < Resource
|
|
336
|
+
include HTTPCalls::Create
|
|
337
|
+
|
|
338
|
+
def self.url(*)
|
|
339
|
+
"#{MangoPay.api_path}/payins/recurring/card/direct"
|
|
340
|
+
end
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
class PayPalCIT < Resource
|
|
344
|
+
include HTTPCalls::Create
|
|
345
|
+
|
|
346
|
+
def self.url(*)
|
|
347
|
+
"#{MangoPay.api_path}/payins/payment-methods/paypal/recurring"
|
|
348
|
+
end
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
class PayPalMIT < Resource
|
|
352
|
+
include HTTPCalls::Create
|
|
353
|
+
|
|
354
|
+
def self.url(*)
|
|
355
|
+
"#{MangoPay.api_path}/payins/payment-methods/paypal/recurring"
|
|
356
|
+
end
|
|
357
|
+
end
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
module PayInIntent
|
|
361
|
+
class Authorization < Resource
|
|
362
|
+
class << self
|
|
363
|
+
def create(params, idempotency_key = nil)
|
|
364
|
+
MangoPay.request(:post, "#{MangoPay.api_path_v3}/payins/intents", params, {}, idempotency_key)
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
class Capture < Resource
|
|
370
|
+
class << self
|
|
371
|
+
def create(intent_id, params, idempotency_key = nil)
|
|
372
|
+
MangoPay.request(:post, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}/captures", params, {}, idempotency_key)
|
|
373
|
+
end
|
|
374
|
+
end
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
class Intent < Resource
|
|
378
|
+
class << self
|
|
379
|
+
def get(intent_id)
|
|
380
|
+
MangoPay.request(:get, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}")
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
def cancel(intent_id, params, idempotency_key = nil)
|
|
384
|
+
MangoPay.request(:post, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}/cancel", params, {}, idempotency_key)
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
class Split < Resource
|
|
390
|
+
class << self
|
|
391
|
+
def create(intent_id, params, idempotency_key = nil)
|
|
392
|
+
MangoPay.request(:post, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}/splits", params, {}, idempotency_key)
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
def execute(intent_id, split_id, idempotency_key = nil)
|
|
396
|
+
MangoPay.request(:post, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}/splits/#{split_id}/execute", {}, {}, idempotency_key)
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
def reverse(intent_id, split_id, idempotency_key = nil)
|
|
400
|
+
MangoPay.request(:post, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}/splits/#{split_id}/reverse", {}, {}, idempotency_key)
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
def get(intent_id, split_id)
|
|
404
|
+
MangoPay.request(:get, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}/splits/#{split_id}")
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
def update(intent_id, split_id, params)
|
|
408
|
+
MangoPay.request(:put, "#{MangoPay.api_path_v3}/payins/intents/#{intent_id}/splits/#{split_id}", params)
|
|
409
|
+
end
|
|
410
|
+
end
|
|
411
|
+
end
|
|
412
|
+
end
|
|
413
|
+
|
|
414
|
+
end
|
|
415
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module MangoPay
|
|
2
|
+
class PayOut < Resource
|
|
3
|
+
include HTTPCalls::Fetch
|
|
4
|
+
|
|
5
|
+
# Fetches list of refunds belonging to the given +pay_out_id+.
|
|
6
|
+
#
|
|
7
|
+
# Optional +filters+ is a hash accepting following keys:
|
|
8
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
|
9
|
+
# - +Status+: TransactionStatus {CREATED, SUCCEEDED, FAILED}
|
|
10
|
+
# - +ResultCode+: string representing the transaction result
|
|
11
|
+
def self.refunds(pay_out_id, filters = {}, idempotency_key = nil)
|
|
12
|
+
url = url(pay_out_id) + '/refunds'
|
|
13
|
+
MangoPay.request(:get, url, {}, filters, idempotency_key)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# See http://docs.mangopay.com/api-references/pay-out-bank-wire/
|
|
17
|
+
class BankWire < Resource
|
|
18
|
+
include HTTPCalls::Create
|
|
19
|
+
|
|
20
|
+
def self.url(*)
|
|
21
|
+
"#{MangoPay.api_path}/payouts/bankwire"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.get_bankwire(pay_out_id)
|
|
25
|
+
url = self.url() + "/" + pay_out_id
|
|
26
|
+
MangoPay.request(:get, url);
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# See https://docs.mangopay.com/endpoints/v2.01/payouts#e1058_check-instant-payout-eligibility
|
|
31
|
+
module InstantPayoutEligibility
|
|
32
|
+
class Reachability < Resource
|
|
33
|
+
include HTTPCalls::Create
|
|
34
|
+
|
|
35
|
+
def self.url(*)
|
|
36
|
+
"#{MangoPay.api_path}/payouts/reachability"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module MangoPay
|
|
2
|
+
class PaymentMethodMetadata < Resource
|
|
3
|
+
include HTTPCalls::Fetch
|
|
4
|
+
include HTTPCalls::Update
|
|
5
|
+
|
|
6
|
+
class << self
|
|
7
|
+
def get_metadata(metadata)
|
|
8
|
+
url = "#{MangoPay.api_path}/payment-methods/metadata"
|
|
9
|
+
MangoPay.request(:post, url, metadata)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module MangoPay
|
|
2
|
+
|
|
3
|
+
# See http://docs.mangopay.com/api-references/payins/preauthorized-payin/
|
|
4
|
+
class PreAuthorization < Resource
|
|
5
|
+
include HTTPCalls::Update
|
|
6
|
+
include HTTPCalls::Fetch
|
|
7
|
+
|
|
8
|
+
def self.create(params, idempotency_key = nil)
|
|
9
|
+
MangoPay.request(:post, "#{url}/card/direct", params, {}, idempotency_key)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.transactions(pre_authorization_id, filters = {})
|
|
13
|
+
MangoPay.request(:get, "#{url}/#{pre_authorization_id}/transactions", {}, filters)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module MangoPay
|
|
2
|
+
|
|
3
|
+
class Recipient < Resource
|
|
4
|
+
def self.create(params, user_id, idempotency_key = nil)
|
|
5
|
+
MangoPay.request(:post, "#{MangoPay.api_path}/users/#{user_id}/recipients", params, {}, idempotency_key)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def self.get(recipient_id, filters = {})
|
|
9
|
+
MangoPay.request(:get, "#{MangoPay.api_path}/recipients/#{recipient_id}", {}, filters)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.get_user_recipients(user_id, filters = {})
|
|
13
|
+
MangoPay.request(:get, "#{MangoPay.api_path}/users/#{user_id}/recipients", {}, filters)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.get_schema(payout_method_type, recipient_type, currency, country, filters = {})
|
|
17
|
+
MangoPay.request(:get, "#{MangoPay.api_path}/recipients/schema?payoutMethodType=#{payout_method_type}&recipientType=#{recipient_type}¤cy=#{currency}&country=#{country}", {}, filters)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.get_payout_methods(country, currency, filters = {})
|
|
21
|
+
MangoPay.request(:get, "#{MangoPay.api_path}/recipients/payout-methods?country=#{country}¤cy=#{currency}", {}, filters)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.validate(params, user_id, idempotency_key = nil)
|
|
25
|
+
MangoPay.request(:post, "#{MangoPay.api_path}/users/#{user_id}/recipients/validate", params, {}, idempotency_key)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.deactivate(recipient_id)
|
|
29
|
+
params = {
|
|
30
|
+
Status: 'DEACTIVATED'
|
|
31
|
+
}
|
|
32
|
+
MangoPay.request(:put, "#{MangoPay.api_path}/recipients/#{recipient_id}", params, {})
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module MangoPay
|
|
2
|
+
|
|
3
|
+
# See http://docs.mangopay.com/api-references/refund/
|
|
4
|
+
class Refund < Resource
|
|
5
|
+
include HTTPCalls::Create
|
|
6
|
+
include HTTPCalls::Fetch
|
|
7
|
+
|
|
8
|
+
# Fetches list of refunds belonging to given +repudiation_id+
|
|
9
|
+
#
|
|
10
|
+
# Optional +filters+ is a hash accepting following keys:
|
|
11
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
|
12
|
+
# - +Status+: TransactionStatus {CREATED, SUCCEEDED, FAILED}
|
|
13
|
+
# - +ResultCode+: string representing the transaction result
|
|
14
|
+
def self.of_repudiation(repudiation_id, filters = {})
|
|
15
|
+
url = "#{MangoPay.api_path}/repudiations/#{repudiation_id}/refunds"
|
|
16
|
+
MangoPay.request(:get, url, {}, filters)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module MangoPay
|
|
2
|
+
# Provides API methods for the UBO entity.
|
|
3
|
+
class Regulatory < Resource
|
|
4
|
+
class << self
|
|
5
|
+
def one_country_url(country_iso)
|
|
6
|
+
"#{MangoPay.api_path_no_client}/countries/#{country_iso}/authorizations"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def all_countries_url
|
|
10
|
+
"#{MangoPay.api_path_no_client}/countries/authorizations"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def get_country_authorizations(country_iso)
|
|
14
|
+
MangoPay.request(:get, one_country_url(country_iso))
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_all_countries_authorizations
|
|
18
|
+
MangoPay.request(:get, all_countries_url)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module MangoPay
|
|
2
|
+
|
|
3
|
+
# See https://docs.mangopay.com/endpoints/v2.01/reporting
|
|
4
|
+
class Report < Resource
|
|
5
|
+
include HTTPCalls::Fetch
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
|
|
9
|
+
# +params+: hash; see https://docs.mangopay.com/endpoints/v2.01/reporting#e825_create-a-transaction-report
|
|
10
|
+
def create(params, idempotency_key = nil)
|
|
11
|
+
if params[:ReportType] == 'transactions'
|
|
12
|
+
url = url() + '/transactions/'
|
|
13
|
+
elsif params[:ReportType] == 'wallets'
|
|
14
|
+
url = url() + '/wallets/'
|
|
15
|
+
else
|
|
16
|
+
raise 'When creating a report, ReportType is required. Ex: ("transactions", "wallets")'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
MangoPay.request(:post, url, params, {}, idempotency_key)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|