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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +96 -0
- data/lib/mangopay/acquiring.rb +4 -0
- data/lib/mangopay/authorization_token.rb +1 -1
- data/lib/mangopay/deposit.rb +7 -0
- data/lib/mangopay/extended_preauthorization.rb +32 -0
- data/lib/mangopay/http_calls.rb +1 -1
- data/lib/mangopay/identity_verification.rb +6 -0
- data/lib/mangopay/legal_user.rb +3 -0
- data/lib/mangopay/natural_user.rb +3 -0
- data/lib/mangopay/pay_in.rb +72 -16
- data/lib/mangopay/report_v2.rb +2 -2
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay.rb +3 -2
- data/mangopay.gemspec +7 -7
- metadata +33 -162
- 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 -202
- 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 -107
- 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 -47
- 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 -295
- 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_payconiq_web_spec.rb +0 -32
- data/spec/mangopay/payin_paypal_web_spec.rb +0 -113
- data/spec/mangopay/payin_preauthorized_direct_spec.rb +0 -118
- 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 -93
- data/spec/mangopay/preauthorization_spec.rb +0 -51
- data/spec/mangopay/recipient_spec.rb +0 -134
- data/spec/mangopay/recurring_payin_spec.rb +0 -222
- 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 -1399
- 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,222 +0,0 @@
|
|
|
1
|
-
describe MangoPay::PayIn::RecurringPayments, type: :feature do
|
|
2
|
-
include_context 'wallets'
|
|
3
|
-
include_context 'users'
|
|
4
|
-
include_context 'payins'
|
|
5
|
-
|
|
6
|
-
describe 'CREATE' do
|
|
7
|
-
it 'creates a recurring payment' do
|
|
8
|
-
cardreg = new_card_registration_completed
|
|
9
|
-
wallet = new_wallet
|
|
10
|
-
recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
|
|
11
|
-
AuthorId: new_natural_user['Id'],
|
|
12
|
-
CardId: cardreg['CardId'],
|
|
13
|
-
CreditedUserId: wallet['Owners'][0],
|
|
14
|
-
CreditedWalletId: wallet['Id'],
|
|
15
|
-
FirstTransactionDebitedFunds: {Currency: 'EUR', Amount: 10},
|
|
16
|
-
FirstTransactionFees: {Currency: 'EUR', Amount: 1},
|
|
17
|
-
Billing: {
|
|
18
|
-
Address: {
|
|
19
|
-
AddressLine1: 'AddressLine1',
|
|
20
|
-
AddressLine2: 'AddressLine2',
|
|
21
|
-
City: 'City',
|
|
22
|
-
Region: 'Region',
|
|
23
|
-
PostalCode: 'PostalCode',
|
|
24
|
-
Country: 'FR'
|
|
25
|
-
},
|
|
26
|
-
FirstName: 'Joe',
|
|
27
|
-
LastName: 'Blogs'
|
|
28
|
-
},
|
|
29
|
-
Shipping: {
|
|
30
|
-
Address: {
|
|
31
|
-
AddressLine1: 'AddressLine1',
|
|
32
|
-
AddressLine2: 'AddressLine2',
|
|
33
|
-
City: 'City',
|
|
34
|
-
Region: 'Region',
|
|
35
|
-
PostalCode: 'PostalCode',
|
|
36
|
-
Country: 'FR'
|
|
37
|
-
},
|
|
38
|
-
FirstName: 'Joe',
|
|
39
|
-
LastName: 'Blogs'
|
|
40
|
-
},
|
|
41
|
-
FreeCycles: 0
|
|
42
|
-
)
|
|
43
|
-
expect(recurring).not_to be_nil
|
|
44
|
-
expect(recurring['Status']).not_to be_nil
|
|
45
|
-
expect(recurring['Id']).not_to be_nil
|
|
46
|
-
expect(recurring['FreeCycles']).not_to be_nil
|
|
47
|
-
|
|
48
|
-
id = recurring['Id']
|
|
49
|
-
|
|
50
|
-
get = MangoPay::PayIn::RecurringPayments::Recurring.fetch(id)
|
|
51
|
-
expect(get).not_to be_nil
|
|
52
|
-
expect(get['FreeCycles']).not_to be_nil
|
|
53
|
-
|
|
54
|
-
cit = MangoPay::PayIn::RecurringPayments::CIT.create(
|
|
55
|
-
RecurringPayinRegistrationId: recurring['Id'],
|
|
56
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
|
57
|
-
SecureModeReturnURL: "http://www.my-site.com/returnurl",
|
|
58
|
-
StatementDescriptor: "lorem",
|
|
59
|
-
Tag: "custom meta",
|
|
60
|
-
BrowserInfo: {
|
|
61
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
62
|
-
JavaEnabled: true,
|
|
63
|
-
Language: "FR-FR",
|
|
64
|
-
ColorDepth: 4,
|
|
65
|
-
ScreenHeight: 1800,
|
|
66
|
-
ScreenWidth: 400,
|
|
67
|
-
JavascriptEnabled: true,
|
|
68
|
-
TimeZoneOffset: "+60",
|
|
69
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
expect(cit).not_to be_nil
|
|
74
|
-
|
|
75
|
-
update = MangoPay::PayIn::RecurringPayments::Recurring.update(id, {
|
|
76
|
-
Status: 'ENDED'
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
expect(update).not_to be_nil
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
it 'creates a recurring paypal payment CIT' do
|
|
83
|
-
wallet = new_wallet
|
|
84
|
-
recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
|
|
85
|
-
AuthorId: new_natural_user['Id'],
|
|
86
|
-
CreditedUserId: wallet['Owners'][0],
|
|
87
|
-
CreditedWalletId: wallet['Id'],
|
|
88
|
-
FirstTransactionDebitedFunds: {Currency: 'EUR', Amount: 1000},
|
|
89
|
-
FirstTransactionFees: {Currency: 'EUR', Amount: 0},
|
|
90
|
-
Billing: {
|
|
91
|
-
Address: {
|
|
92
|
-
AddressLine1: 'AddressLine1',
|
|
93
|
-
AddressLine2: 'AddressLine2',
|
|
94
|
-
City: 'City',
|
|
95
|
-
Region: 'Region',
|
|
96
|
-
PostalCode: 'PostalCode',
|
|
97
|
-
Country: 'FR'
|
|
98
|
-
},
|
|
99
|
-
FirstName: 'Joe',
|
|
100
|
-
LastName: 'Blogs'
|
|
101
|
-
},
|
|
102
|
-
Shipping: {
|
|
103
|
-
Address: {
|
|
104
|
-
AddressLine1: 'AddressLine1',
|
|
105
|
-
AddressLine2: 'AddressLine2',
|
|
106
|
-
City: 'City',
|
|
107
|
-
Region: 'Region',
|
|
108
|
-
PostalCode: 'PostalCode',
|
|
109
|
-
Country: 'FR'
|
|
110
|
-
},
|
|
111
|
-
FirstName: 'Joe',
|
|
112
|
-
LastName: 'Blogs'
|
|
113
|
-
},
|
|
114
|
-
PaymentType: 'PAYPAL'
|
|
115
|
-
)
|
|
116
|
-
expect(recurring).not_to be_nil
|
|
117
|
-
expect(recurring['Status']).not_to be_nil
|
|
118
|
-
expect(recurring['Id']).not_to be_nil
|
|
119
|
-
|
|
120
|
-
cit = MangoPay::PayIn::RecurringPayments::PayPalCIT.create(
|
|
121
|
-
{
|
|
122
|
-
"ReturnURL": "http://example.com",
|
|
123
|
-
"CancelURL": "http://example.net",
|
|
124
|
-
"LineItems": [
|
|
125
|
-
{
|
|
126
|
-
"Name": "Running shoes",
|
|
127
|
-
"Quantity": 1,
|
|
128
|
-
"UnitAmount": 1000,
|
|
129
|
-
"TaxAmount": 0,
|
|
130
|
-
"Description": "ID of Seller 1",
|
|
131
|
-
"Category": "PHYSICAL_GOODS"
|
|
132
|
-
}
|
|
133
|
-
],
|
|
134
|
-
"Tag": "Created using the Mangopay API Postman collection",
|
|
135
|
-
"RecurringPayinRegistrationId": recurring['Id'],
|
|
136
|
-
"ShippingPreference": "SET_PROVIDED_ADDRESS",
|
|
137
|
-
"Reference": "abcd-efgh-ijkl",
|
|
138
|
-
"StatementDescriptor": "Example123"
|
|
139
|
-
}
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
expect(cit).not_to be_nil
|
|
143
|
-
# expect(cit['Status']).to eq('CREATED')
|
|
144
|
-
expect(cit['PaymentType']).to eq('PAYPAL')
|
|
145
|
-
expect(cit['ExecutionType']).to eq('WEB')
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
it 'creates a recurring paypal payment MIT' do
|
|
149
|
-
wallet = new_wallet
|
|
150
|
-
recurring = MangoPay::PayIn::RecurringPayments::Recurring.create(
|
|
151
|
-
AuthorId: new_natural_user['Id'],
|
|
152
|
-
CreditedUserId: wallet['Owners'][0],
|
|
153
|
-
CreditedWalletId: wallet['Id'],
|
|
154
|
-
FirstTransactionDebitedFunds: {Currency: 'EUR', Amount: 1000},
|
|
155
|
-
FirstTransactionFees: {Currency: 'EUR', Amount: 0},
|
|
156
|
-
Billing: {
|
|
157
|
-
Address: {
|
|
158
|
-
AddressLine1: 'AddressLine1',
|
|
159
|
-
AddressLine2: 'AddressLine2',
|
|
160
|
-
City: 'City',
|
|
161
|
-
Region: 'Region',
|
|
162
|
-
PostalCode: 'PostalCode',
|
|
163
|
-
Country: 'FR'
|
|
164
|
-
},
|
|
165
|
-
FirstName: 'Joe',
|
|
166
|
-
LastName: 'Blogs'
|
|
167
|
-
},
|
|
168
|
-
Shipping: {
|
|
169
|
-
Address: {
|
|
170
|
-
AddressLine1: 'AddressLine1',
|
|
171
|
-
AddressLine2: 'AddressLine2',
|
|
172
|
-
City: 'City',
|
|
173
|
-
Region: 'Region',
|
|
174
|
-
PostalCode: 'PostalCode',
|
|
175
|
-
Country: 'FR'
|
|
176
|
-
},
|
|
177
|
-
FirstName: 'Joe',
|
|
178
|
-
LastName: 'Blogs'
|
|
179
|
-
},
|
|
180
|
-
PaymentType: 'PAYPAL'
|
|
181
|
-
)
|
|
182
|
-
expect(recurring).not_to be_nil
|
|
183
|
-
expect(recurring['Status']).not_to be_nil
|
|
184
|
-
expect(recurring['Id']).not_to be_nil
|
|
185
|
-
|
|
186
|
-
cit = MangoPay::PayIn::RecurringPayments::PayPalMIT.create(
|
|
187
|
-
{
|
|
188
|
-
"ReturnURL": "http://example.com",
|
|
189
|
-
"CancelURL": "http://example.net",
|
|
190
|
-
"LineItems": [
|
|
191
|
-
{
|
|
192
|
-
"Name": "Running shoes",
|
|
193
|
-
"Quantity": 1,
|
|
194
|
-
"UnitAmount": 1000,
|
|
195
|
-
"TaxAmount": 0,
|
|
196
|
-
"Description": "ID of Seller 1",
|
|
197
|
-
"Category": "PHYSICAL_GOODS"
|
|
198
|
-
}
|
|
199
|
-
],
|
|
200
|
-
"Tag": "Created using the Mangopay API Postman collection",
|
|
201
|
-
"RecurringPayinRegistrationId": recurring['Id'],
|
|
202
|
-
"ShippingPreference": "SET_PROVIDED_ADDRESS",
|
|
203
|
-
"Reference": "abcd-efgh-ijkl",
|
|
204
|
-
"StatementDescriptor": "Example123",
|
|
205
|
-
"DebitedFunds": {
|
|
206
|
-
"Currency": "EUR",
|
|
207
|
-
"Amount": 1000
|
|
208
|
-
},
|
|
209
|
-
"Fees": {
|
|
210
|
-
"Currency": "EUR",
|
|
211
|
-
"Amount": 0
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
)
|
|
215
|
-
|
|
216
|
-
expect(cit).not_to be_nil
|
|
217
|
-
# expect(cit['Status']).to eq('CREATED')
|
|
218
|
-
expect(cit['PaymentType']).to eq('PAYPAL')
|
|
219
|
-
expect(cit['ExecutionType']).to eq('WEB')
|
|
220
|
-
end
|
|
221
|
-
end
|
|
222
|
-
end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
describe MangoPay::Refund do
|
|
2
|
-
include_context 'transfers'
|
|
3
|
-
|
|
4
|
-
describe 'FETCH' do
|
|
5
|
-
it 'fetches a refund' do
|
|
6
|
-
transfer = new_transfer
|
|
7
|
-
resource = MangoPay::Transfer.refund(transfer['Id'], { AuthorId: transfer['AuthorId'] })
|
|
8
|
-
|
|
9
|
-
refund = MangoPay::Refund.fetch(resource['Id'])
|
|
10
|
-
|
|
11
|
-
expect(refund['Id']).not_to be_nil
|
|
12
|
-
expect(refund['Status']).to eq('SUCCEEDED')
|
|
13
|
-
expect(refund['Type']).to eq('TRANSFER')
|
|
14
|
-
expect(refund['Nature']).to eq('REFUND')
|
|
15
|
-
expect(refund['InitialTransactionType']).to eq('TRANSFER')
|
|
16
|
-
expect(refund['InitialTransactionId']).to eq(transfer['Id'])
|
|
17
|
-
expect(refund['DebitedWalletId']).to eq(transfer['CreditedWalletId'])
|
|
18
|
-
expect(refund['CreditedWalletId']).to eq(transfer['DebitedWalletId'])
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
#describe 'FETCH for Repudiation' do
|
|
23
|
-
# it "fetches a repudiation's refunds" do
|
|
24
|
-
# disputes = MangoPay::Dispute.fetch
|
|
25
|
-
# dispute = disputes.find do |dispute|
|
|
26
|
-
# dispute['DisputeType'] == 'NOT_CONTESTABLE'\
|
|
27
|
-
# && !dispute['InitialTransactionId'].nil?
|
|
28
|
-
# end
|
|
29
|
-
# repudiation_id = MangoPay::Dispute.transactions(dispute['Id'])[0]['Id']
|
|
30
|
-
# refunds = MangoPay::Refund.of_repudiation(repudiation_id)
|
|
31
|
-
# expect(refunds).to be_an(Array)
|
|
32
|
-
# end
|
|
33
|
-
# end
|
|
34
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
describe MangoPay::Regulatory do
|
|
2
|
-
|
|
3
|
-
describe 'GET Country Authorizations' do
|
|
4
|
-
it 'can get country authorizations' do
|
|
5
|
-
country_authorizations = MangoPay::Regulatory.get_country_authorizations('FR')
|
|
6
|
-
|
|
7
|
-
expect(country_authorizations).not_to be_nil
|
|
8
|
-
expect(country_authorizations['CountryCode']).not_to be_nil
|
|
9
|
-
expect(country_authorizations['CountryName']).not_to be_nil
|
|
10
|
-
expect(country_authorizations['Authorization']).not_to be_nil
|
|
11
|
-
expect(country_authorizations['LastUpdate']).not_to be_nil
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe 'GET All Countries Authorizations' do
|
|
16
|
-
it 'can get all countries authorizations' do
|
|
17
|
-
country_authorizations = MangoPay::Regulatory.get_all_countries_authorizations
|
|
18
|
-
|
|
19
|
-
expect(country_authorizations).not_to be_nil
|
|
20
|
-
expect(country_authorizations[0]['CountryCode']).not_to be_nil
|
|
21
|
-
expect(country_authorizations[0]['CountryName']).not_to be_nil
|
|
22
|
-
expect(country_authorizations[0]['Authorization']).not_to be_nil
|
|
23
|
-
expect(country_authorizations[0]['LastUpdate']).not_to be_nil
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
describe MangoPay::Report do
|
|
2
|
-
|
|
3
|
-
def create
|
|
4
|
-
params = {
|
|
5
|
-
Tag: 'custom meta',
|
|
6
|
-
CallbackURL: 'http://www.my-site.com/callbackURL/',
|
|
7
|
-
DownloadFormat: 'CSV',
|
|
8
|
-
Sort: 'CreationDate:DESC',
|
|
9
|
-
Preview: false,
|
|
10
|
-
Filters: {},
|
|
11
|
-
Columns: [ 'Id', 'CreationDate' ],
|
|
12
|
-
ReportType: 'transactions'
|
|
13
|
-
}
|
|
14
|
-
MangoPay::Report.create(params)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe 'CREATE' do
|
|
18
|
-
it 'creates a report' do
|
|
19
|
-
created = create
|
|
20
|
-
expect(created['Id']).to_not be_nil
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
describe 'FETCH' do
|
|
25
|
-
|
|
26
|
-
it 'fetches a report' do
|
|
27
|
-
created = create
|
|
28
|
-
fetched = MangoPay::Report.fetch(created['Id'])
|
|
29
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it 'fetches all the reports' do
|
|
33
|
-
reports = MangoPay::Report.fetch()
|
|
34
|
-
expect(reports).to be_kind_of(Array)
|
|
35
|
-
expect(reports).not_to be_empty
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
end
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
describe MangoPay::ReportV2 do
|
|
2
|
-
|
|
3
|
-
def create
|
|
4
|
-
params = {
|
|
5
|
-
"Tag": "Created using the Mangopay API Postman collection",
|
|
6
|
-
"DownloadFormat": "CSV",
|
|
7
|
-
"ReportType": "COLLECTED_FEES",
|
|
8
|
-
"AfterDate": 1740787200,
|
|
9
|
-
"BeforeDate": 1743544740
|
|
10
|
-
}
|
|
11
|
-
MangoPay::ReportV2.create(params)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe 'CREATE' do
|
|
15
|
-
it 'creates a report v2' do
|
|
16
|
-
created = create
|
|
17
|
-
expect(created['Id']).to_not be_nil
|
|
18
|
-
expect(created['Status']).to eq("PENDING")
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'creates an intent report' do
|
|
22
|
-
params = {
|
|
23
|
-
"DownloadFormat": "CSV",
|
|
24
|
-
"ReportType": "ECHO_INTENT",
|
|
25
|
-
"AfterDate": 1748782023,
|
|
26
|
-
"BeforeDate": 1753102013,
|
|
27
|
-
"Filters": {
|
|
28
|
-
"PaymentMethod": "PAYPAL",
|
|
29
|
-
"Status": "CAPTURED",
|
|
30
|
-
"Type": "PAYIN"
|
|
31
|
-
},
|
|
32
|
-
"Columns": %w[Id Status Amount Currency FeesAmount FeesCurrency Type PaymentMethod BuyerId SellerId]
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
created = MangoPay::ReportV2.create(params)
|
|
36
|
-
expect(created['Id']).to_not be_nil
|
|
37
|
-
expect(created['Status']).to eq("PENDING")
|
|
38
|
-
expect(created['ReportType']).to eq("ECHO_INTENT")
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it 'creates an intent actions report' do
|
|
42
|
-
params = {
|
|
43
|
-
"DownloadFormat": "CSV",
|
|
44
|
-
"ReportType": "ECHO_INTENT_ACTION",
|
|
45
|
-
"AfterDate": 1748782023,
|
|
46
|
-
"BeforeDate": 1753102013,
|
|
47
|
-
"Filters": {
|
|
48
|
-
"PaymentMethod": "PAYPAL",
|
|
49
|
-
"Status": "CAPTURED",
|
|
50
|
-
"Type": "PAYIN"
|
|
51
|
-
},
|
|
52
|
-
"Columns": %w[IntentId Id ExternalProcessingDate ExternalProviderReference ExternalMerchantReference Status Amount Currency FeesAmount FeesCurrency Type PaymentMethod BuyerId SellerId]
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
created = MangoPay::ReportV2.create(params)
|
|
56
|
-
expect(created['Id']).to_not be_nil
|
|
57
|
-
expect(created['Status']).to eq("PENDING")
|
|
58
|
-
expect(created['ReportType']).to eq("ECHO_INTENT_ACTION")
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
it 'creates settlement report' do
|
|
62
|
-
params = {
|
|
63
|
-
"Tag": "Creating a report using new Mangopay system",
|
|
64
|
-
"DownloadFormat": "CSV",
|
|
65
|
-
"ReportType": "ECHO_SETTLEMENT",
|
|
66
|
-
"AfterDate": 1748782023,
|
|
67
|
-
"BeforeDate": 1753102013,
|
|
68
|
-
"Filters": {
|
|
69
|
-
"Status": "RECONCILED",
|
|
70
|
-
"ExternalProviderName": "PAYPAL"
|
|
71
|
-
},
|
|
72
|
-
"Columns": %w[Id CreationDate FileName SettlementCurrency Status SettledTransactionCount UnsettledTransactionCount SettledAmount DeclaredAmount DeficitAmount]
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
created = MangoPay::ReportV2.create(params)
|
|
76
|
-
expect(created['Id']).to_not be_nil
|
|
77
|
-
expect(created['Status']).to eq("PENDING")
|
|
78
|
-
expect(created['ReportType']).to eq("ECHO_SETTLEMENT")
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
it 'creates split report' do
|
|
83
|
-
params = {
|
|
84
|
-
"Tag": "Creating a report using new Mangopay system",
|
|
85
|
-
"DownloadFormat": "CSV",
|
|
86
|
-
"ReportType": "ECHO_SPLIT",
|
|
87
|
-
"AfterDate": 1748782023,
|
|
88
|
-
"BeforeDate": 1753102013,
|
|
89
|
-
"Filters": {
|
|
90
|
-
"Status": "COMPLETED",
|
|
91
|
-
"IntentId": "int_0197f975-63f6-714e-8fc6-4451e128170f",
|
|
92
|
-
"Scheduled": false
|
|
93
|
-
},
|
|
94
|
-
"Columns": %w[Id IntentId AuthorId Amount Currency FeesAmount FeesCurrency Status Description CreditedWalletId DebitedWalletId Scheduled CreationDate ExecutionDate]
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
created = MangoPay::ReportV2.create(params)
|
|
98
|
-
expect(created['Id']).to_not be_nil
|
|
99
|
-
expect(created['Status']).to eq("PENDING")
|
|
100
|
-
expect(created['ReportType']).to eq("ECHO_SPLIT")
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
describe 'GET' do
|
|
104
|
-
it 'gets a report' do
|
|
105
|
-
created = create
|
|
106
|
-
fetched = MangoPay::ReportV2.get(created['Id'])
|
|
107
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
it 'gets all the reports' do
|
|
111
|
-
reports = MangoPay::ReportV2.get_all
|
|
112
|
-
expect(reports).to be_kind_of(Array)
|
|
113
|
-
expect(reports).not_to be_empty
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
describe MangoPay::Report do
|
|
2
|
-
|
|
3
|
-
def create
|
|
4
|
-
params = {
|
|
5
|
-
Tag: 'custom meta',
|
|
6
|
-
CallbackURL: 'http://www.my-site.com/callbackURL/',
|
|
7
|
-
DownloadFormat: 'CSV',
|
|
8
|
-
Sort: 'CreationDate:DESC',
|
|
9
|
-
Preview: false,
|
|
10
|
-
Filters: {},
|
|
11
|
-
Columns: [ 'Id', 'CreationDate' ],
|
|
12
|
-
ReportType: 'wallets'
|
|
13
|
-
}
|
|
14
|
-
MangoPay::Report.create(params)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe 'CREATE' do
|
|
18
|
-
it 'creates a report' do
|
|
19
|
-
created = create
|
|
20
|
-
expect(created['Id']).to_not be_nil
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
describe 'FETCH' do
|
|
25
|
-
|
|
26
|
-
it 'fetches a report' do
|
|
27
|
-
created = create
|
|
28
|
-
fetched = MangoPay::Report.fetch(created['Id'])
|
|
29
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
it 'fetches all the reports' do
|
|
33
|
-
reports = MangoPay::Report.fetch()
|
|
34
|
-
expect(reports).to be_kind_of(Array)
|
|
35
|
-
expect(reports).not_to be_empty
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
end
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
ExternalProviderReference,ExternalPaymentMethod,ExternalTransactionType,ExternalTransactionStatus,ExternalProcessingDate,Amount,Currency,ExternalInitialReference,ExternalProviderFees
|
|
2
|
-
6TU984332A894613W,PAYPAL,PAYMENT,SETTLED,19-06-2025,1000,EUR,,0
|
|
3
|
-
,,,,,,,,
|
|
4
|
-
SettlementDate,19-06-2025,,,,,,,
|
|
5
|
-
ExternalProviderName,Paypal,,,,,,,
|
|
6
|
-
TotalSettlementFeesAmount,0,,,,,,,
|
|
7
|
-
TotalNetSettlementAmount,1000,,,,,,,
|
|
8
|
-
SettlementCurrency,EUR,,,,,,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
ExternalProviderReference,ExternalPaymentMethod,ExternalTransactionType,ExternalTransactionStatus,ExternalProcessingDate,Amount,Currency,ExternalInitialReference,ExternalProviderFees
|
|
2
|
-
6TU984332A894613W,PAYPAL,PAYMENT,SETTLED,19-06-2025,1000,EUR,,0
|
|
3
|
-
,,,,,,,,
|
|
4
|
-
SettlementDate,19-06-2025,,,,,,,
|
|
5
|
-
ExternalProviderName,Paypal,,,,,,,
|
|
6
|
-
TotalSettlementFeesAmount,0,,,,,,,
|
|
7
|
-
TotalNetSettlementAmount,999999,,,,,,,
|
|
8
|
-
SettlementCurrency,EUR,,,,,,
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
describe MangoPay::Settlement do
|
|
2
|
-
|
|
3
|
-
let!(:settlement) do
|
|
4
|
-
create_settlement_if_needed
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def create_settlement_if_needed
|
|
8
|
-
@settlement ||= begin
|
|
9
|
-
MangoPay::Settlement.generate_upload_url({FileName: 'settlement_sample.csv'})
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def upload_file(upload_url, file_name)
|
|
14
|
-
file_path = File.expand_path(file_name, __dir__)
|
|
15
|
-
file_content = File.binread(file_path)
|
|
16
|
-
|
|
17
|
-
uri = URI(upload_url)
|
|
18
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
|
19
|
-
http.use_ssl = (uri.scheme == 'https')
|
|
20
|
-
|
|
21
|
-
request = Net::HTTP::Put.new(uri)
|
|
22
|
-
request.body = file_content
|
|
23
|
-
request['Content-Type'] = 'text/csv'
|
|
24
|
-
|
|
25
|
-
http.request(request)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
describe 'UPLOAD' do
|
|
29
|
-
it 'generates the upload URL' do
|
|
30
|
-
expect(@settlement['SettlementId']).not_to be_nil
|
|
31
|
-
expect(@settlement['UploadUrl']).not_to be_nil
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it 'generates a new upload URL' do
|
|
35
|
-
new_url = MangoPay::Settlement.generate_new_upload_url(@settlement['SettlementId'], {FileName: 'settlement_sample.csv'})
|
|
36
|
-
expect(new_url['SettlementId']).not_to be_nil
|
|
37
|
-
expect(new_url['UploadUrl']).not_to be_nil
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it 'uploads the file' do
|
|
41
|
-
response = upload_file(@settlement['UploadUrl'], 'settlement_sample.csv')
|
|
42
|
-
expect(response.code.to_i).to eq(200)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it 'fetches validations' do
|
|
46
|
-
upload_file(@settlement['UploadUrl'], 'settlement_sample_bad.csv')
|
|
47
|
-
validations = MangoPay::Settlement.get_validations(@settlement['SettlementId'], {page: 1, per_page: 10})
|
|
48
|
-
expect(validations).not_to be_nil
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
describe 'GET' do
|
|
53
|
-
it 'fetches the file' do
|
|
54
|
-
fetched = MangoPay::Settlement.get(@settlement['SettlementId'])
|
|
55
|
-
expect(fetched['Status']).to eq('PENDING_UPLOAD')
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
describe 'CANCEL' do
|
|
60
|
-
it 'cancels the settlement' do
|
|
61
|
-
fetched = MangoPay::Settlement.cancel(@settlement['SettlementId'])
|
|
62
|
-
expect(fetched['Status']).to eq('CANCELLED')
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|