mangopay4-ruby-sdk 3.47.0 → 4.1.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.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +96 -0
  3. data/lib/mangopay/acquiring.rb +4 -0
  4. data/lib/mangopay/authorization_token.rb +1 -1
  5. data/lib/mangopay/deposit.rb +7 -0
  6. data/lib/mangopay/extended_preauthorization.rb +32 -0
  7. data/lib/mangopay/http_calls.rb +1 -1
  8. data/lib/mangopay/identity_verification.rb +6 -0
  9. data/lib/mangopay/legal_user.rb +3 -0
  10. data/lib/mangopay/natural_user.rb +3 -0
  11. data/lib/mangopay/pay_in.rb +72 -16
  12. data/lib/mangopay/report_v2.rb +2 -2
  13. data/lib/mangopay/version.rb +1 -1
  14. data/lib/mangopay.rb +3 -2
  15. data/mangopay.gemspec +7 -7
  16. metadata +33 -162
  17. data/.github/workflows/ruby_cd.yml +0 -34
  18. data/.github/workflows/ruby_ci.yml +0 -30
  19. data/.gitignore +0 -30
  20. data/.rspec +0 -3
  21. data/Gemfile +0 -2
  22. data/Rakefile +0 -5
  23. data/bin/mangopay +0 -9
  24. data/spec/mangopay/acquiring_spec.rb +0 -202
  25. data/spec/mangopay/authorization_token_spec.rb +0 -70
  26. data/spec/mangopay/bank_account_spec.rb +0 -105
  27. data/spec/mangopay/bankingaliases_spec.rb +0 -29
  28. data/spec/mangopay/card_registration_spec.rb +0 -123
  29. data/spec/mangopay/client_spec.png +0 -0
  30. data/spec/mangopay/client_spec.rb +0 -213
  31. data/spec/mangopay/configuration_spec.rb +0 -249
  32. data/spec/mangopay/conversion_spec.rb +0 -103
  33. data/spec/mangopay/deposit_spec.rb +0 -107
  34. data/spec/mangopay/dispute_spec.png +0 -0
  35. data/spec/mangopay/dispute_spec.rb +0 -294
  36. data/spec/mangopay/event_spec.rb +0 -33
  37. data/spec/mangopay/fetch_filters_spec.rb +0 -63
  38. data/spec/mangopay/hook_spec.rb +0 -37
  39. data/spec/mangopay/idempotency_spec.rb +0 -41
  40. data/spec/mangopay/identity_verification_spec.rb +0 -47
  41. data/spec/mangopay/kyc_document_spec.png +0 -0
  42. data/spec/mangopay/kyc_document_spec.rb +0 -118
  43. data/spec/mangopay/log_requests_filter_spec.rb +0 -26
  44. data/spec/mangopay/mandate_spec.rb +0 -99
  45. data/spec/mangopay/payin_applepay_direct_spec.rb +0 -21
  46. data/spec/mangopay/payin_bancontact_web_spec.rb +0 -30
  47. data/spec/mangopay/payin_bankwire_direct_spec.rb +0 -74
  48. data/spec/mangopay/payin_bankwire_external_instruction_spec.rb +0 -104
  49. data/spec/mangopay/payin_bizum_web_spec.rb +0 -54
  50. data/spec/mangopay/payin_blik_web_spec.rb +0 -41
  51. data/spec/mangopay/payin_card_direct_spec.rb +0 -69
  52. data/spec/mangopay/payin_card_web_spec.rb +0 -64
  53. data/spec/mangopay/payin_directdebit_direct_spec.rb +0 -37
  54. data/spec/mangopay/payin_directdebit_web_spec.rb +0 -38
  55. data/spec/mangopay/payin_giropay_web_spec.rb +0 -30
  56. data/spec/mangopay/payin_googlepay_direct_spec.rb +0 -21
  57. data/spec/mangopay/payin_ideal_web_spec.rb +0 -30
  58. data/spec/mangopay/payin_intent_spec.rb +0 -295
  59. data/spec/mangopay/payin_klarna_web_spec.rb +0 -32
  60. data/spec/mangopay/payin_mbway_web_spec.rb +0 -32
  61. data/spec/mangopay/payin_multibanco_web_spec.rb +0 -31
  62. data/spec/mangopay/payin_paybybank_web_spec.rb +0 -56
  63. data/spec/mangopay/payin_payconiq_web_spec.rb +0 -32
  64. data/spec/mangopay/payin_paypal_web_spec.rb +0 -113
  65. data/spec/mangopay/payin_preauthorized_direct_spec.rb +0 -118
  66. data/spec/mangopay/payin_satispay_web_spec.rb +0 -32
  67. data/spec/mangopay/payin_swish_web_spec.rb +0 -30
  68. data/spec/mangopay/payin_twint_web_spec.rb +0 -30
  69. data/spec/mangopay/payment_method_metadata_spec.rb +0 -15
  70. data/spec/mangopay/payout_bankwire_spec.rb +0 -93
  71. data/spec/mangopay/preauthorization_spec.rb +0 -51
  72. data/spec/mangopay/recipient_spec.rb +0 -134
  73. data/spec/mangopay/recurring_payin_spec.rb +0 -222
  74. data/spec/mangopay/refund_spec.rb +0 -34
  75. data/spec/mangopay/regulatory_spec.rb +0 -26
  76. data/spec/mangopay/report_spec.rb +0 -40
  77. data/spec/mangopay/report_v2_spec.rb +0 -117
  78. data/spec/mangopay/report_wallets_spec.rb +0 -40
  79. data/spec/mangopay/settlement_sample.csv +0 -8
  80. data/spec/mangopay/settlement_sample_bad.csv +0 -8
  81. data/spec/mangopay/settlement_spec.rb +0 -65
  82. data/spec/mangopay/shared_resources.rb +0 -1399
  83. data/spec/mangopay/transaction_spec.rb +0 -59
  84. data/spec/mangopay/transfer_spec.rb +0 -77
  85. data/spec/mangopay/ubo_declaration_spec.rb +0 -44
  86. data/spec/mangopay/ubo_spec.rb +0 -39
  87. data/spec/mangopay/user_spec.rb +0 -455
  88. data/spec/mangopay/virtual_account_spec.rb +0 -52
  89. data/spec/mangopay/wallet_spec.rb +0 -100
  90. data/spec/spec_helper.rb +0 -31
  91. data/spec/tmp/.keep +0 -0
@@ -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,295 +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
- end
53
-
54
- describe 'CANCEL' do
55
- it 'cancels an intent' do
56
- intent = new_payin_intent_authorization
57
- canceled = MangoPay::PayIn::PayInIntent::Intent.cancel(intent['Id'], {
58
- "ExternalData": {
59
- "ExternalProcessingDate": 1728133765,
60
- "ExternalProviderReference": SecureRandom.uuid,
61
- }
62
- })
63
- expect(canceled['Status']).to eq('CANCELLED')
64
- end
65
- end
66
-
67
- describe 'SPLITS' do
68
- it 'creates a split' do
69
- intent = new_payin_intent_authorization
70
- created = create_new_splits(intent)
71
- expect(created['Splits']).to be_kind_of(Array)
72
- expect(created['Splits']).not_to be_empty
73
- expect(created['Splits'][0]['Status']).to eq('CREATED')
74
- end
75
-
76
- it 'executes split' do
77
- intent = new_payin_intent_authorization
78
- split = create_new_splits(intent)['Splits'][0]
79
- expect {
80
- MangoPay::PayIn::PayInIntent::Split.execute(intent['Id'], split['Id'])
81
- }.to raise_error { |err|
82
- expect(err).to be_a MangoPay::ResponseError
83
- expect(err.code).to eq '400'
84
- expect(err.details['Type']).to eq 'param_error'
85
- }
86
- end
87
-
88
- it 'reverses split' do
89
- intent = new_payin_intent_authorization
90
- split = create_new_splits(intent)['Splits'][0]
91
- reversed = MangoPay::PayIn::PayInIntent::Split.reverse(intent['Id'], split['Id'])
92
- expect(reversed['Status']).to eq('REVERSED')
93
- end
94
-
95
- it 'fetches split' do
96
- intent = new_payin_intent_authorization
97
- split = create_new_splits(intent)['Splits'][0]
98
- fetched = MangoPay::PayIn::PayInIntent::Split.get(intent['Id'], split['Id'])
99
- expect(fetched['Status']).to eq('CREATED')
100
- end
101
-
102
- it 'updates split' do
103
- intent = new_payin_intent_authorization
104
- split = create_new_splits(intent)['Splits'][0]
105
- params = {
106
- LineItemId: split['LineItemId'],
107
- Description: 'updated split'
108
- }
109
- updated = MangoPay::PayIn::PayInIntent::Split.update(intent['Id'], split['Id'], params)
110
- expect(updated['Description']).to eq('updated split')
111
- end
112
- end
113
-
114
- describe 'Intent Refund' do
115
- it 'creates a full refund' do
116
- created_refund = create_new_intent_full_refund
117
- expect(created_refund['Id']).not_to be_nil
118
- expect(created_refund['Status']).to eq('REFUNDED')
119
- end
120
-
121
- it 'creates a partial refund' do
122
- full_capture = create_new_intent_full_capture
123
- to_create = {
124
- "Amount": 1000,
125
- "LineItems": [
126
- {
127
- "Id": full_capture['LineItems'][0]['Id'],
128
- "Amount": 1000
129
- }
130
- ],
131
- "ExternalData": {
132
- "ExternalProcessingDate": 1727913600,
133
- "ExternalProviderReference": SecureRandom.uuid,
134
- "ExternalMerchantReference": SecureRandom.uuid,
135
- "ExternalProviderName": "Stripe",
136
- "ExternalProviderPaymentMethod": "PAYPAL"
137
- }
138
- }
139
- created_refund = MangoPay::PayIn::PayInIntent::Refund.create(full_capture['Id'], to_create)
140
- expect(created_refund['Id']).not_to be_nil
141
- expect(created_refund['Status']).to eq('REFUNDED')
142
- end
143
-
144
- it 'fully reverses a refund' do
145
- created_refund = create_new_intent_full_refund
146
- to_create = {
147
- "ExternalData": {
148
- "ExternalProcessingDate": 1727913600,
149
- "ExternalProviderReference": SecureRandom.uuid,
150
- "ExternalMerchantReference": SecureRandom.uuid,
151
- "ExternalProviderName": "Stripe",
152
- "ExternalProviderPaymentMethod": "PAYPAL"
153
- }
154
- }
155
- reversed_refund = MangoPay::PayIn::PayInIntent::Refund.reverse(created_refund['Id'], created_refund['Refund']['Id'], to_create)
156
- expect(reversed_refund['Id']).not_to be_nil
157
- expect(reversed_refund['Status']).to eq('REFUND_REVERSED')
158
- end
159
-
160
- it 'partially reverses a refund' do
161
- created_refund = create_new_intent_full_refund
162
- to_create = {
163
- "Amount": 1000,
164
- "LineItems": [
165
- {
166
- "Id": created_refund['LineItems'][0]['Id'],
167
- "Amount": 1000
168
- }
169
- ],
170
- "ExternalData": {
171
- "ExternalProcessingDate": 1727913600,
172
- "ExternalProviderReference": SecureRandom.uuid,
173
- "ExternalMerchantReference": SecureRandom.uuid,
174
- "ExternalProviderName": "Stripe",
175
- "ExternalProviderPaymentMethod": "PAYPAL"
176
- }
177
- }
178
- reversed_refund = MangoPay::PayIn::PayInIntent::Refund.reverse(created_refund['Id'], created_refund['Refund']['Id'], to_create)
179
- expect(reversed_refund['Id']).not_to be_nil
180
- expect(reversed_refund['Status']).to eq('REFUND_REVERSED')
181
- end
182
-
183
- it 'creates a full dispute' do
184
- capture = create_new_intent_full_capture
185
- to_create = {
186
- "ExternalData": {
187
- "ExternalProcessingDate": 1727913600,
188
- "ExternalProviderReference": SecureRandom.uuid,
189
- "ExternalMerchantReference": SecureRandom.uuid,
190
- "ExternalProviderName": "Stripe",
191
- "ExternalProviderPaymentMethod": "PAYPAL"
192
- }
193
- }
194
- created_dispute = MangoPay::PayIn::PayInIntent::Dispute.create(capture['Id'], capture['Capture']['Id'], to_create)
195
- expect(created_dispute['Id']).not_to be_nil
196
- expect(created_dispute['Status']).to eq('DISPUTED')
197
- end
198
-
199
- it 'creates a partial dispute' do
200
- capture = create_new_intent_full_capture
201
- to_create = {
202
- "Amount": 1000,
203
- "LineItems": [
204
- {
205
- "Id": capture['LineItems'][0]['Id'],
206
- "Amount": 1000
207
- }
208
- ],
209
- "ExternalData": {
210
- "ExternalProcessingDate": 1727913600,
211
- "ExternalProviderReference": SecureRandom.uuid,
212
- "ExternalMerchantReference": SecureRandom.uuid,
213
- "ExternalProviderName": "Stripe",
214
- "ExternalProviderPaymentMethod": "PAYPAL"
215
- }
216
- }
217
- created_dispute = MangoPay::PayIn::PayInIntent::Dispute.create(capture['Id'], capture['Capture']['Id'], to_create)
218
- expect(created_dispute['Id']).not_to be_nil
219
- expect(created_dispute['Status']).to eq('DISPUTED')
220
- end
221
-
222
- it 'updates dispute outcome' do
223
- capture = create_new_intent_full_capture
224
- to_create = {
225
- "ExternalData": {
226
- "ExternalProcessingDate": 1727913600,
227
- "ExternalProviderReference": SecureRandom.uuid,
228
- "ExternalMerchantReference": SecureRandom.uuid,
229
- "ExternalProviderName": "Stripe",
230
- "ExternalProviderPaymentMethod": "PAYPAL"
231
- }
232
- }
233
- created_dispute = MangoPay::PayIn::PayInIntent::Dispute.create(capture['Id'], capture['Capture']['Id'], to_create)
234
-
235
- dto = {
236
- "Decision": "DEFENDED"
237
- }
238
- updated = MangoPay::PayIn::PayInIntent::Dispute.update_outcome(capture['Id'], capture['Capture']['Id'], created_dispute['Dispute']['Id'], dto)
239
-
240
- expect(updated['Id']).not_to be_nil
241
- expect(updated['Decision']).to eq('DEFENDED')
242
- end
243
- end
244
-
245
- def create_new_splits(intent)
246
- full_capture = {
247
- "ExternalData": {
248
- "ExternalProcessingDate": "01-10-2029",
249
- "ExternalProviderReference": SecureRandom.uuid,
250
- "ExternalMerchantReference": "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
251
- "ExternalProviderName": "Stripe",
252
- "ExternalProviderPaymentMethod": "PAYPAL"
253
- }
254
- }
255
- MangoPay::PayIn::PayInIntent::Capture.create(intent['Id'], full_capture)
256
- split = {
257
- "Splits": [
258
- {
259
- "LineItemId": intent['LineItems'][0]['Id'],
260
- "SplitAmount": 10
261
- }
262
- ]
263
- }
264
- return MangoPay::PayIn::PayInIntent::Split.create(intent['Id'], split)
265
- end
266
-
267
- def create_new_intent_full_capture
268
- intent = new_payin_intent_authorization
269
- to_create = {
270
- "ExternalData": {
271
- "ExternalProcessingDate": "01-10-2029",
272
- "ExternalProviderReference": SecureRandom.uuid,
273
- "ExternalMerchantReference": "Order-xyz-35e8490e-2ec9-4c82-978e-c712a3f5ba16",
274
- "ExternalProviderName": "Stripe",
275
- "ExternalProviderPaymentMethod": "PAYPAL"
276
- }
277
- }
278
-
279
- return MangoPay::PayIn::PayInIntent::Capture.create(intent['Id'], to_create)
280
- end
281
-
282
- def create_new_intent_full_refund
283
- full_capture = create_new_intent_full_capture
284
- to_create = {
285
- "ExternalData": {
286
- "ExternalProcessingDate": 1727913600,
287
- "ExternalProviderReference": SecureRandom.uuid,
288
- "ExternalMerchantReference": SecureRandom.uuid,
289
- "ExternalProviderName": "Stripe",
290
- "ExternalProviderPaymentMethod": "PAYPAL"
291
- }
292
- }
293
- return MangoPay::PayIn::PayInIntent::Refund.create(full_capture['Id'], to_create)
294
- end
295
- 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,32 +0,0 @@
1
- describe MangoPay::PayIn::Payconiq::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('PAYCONIQ')
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 payconiq web payin' do
19
- created = new_payin_payconiq_web
20
- expect(created['Id']).not_to be_nil
21
- check_type_and_status(created)
22
- end
23
-
24
- # endpoint removed
25
- xit 'creates a payconiq web payin using the old endpoint' do
26
- created = new_payin_payconiq_web_legacy
27
- expect(created['Id']).not_to be_nil
28
- check_type_and_status(created)
29
- end
30
- end
31
-
32
- end
@@ -1,113 +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
- it 'fetches data collection' do
81
- created = MangoPay::PayIn::PayPal::Web.create_data_collection(get_data_collection_dto)
82
- fetched = MangoPay::PayIn::PayPal::Web.get_data_collection(created['dataCollectionId'])
83
- expect(fetched['DataCollectionId']).to eq(created['dataCollectionId'])
84
- expect(fetched['sender_first_name']).to eq('Jane')
85
- expect(fetched['sender_last_name']).to eq('Doe')
86
- end
87
- end
88
-
89
- def get_data_collection_dto
90
- return {
91
- "sender_account_id": "A12345N343",
92
- "sender_first_name": "Jane",
93
- "sender_last_name": "Doe",
94
- "sender_email": "jane.doe@sample.com",
95
- "sender_phone": "(042)11234567",
96
- "sender_address_zip": "75009",
97
- "sender_country_code": "FR",
98
- "sender_create_date": "2012-12-09T19:14:55.277-0:00",
99
- "sender_signup_ip": "10.220.90.20",
100
- "sender_popularity_score": "high",
101
- "receiver_account_id": "A12345N344",
102
- "receiver_create_date": "2012-12-09T19:14:55.277-0:00",
103
- "receiver_email": "jane@sample.com",
104
- "receiver_address_country_code": "FR",
105
- "business_name": "Jane Ltd",
106
- "recipient_popularity_score": "high",
107
- "first_interaction_date": "2012-12-09T19:14:55.277-0:00",
108
- "txn_count_total": "34",
109
- "vertical": "Household goods",
110
- "transaction_is_tangible": "0"
111
- }
112
- end
113
- end