mangopay4-ruby-sdk 3.52.0 → 4.0.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 +4 -4
- data/CHANGELOG.md +35 -0
- data/lib/mangopay/authorization_token.rb +1 -1
- data/lib/mangopay/version.rb +1 -1
- data/mangopay.gemspec +7 -7
- metadata +32 -160
- data/.github/workflows/ruby_cd.yml +0 -34
- data/.github/workflows/ruby_ci.yml +0 -30
- data/.gitignore +0 -30
- data/.rspec +0 -3
- data/Gemfile +0 -2
- data/Rakefile +0 -5
- data/bin/mangopay +0 -9
- data/spec/mangopay/acquiring_spec.rb +0 -207
- data/spec/mangopay/authorization_token_spec.rb +0 -70
- data/spec/mangopay/bank_account_spec.rb +0 -105
- data/spec/mangopay/bankingaliases_spec.rb +0 -29
- data/spec/mangopay/card_registration_spec.rb +0 -123
- data/spec/mangopay/client_spec.png +0 -0
- data/spec/mangopay/client_spec.rb +0 -213
- data/spec/mangopay/configuration_spec.rb +0 -249
- data/spec/mangopay/conversion_spec.rb +0 -103
- data/spec/mangopay/deposit_spec.rb +0 -120
- data/spec/mangopay/dispute_spec.png +0 -0
- data/spec/mangopay/dispute_spec.rb +0 -294
- data/spec/mangopay/event_spec.rb +0 -33
- data/spec/mangopay/fetch_filters_spec.rb +0 -63
- data/spec/mangopay/hook_spec.rb +0 -37
- data/spec/mangopay/idempotency_spec.rb +0 -41
- data/spec/mangopay/identity_verification_spec.rb +0 -91
- data/spec/mangopay/kyc_document_spec.png +0 -0
- data/spec/mangopay/kyc_document_spec.rb +0 -118
- data/spec/mangopay/log_requests_filter_spec.rb +0 -26
- data/spec/mangopay/mandate_spec.rb +0 -99
- data/spec/mangopay/payin_applepay_direct_spec.rb +0 -21
- data/spec/mangopay/payin_bancontact_web_spec.rb +0 -30
- data/spec/mangopay/payin_bankwire_direct_spec.rb +0 -74
- data/spec/mangopay/payin_bankwire_external_instruction_spec.rb +0 -104
- data/spec/mangopay/payin_bizum_web_spec.rb +0 -54
- data/spec/mangopay/payin_blik_web_spec.rb +0 -41
- data/spec/mangopay/payin_card_direct_spec.rb +0 -69
- data/spec/mangopay/payin_card_web_spec.rb +0 -64
- data/spec/mangopay/payin_directdebit_direct_spec.rb +0 -37
- data/spec/mangopay/payin_directdebit_web_spec.rb +0 -38
- data/spec/mangopay/payin_giropay_web_spec.rb +0 -30
- data/spec/mangopay/payin_googlepay_direct_spec.rb +0 -21
- data/spec/mangopay/payin_ideal_web_spec.rb +0 -30
- data/spec/mangopay/payin_intent_spec.rb +0 -302
- data/spec/mangopay/payin_klarna_web_spec.rb +0 -32
- data/spec/mangopay/payin_mbway_web_spec.rb +0 -32
- data/spec/mangopay/payin_multibanco_web_spec.rb +0 -31
- data/spec/mangopay/payin_paybybank_web_spec.rb +0 -56
- data/spec/mangopay/payin_paypal_web_spec.rb +0 -114
- data/spec/mangopay/payin_preauthorized_direct_spec.rb +0 -135
- data/spec/mangopay/payin_satispay_web_spec.rb +0 -32
- data/spec/mangopay/payin_swish_web_spec.rb +0 -30
- data/spec/mangopay/payin_twint_web_spec.rb +0 -30
- data/spec/mangopay/payment_method_metadata_spec.rb +0 -15
- data/spec/mangopay/payout_bankwire_spec.rb +0 -90
- data/spec/mangopay/preauthorization_spec.rb +0 -51
- data/spec/mangopay/recipient_spec.rb +0 -135
- data/spec/mangopay/recurring_payin_spec.rb +0 -557
- data/spec/mangopay/refund_spec.rb +0 -34
- data/spec/mangopay/regulatory_spec.rb +0 -26
- data/spec/mangopay/report_spec.rb +0 -40
- data/spec/mangopay/report_v2_spec.rb +0 -117
- data/spec/mangopay/report_wallets_spec.rb +0 -40
- data/spec/mangopay/settlement_sample.csv +0 -8
- data/spec/mangopay/settlement_sample_bad.csv +0 -8
- data/spec/mangopay/settlement_spec.rb +0 -65
- data/spec/mangopay/shared_resources.rb +0 -1415
- data/spec/mangopay/transaction_spec.rb +0 -59
- data/spec/mangopay/transfer_spec.rb +0 -77
- data/spec/mangopay/ubo_declaration_spec.rb +0 -44
- data/spec/mangopay/ubo_spec.rb +0 -39
- data/spec/mangopay/user_spec.rb +0 -455
- data/spec/mangopay/virtual_account_spec.rb +0 -52
- data/spec/mangopay/wallet_spec.rb +0 -100
- data/spec/spec_helper.rb +0 -31
- data/spec/tmp/.keep +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Giropay::Web, type: :feature do
|
|
2
|
-
include_context 'wallets'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
|
|
5
|
-
def check_type_and_status(payin)
|
|
6
|
-
expect(payin['Type']).to eq('PAYIN')
|
|
7
|
-
expect(payin['Nature']).to eq('REGULAR')
|
|
8
|
-
expect(payin['PaymentType']).to eq('GIROPAY')
|
|
9
|
-
expect(payin['ExecutionType']).to eq('WEB')
|
|
10
|
-
expect(payin['Status']).to eq('CREATED')
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe 'CREATE' do
|
|
14
|
-
it 'creates a giropay web payin' do
|
|
15
|
-
created = new_payin_giropay_web
|
|
16
|
-
expect(created['Id']).not_to be_nil
|
|
17
|
-
check_type_and_status(created)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe 'FETCH' do
|
|
22
|
-
it 'fetches a payin' do
|
|
23
|
-
created = new_payin_giropay_web
|
|
24
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
25
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
26
|
-
check_type_and_status(created)
|
|
27
|
-
check_type_and_status(fetched)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::GooglePay::Direct, type: :feature do
|
|
2
|
-
include_context 'payins'
|
|
3
|
-
|
|
4
|
-
def check_type_and_status(payin)
|
|
5
|
-
expect(payin['Type']).to eq('PAYIN')
|
|
6
|
-
expect(payin['Nature']).to eq('REGULAR')
|
|
7
|
-
expect(payin['PaymentType']).to eq('GOOGLE_PAY')
|
|
8
|
-
expect(payin['ExecutionType']).to eq('DIRECT')
|
|
9
|
-
expect(payin['Status']).to eq('CREATED')
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe 'CREATE' do
|
|
13
|
-
it 'creates a googlepay direct payin' do
|
|
14
|
-
pending("Cannot be tested due to impossibility to generate payment_data in test")
|
|
15
|
-
created = new_payin_googlepay_direct
|
|
16
|
-
expect(created['Id']).not_to be_nil
|
|
17
|
-
check_type_and_status(created)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Ideal::Web, type: :feature do
|
|
2
|
-
include_context 'wallets'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
|
|
5
|
-
def check_type_and_status(payin)
|
|
6
|
-
expect(payin['Type']).to eq('PAYIN')
|
|
7
|
-
expect(payin['Nature']).to eq('REGULAR')
|
|
8
|
-
expect(payin['PaymentType']).to eq('IDEAL')
|
|
9
|
-
expect(payin['ExecutionType']).to eq('WEB')
|
|
10
|
-
expect(payin['Status']).to eq('CREATED')
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe 'CREATE' do
|
|
14
|
-
it 'creates a ideal web payin' do
|
|
15
|
-
created = new_payin_ideal_web
|
|
16
|
-
expect(created['Id']).not_to be_nil
|
|
17
|
-
check_type_and_status(created)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe 'FETCH' do
|
|
22
|
-
it 'fetches a payin' do
|
|
23
|
-
created = new_payin_ideal_web
|
|
24
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
25
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
26
|
-
check_type_and_status(created)
|
|
27
|
-
check_type_and_status(fetched)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::PayInIntent, type: :feature do
|
|
2
|
-
include_context 'wallets'
|
|
3
|
-
include_context 'intents'
|
|
4
|
-
|
|
5
|
-
describe 'CREATE' do
|
|
6
|
-
it 'creates a payin intent authorization' do
|
|
7
|
-
created = new_payin_intent_authorization
|
|
8
|
-
expect(created['Id']).not_to be_nil
|
|
9
|
-
expect(created['Status']).to eq('AUTHORIZED')
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it 'creates a payin intent full capture' do
|
|
13
|
-
created = create_new_intent_full_capture
|
|
14
|
-
expect(created['Id']).not_to be_nil
|
|
15
|
-
expect(created['Status']).to eq('CAPTURED')
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
it 'creates a payin intent partial capture' do
|
|
19
|
-
intent = new_payin_intent_authorization
|
|
20
|
-
to_create = {
|
|
21
|
-
"Amount": 1000,
|
|
22
|
-
"Currency": "EUR",
|
|
23
|
-
"PlatformFeesAmount": 0,
|
|
24
|
-
"ExternalData": {
|
|
25
|
-
"ExternalProcessingDate": "01-10-2024",
|
|
26
|
-
"ExternalProviderReference": SecureRandom.uuid,
|
|
27
|
-
"ExternalMerchantReference": "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
|
|
28
|
-
"ExternalProviderName": "Stripe",
|
|
29
|
-
"ExternalProviderPaymentMethod": "PAYPAL"
|
|
30
|
-
},
|
|
31
|
-
"LineItems": [
|
|
32
|
-
{
|
|
33
|
-
"Amount": 1000,
|
|
34
|
-
"Id": intent['LineItems'][0]['Id']
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
created = MangoPay::PayIn::PayInIntent::Capture.create(intent['Id'], to_create)
|
|
40
|
-
expect(created['Id']).not_to be_nil
|
|
41
|
-
expect(created['Status']).to eq('CAPTURED')
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
describe 'GET' do
|
|
46
|
-
it 'fetches an intent' do
|
|
47
|
-
intent = new_payin_intent_authorization
|
|
48
|
-
fetched = MangoPay::PayIn::PayInIntent::Intent.get(intent['Id'])
|
|
49
|
-
expect(intent['Id']).to eq(fetched['Id'])
|
|
50
|
-
expect(intent['Status']).to eq(fetched['Status'])
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
it 'fetches the external providers list' do
|
|
54
|
-
response = MangoPay::PayIn::PayInIntent::Intent.get_external_providers_list
|
|
55
|
-
expect(response).not_to be_nil
|
|
56
|
-
expect(response).not_to be_empty
|
|
57
|
-
expect(response).to include('Mangopay')
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
describe 'CANCEL' do
|
|
62
|
-
it 'cancels an intent' do
|
|
63
|
-
intent = new_payin_intent_authorization
|
|
64
|
-
canceled = MangoPay::PayIn::PayInIntent::Intent.cancel(intent['Id'], {
|
|
65
|
-
"ExternalData": {
|
|
66
|
-
"ExternalProcessingDate": 1728133765,
|
|
67
|
-
"ExternalProviderReference": SecureRandom.uuid,
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
expect(canceled['Status']).to eq('CANCELLED')
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
describe 'SPLITS' do
|
|
75
|
-
it 'creates a split' do
|
|
76
|
-
intent = new_payin_intent_authorization
|
|
77
|
-
created = create_new_splits(intent)
|
|
78
|
-
expect(created['Splits']).to be_kind_of(Array)
|
|
79
|
-
expect(created['Splits']).not_to be_empty
|
|
80
|
-
expect(created['Splits'][0]['Status']).to eq('CREATED')
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
it 'executes split' do
|
|
84
|
-
intent = new_payin_intent_authorization
|
|
85
|
-
split = create_new_splits(intent)['Splits'][0]
|
|
86
|
-
expect {
|
|
87
|
-
MangoPay::PayIn::PayInIntent::Split.execute(intent['Id'], split['Id'])
|
|
88
|
-
}.to raise_error { |err|
|
|
89
|
-
expect(err).to be_a MangoPay::ResponseError
|
|
90
|
-
expect(err.code).to eq '400'
|
|
91
|
-
expect(err.details['Type']).to eq 'param_error'
|
|
92
|
-
}
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
it 'reverses split' do
|
|
96
|
-
intent = new_payin_intent_authorization
|
|
97
|
-
split = create_new_splits(intent)['Splits'][0]
|
|
98
|
-
reversed = MangoPay::PayIn::PayInIntent::Split.reverse(intent['Id'], split['Id'])
|
|
99
|
-
expect(reversed['Status']).to eq('REVERSED')
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
it 'fetches split' do
|
|
103
|
-
intent = new_payin_intent_authorization
|
|
104
|
-
split = create_new_splits(intent)['Splits'][0]
|
|
105
|
-
fetched = MangoPay::PayIn::PayInIntent::Split.get(intent['Id'], split['Id'])
|
|
106
|
-
expect(fetched['Status']).to eq('CREATED')
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
it 'updates split' do
|
|
110
|
-
intent = new_payin_intent_authorization
|
|
111
|
-
split = create_new_splits(intent)['Splits'][0]
|
|
112
|
-
params = {
|
|
113
|
-
LineItemId: split['LineItemId'],
|
|
114
|
-
Description: 'updated split'
|
|
115
|
-
}
|
|
116
|
-
updated = MangoPay::PayIn::PayInIntent::Split.update(intent['Id'], split['Id'], params)
|
|
117
|
-
expect(updated['Description']).to eq('updated split')
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
describe 'Intent Refund' do
|
|
122
|
-
it 'creates a full refund' do
|
|
123
|
-
created_refund = create_new_intent_full_refund
|
|
124
|
-
expect(created_refund['Id']).not_to be_nil
|
|
125
|
-
expect(created_refund['Status']).to eq('REFUNDED')
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
it 'creates a partial refund' do
|
|
129
|
-
full_capture = create_new_intent_full_capture
|
|
130
|
-
to_create = {
|
|
131
|
-
"Amount": 1000,
|
|
132
|
-
"LineItems": [
|
|
133
|
-
{
|
|
134
|
-
"Id": full_capture['LineItems'][0]['Id'],
|
|
135
|
-
"Amount": 1000
|
|
136
|
-
}
|
|
137
|
-
],
|
|
138
|
-
"ExternalData": {
|
|
139
|
-
"ExternalProcessingDate": 1727913600,
|
|
140
|
-
"ExternalProviderReference": SecureRandom.uuid,
|
|
141
|
-
"ExternalMerchantReference": SecureRandom.uuid,
|
|
142
|
-
"ExternalProviderName": "Stripe",
|
|
143
|
-
"ExternalProviderPaymentMethod": "PAYPAL"
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
created_refund = MangoPay::PayIn::PayInIntent::Refund.create(full_capture['Id'], to_create)
|
|
147
|
-
expect(created_refund['Id']).not_to be_nil
|
|
148
|
-
expect(created_refund['Status']).to eq('REFUNDED')
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
it 'fully reverses a refund' do
|
|
152
|
-
created_refund = create_new_intent_full_refund
|
|
153
|
-
to_create = {
|
|
154
|
-
"ExternalData": {
|
|
155
|
-
"ExternalProcessingDate": 1727913600,
|
|
156
|
-
"ExternalProviderReference": SecureRandom.uuid,
|
|
157
|
-
"ExternalMerchantReference": SecureRandom.uuid,
|
|
158
|
-
"ExternalProviderName": "Stripe",
|
|
159
|
-
"ExternalProviderPaymentMethod": "PAYPAL"
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
reversed_refund = MangoPay::PayIn::PayInIntent::Refund.reverse(created_refund['Id'], created_refund['Refund']['Id'], to_create)
|
|
163
|
-
expect(reversed_refund['Id']).not_to be_nil
|
|
164
|
-
expect(reversed_refund['Status']).to eq('REFUND_REVERSED')
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
it 'partially reverses a refund' do
|
|
168
|
-
created_refund = create_new_intent_full_refund
|
|
169
|
-
to_create = {
|
|
170
|
-
"Amount": 1000,
|
|
171
|
-
"LineItems": [
|
|
172
|
-
{
|
|
173
|
-
"Id": created_refund['LineItems'][0]['Id'],
|
|
174
|
-
"Amount": 1000
|
|
175
|
-
}
|
|
176
|
-
],
|
|
177
|
-
"ExternalData": {
|
|
178
|
-
"ExternalProcessingDate": 1727913600,
|
|
179
|
-
"ExternalProviderReference": SecureRandom.uuid,
|
|
180
|
-
"ExternalMerchantReference": SecureRandom.uuid,
|
|
181
|
-
"ExternalProviderName": "Stripe",
|
|
182
|
-
"ExternalProviderPaymentMethod": "PAYPAL"
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
reversed_refund = MangoPay::PayIn::PayInIntent::Refund.reverse(created_refund['Id'], created_refund['Refund']['Id'], to_create)
|
|
186
|
-
expect(reversed_refund['Id']).not_to be_nil
|
|
187
|
-
expect(reversed_refund['Status']).to eq('REFUND_REVERSED')
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
it 'creates a full dispute' do
|
|
191
|
-
capture = create_new_intent_full_capture
|
|
192
|
-
to_create = {
|
|
193
|
-
"ExternalData": {
|
|
194
|
-
"ExternalProcessingDate": 1727913600,
|
|
195
|
-
"ExternalProviderReference": SecureRandom.uuid,
|
|
196
|
-
"ExternalMerchantReference": SecureRandom.uuid,
|
|
197
|
-
"ExternalProviderName": "Stripe",
|
|
198
|
-
"ExternalProviderPaymentMethod": "PAYPAL"
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
created_dispute = MangoPay::PayIn::PayInIntent::Dispute.create(capture['Id'], capture['Capture']['Id'], to_create)
|
|
202
|
-
expect(created_dispute['Id']).not_to be_nil
|
|
203
|
-
expect(created_dispute['Status']).to eq('DISPUTED')
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
it 'creates a partial dispute' do
|
|
207
|
-
capture = create_new_intent_full_capture
|
|
208
|
-
to_create = {
|
|
209
|
-
"Amount": 1000,
|
|
210
|
-
"LineItems": [
|
|
211
|
-
{
|
|
212
|
-
"Id": capture['LineItems'][0]['Id'],
|
|
213
|
-
"Amount": 1000
|
|
214
|
-
}
|
|
215
|
-
],
|
|
216
|
-
"ExternalData": {
|
|
217
|
-
"ExternalProcessingDate": 1727913600,
|
|
218
|
-
"ExternalProviderReference": SecureRandom.uuid,
|
|
219
|
-
"ExternalMerchantReference": SecureRandom.uuid,
|
|
220
|
-
"ExternalProviderName": "Stripe",
|
|
221
|
-
"ExternalProviderPaymentMethod": "PAYPAL"
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
created_dispute = MangoPay::PayIn::PayInIntent::Dispute.create(capture['Id'], capture['Capture']['Id'], to_create)
|
|
225
|
-
expect(created_dispute['Id']).not_to be_nil
|
|
226
|
-
expect(created_dispute['Status']).to eq('DISPUTED')
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
it 'updates dispute outcome' do
|
|
230
|
-
capture = create_new_intent_full_capture
|
|
231
|
-
to_create = {
|
|
232
|
-
"ExternalData": {
|
|
233
|
-
"ExternalProcessingDate": 1727913600,
|
|
234
|
-
"ExternalProviderReference": SecureRandom.uuid,
|
|
235
|
-
"ExternalMerchantReference": SecureRandom.uuid,
|
|
236
|
-
"ExternalProviderName": "Stripe",
|
|
237
|
-
"ExternalProviderPaymentMethod": "PAYPAL"
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
created_dispute = MangoPay::PayIn::PayInIntent::Dispute.create(capture['Id'], capture['Capture']['Id'], to_create)
|
|
241
|
-
|
|
242
|
-
dto = {
|
|
243
|
-
"Decision": "DEFENDED"
|
|
244
|
-
}
|
|
245
|
-
updated = MangoPay::PayIn::PayInIntent::Dispute.update_outcome(capture['Id'], capture['Capture']['Id'], created_dispute['Dispute']['Id'], dto)
|
|
246
|
-
|
|
247
|
-
expect(updated['Id']).not_to be_nil
|
|
248
|
-
expect(updated['Decision']).to eq('DEFENDED')
|
|
249
|
-
end
|
|
250
|
-
end
|
|
251
|
-
|
|
252
|
-
def create_new_splits(intent)
|
|
253
|
-
full_capture = {
|
|
254
|
-
"ExternalData": {
|
|
255
|
-
"ExternalProcessingDate": "01-10-2029",
|
|
256
|
-
"ExternalProviderReference": SecureRandom.uuid,
|
|
257
|
-
"ExternalMerchantReference": "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
|
|
258
|
-
"ExternalProviderName": "Stripe",
|
|
259
|
-
"ExternalProviderPaymentMethod": "PAYPAL"
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
MangoPay::PayIn::PayInIntent::Capture.create(intent['Id'], full_capture)
|
|
263
|
-
split = {
|
|
264
|
-
"Splits": [
|
|
265
|
-
{
|
|
266
|
-
"LineItemId": intent['LineItems'][0]['Id'],
|
|
267
|
-
"SplitAmount": 10
|
|
268
|
-
}
|
|
269
|
-
]
|
|
270
|
-
}
|
|
271
|
-
return MangoPay::PayIn::PayInIntent::Split.create(intent['Id'], split)
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
def create_new_intent_full_capture
|
|
275
|
-
intent = new_payin_intent_authorization
|
|
276
|
-
to_create = {
|
|
277
|
-
"ExternalData": {
|
|
278
|
-
"ExternalProcessingDate": "01-10-2029",
|
|
279
|
-
"ExternalProviderReference": SecureRandom.uuid,
|
|
280
|
-
"ExternalMerchantReference": "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
|
|
281
|
-
"ExternalProviderName": "Stripe",
|
|
282
|
-
"ExternalProviderPaymentMethod": "PAYPAL"
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
return MangoPay::PayIn::PayInIntent::Capture.create(intent['Id'], to_create)
|
|
287
|
-
end
|
|
288
|
-
|
|
289
|
-
def create_new_intent_full_refund
|
|
290
|
-
full_capture = create_new_intent_full_capture
|
|
291
|
-
to_create = {
|
|
292
|
-
"ExternalData": {
|
|
293
|
-
"ExternalProcessingDate": 1727913600,
|
|
294
|
-
"ExternalProviderReference": SecureRandom.uuid,
|
|
295
|
-
"ExternalMerchantReference": SecureRandom.uuid,
|
|
296
|
-
"ExternalProviderName": "Stripe",
|
|
297
|
-
"ExternalProviderPaymentMethod": "PAYPAL"
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return MangoPay::PayIn::PayInIntent::Refund.create(full_capture['Id'], to_create)
|
|
301
|
-
end
|
|
302
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Klarna::Web, type: :feature do
|
|
2
|
-
include_context 'wallets'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
|
|
5
|
-
def check_type_and_status(payin)
|
|
6
|
-
expect(payin['Type']).to eq('PAYIN')
|
|
7
|
-
expect(payin['Nature']).to eq('REGULAR')
|
|
8
|
-
expect(payin['PaymentType']).to eq('KLARNA')
|
|
9
|
-
expect(payin['ExecutionType']).to eq('WEB')
|
|
10
|
-
expect(payin['Status']).to eq('CREATED')
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe 'CREATE' do
|
|
14
|
-
it 'creates a klarna web payin' do
|
|
15
|
-
created = new_payin_klarna_web
|
|
16
|
-
expect(created['Id']).not_to be_nil
|
|
17
|
-
expect(created['ReturnURL']).not_to be_nil
|
|
18
|
-
check_type_and_status(created)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe 'FETCH' do
|
|
23
|
-
it 'fetches a payin' do
|
|
24
|
-
created = new_payin_klarna_web
|
|
25
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
26
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
27
|
-
check_type_and_status(created)
|
|
28
|
-
check_type_and_status(fetched)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Mbway::Web, type: :feature do
|
|
2
|
-
include_context 'wallets'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
|
|
5
|
-
def check_type_and_status(payin)
|
|
6
|
-
expect(payin['Type']).to eq('PAYIN')
|
|
7
|
-
expect(payin['Nature']).to eq('REGULAR')
|
|
8
|
-
expect(payin['PaymentType']).to eq('MBWAY')
|
|
9
|
-
expect(payin['ExecutionType']).to eq('WEB')
|
|
10
|
-
expect(payin['Status']).to eq('CREATED')
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe 'CREATE' do
|
|
14
|
-
it 'creates a mbway web payin' do
|
|
15
|
-
created = new_payin_mbway_web
|
|
16
|
-
expect(created['Id']).not_to be_nil
|
|
17
|
-
expect(created['Phone']).not_to be_nil
|
|
18
|
-
check_type_and_status(created)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe 'FETCH' do
|
|
23
|
-
it 'fetches a payin' do
|
|
24
|
-
created = new_payin_mbway_web
|
|
25
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
26
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
27
|
-
check_type_and_status(created)
|
|
28
|
-
check_type_and_status(fetched)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::Multibanco::Web, type: :feature do
|
|
2
|
-
include_context 'wallets'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
|
|
5
|
-
def check_type_and_status(payin)
|
|
6
|
-
expect(payin['Type']).to eq('PAYIN')
|
|
7
|
-
expect(payin['Nature']).to eq('REGULAR')
|
|
8
|
-
expect(payin['PaymentType']).to eq('MULTIBANCO')
|
|
9
|
-
expect(payin['ExecutionType']).to eq('WEB')
|
|
10
|
-
expect(payin['Status']).to eq('CREATED')
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe 'CREATE' do
|
|
14
|
-
it 'creates a multibanco web payin' do
|
|
15
|
-
created = new_payin_multibanco_web
|
|
16
|
-
expect(created['Id']).not_to be_nil
|
|
17
|
-
expect(created['ReturnURL']).not_to be_nil
|
|
18
|
-
check_type_and_status(created)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
describe 'FETCH' do
|
|
23
|
-
it 'fetches a payin' do
|
|
24
|
-
created = new_payin_multibanco_web
|
|
25
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
26
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
27
|
-
check_type_and_status(created)
|
|
28
|
-
check_type_and_status(fetched)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::PayByBank::Web, type: :feature do
|
|
2
|
-
include_context 'wallets'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
|
|
5
|
-
def check_type_and_status(payin)
|
|
6
|
-
expect(payin['Type']).to eq('PAYIN')
|
|
7
|
-
expect(payin['Nature']).to eq('REGULAR')
|
|
8
|
-
expect(payin['PaymentType']).to eq('PAY_BY_BANK')
|
|
9
|
-
expect(payin['ExecutionType']).to eq('WEB')
|
|
10
|
-
expect(payin['Status']).to eq('CREATED')
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
describe 'CREATE' do
|
|
14
|
-
it 'creates a paybybank web payin' do
|
|
15
|
-
created = new_payin_paybybank_web
|
|
16
|
-
expect(created['Id']).not_to be_nil
|
|
17
|
-
check_type_and_status(created)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe 'FETCH' do
|
|
22
|
-
it 'fetches a payin' do
|
|
23
|
-
created = new_payin_paybybank_web
|
|
24
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
25
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
26
|
-
check_type_and_status(created)
|
|
27
|
-
check_type_and_status(fetched)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
describe "FETCH SUPPORTED BANKS" do
|
|
32
|
-
it "fetches supported banks unfiltered" do
|
|
33
|
-
result = MangoPay::PayIn::PayByBank::Web.get_supported_banks
|
|
34
|
-
expect(result['SupportedBanks']['Countries']).to be_kind_of(Array)
|
|
35
|
-
expect(result['SupportedBanks']['Countries']).not_to be_empty
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
it "fetches supported banks filtered" do
|
|
39
|
-
result = MangoPay::PayIn::PayByBank::Web.get_supported_banks({CountryCodes: "DE"})
|
|
40
|
-
expect(result['SupportedBanks']['Countries']).to be_kind_of(Array)
|
|
41
|
-
expect(result['SupportedBanks']['Countries'][0]['Banks'].count).to be(5)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
it "fetches supported banks paginated" do
|
|
45
|
-
result = MangoPay::PayIn::PayByBank::Web.get_supported_banks({per_page: 2, page: 1})
|
|
46
|
-
expect(result['SupportedBanks']['Countries']).to be_kind_of(Array)
|
|
47
|
-
expect(result['SupportedBanks']['Countries'][0]['Banks'].count).to be(2)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
it "fetches supported banks paginated and filtered" do
|
|
51
|
-
result = MangoPay::PayIn::PayByBank::Web.get_supported_banks({per_page: 2, page: 1, CountryCodes: "DE"})
|
|
52
|
-
expect(result['SupportedBanks']['Countries']).to be_kind_of(Array)
|
|
53
|
-
expect(result['SupportedBanks']['Countries'][0]['Banks'].count).to be(2)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::PayPal::Web, type: :feature do
|
|
2
|
-
include_context 'payins'
|
|
3
|
-
|
|
4
|
-
def check_type_and_status(payin)
|
|
5
|
-
expect(payin['Type']).to eq('PAYIN')
|
|
6
|
-
expect(payin['Nature']).to eq('REGULAR')
|
|
7
|
-
expect(payin['PaymentType']).to eq('PAYPAL')
|
|
8
|
-
expect(payin['ExecutionType']).to eq('WEB')
|
|
9
|
-
|
|
10
|
-
# not SUCCEEDED yet: waiting for processing
|
|
11
|
-
expect(payin['Status']).to eq('CREATED')
|
|
12
|
-
expect(payin['ResultCode']).to be_nil
|
|
13
|
-
expect(payin['ResultMessage']).to be_nil
|
|
14
|
-
expect(payin['ExecutionDate']).to be_nil
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe 'CREATE' do
|
|
18
|
-
it 'creates a paypal web payin' do
|
|
19
|
-
created = new_payin_paypal_web
|
|
20
|
-
expect(created['Id']).not_to be_nil
|
|
21
|
-
check_type_and_status(created)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe 'CREATE V2' do
|
|
26
|
-
it 'creates a paypal web v2 payin' do
|
|
27
|
-
created = new_payin_paypal_web_v2
|
|
28
|
-
expect(created['Id']).not_to be_nil
|
|
29
|
-
# generic operation error
|
|
30
|
-
# check_type_and_status(created)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
describe "FETCH" do
|
|
35
|
-
it 'FETCHES a payIn with PayPal account email' do
|
|
36
|
-
pending("Expired PayIn id")
|
|
37
|
-
payin_id = "54088959"
|
|
38
|
-
buyer_account_email = "paypal-buyer-user@mangopay.com"
|
|
39
|
-
payin = MangoPay::PayIn.fetch(id = payin_id)
|
|
40
|
-
|
|
41
|
-
expect(payin).not_to be_nil
|
|
42
|
-
expect(payin["PaypalBuyerAccountEmail"]).not_to be_nil
|
|
43
|
-
expect(payin["PaypalBuyerAccountEmail"]).to eq(buyer_account_email)
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
describe 'FETCH' do
|
|
48
|
-
it 'fetches a payin' do
|
|
49
|
-
created = new_payin_paypal_web
|
|
50
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
51
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
52
|
-
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
|
53
|
-
expect(fetched['CreditedFunds']).to eq(created['CreditedFunds'])
|
|
54
|
-
expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
|
|
55
|
-
check_type_and_status(created)
|
|
56
|
-
check_type_and_status(fetched)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
# skip because of Generic Operation Error
|
|
61
|
-
describe 'FETCH V2' do
|
|
62
|
-
xit 'fetches a payin' do
|
|
63
|
-
created = new_payin_paypal_web_v2
|
|
64
|
-
fetched = MangoPay::PayIn.fetch(created['Id'])
|
|
65
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
66
|
-
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
|
67
|
-
expect(fetched['CreditedFunds']).to eq(created['CreditedFunds'])
|
|
68
|
-
expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
|
|
69
|
-
check_type_and_status(created)
|
|
70
|
-
check_type_and_status(fetched)
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
describe 'Data Collection' do
|
|
75
|
-
it 'creates data collection' do
|
|
76
|
-
created = MangoPay::PayIn::PayPal::Web.create_data_collection(get_data_collection_dto)
|
|
77
|
-
expect(created['dataCollectionId']).not_to be_nil
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
xit 'fetches data collection' do
|
|
81
|
-
# skipped because API 500 error
|
|
82
|
-
created = MangoPay::PayIn::PayPal::Web.create_data_collection(get_data_collection_dto)
|
|
83
|
-
fetched = MangoPay::PayIn::PayPal::Web.get_data_collection(created['dataCollectionId'])
|
|
84
|
-
expect(fetched['DataCollectionId']).to eq(created['dataCollectionId'])
|
|
85
|
-
expect(fetched['sender_first_name']).to eq('Jane')
|
|
86
|
-
expect(fetched['sender_last_name']).to eq('Doe')
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def get_data_collection_dto
|
|
91
|
-
return {
|
|
92
|
-
"sender_account_id": "A12345N343",
|
|
93
|
-
"sender_first_name": "Jane",
|
|
94
|
-
"sender_last_name": "Doe",
|
|
95
|
-
"sender_email": "jane.doe@sample.com",
|
|
96
|
-
"sender_phone": "(042)11234567",
|
|
97
|
-
"sender_address_zip": "75009",
|
|
98
|
-
"sender_country_code": "FR",
|
|
99
|
-
"sender_create_date": "2012-12-09T19:14:55.277-0:00",
|
|
100
|
-
"sender_signup_ip": "10.220.90.20",
|
|
101
|
-
"sender_popularity_score": "high",
|
|
102
|
-
"receiver_account_id": "A12345N344",
|
|
103
|
-
"receiver_create_date": "2012-12-09T19:14:55.277-0:00",
|
|
104
|
-
"receiver_email": "jane@sample.com",
|
|
105
|
-
"receiver_address_country_code": "FR",
|
|
106
|
-
"business_name": "Jane Ltd",
|
|
107
|
-
"recipient_popularity_score": "high",
|
|
108
|
-
"first_interaction_date": "2012-12-09T19:14:55.277-0:00",
|
|
109
|
-
"txn_count_total": "34",
|
|
110
|
-
"vertical": "Household goods",
|
|
111
|
-
"transaction_is_tangible": "0"
|
|
112
|
-
}
|
|
113
|
-
end
|
|
114
|
-
end
|