mangopay4-ruby-sdk 3.51.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 +39 -0
- data/lib/mangopay/acquiring.rb +4 -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 -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 -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,202 +0,0 @@
|
|
|
1
|
-
xdescribe MangoPay::Acquiring do
|
|
2
|
-
include_context 'wallets'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
|
|
5
|
-
let(:card_id) { 'placeholder' }
|
|
6
|
-
let(:author_id) { 'placeholder' }
|
|
7
|
-
|
|
8
|
-
describe 'PAY_IN CARD DIRECT' do
|
|
9
|
-
it 'creates a Card Direct PayIn' do
|
|
10
|
-
created = create_new_pay_in_card_direct
|
|
11
|
-
|
|
12
|
-
assert_common_pay_in_properties(created)
|
|
13
|
-
expect(created['PaymentType']).to eq('CARD')
|
|
14
|
-
expect(created['ExecutionType']).to eq('DIRECT')
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe 'REFUND' do
|
|
19
|
-
it 'creates a Refund for a PayIn' do
|
|
20
|
-
pay_in = create_new_pay_in_card_direct
|
|
21
|
-
refund = MangoPay::Acquiring::Refund.create(pay_in['Id'], { DebitedFunds: { Currency: 'EUR', Amount: 10 } })
|
|
22
|
-
|
|
23
|
-
expect(refund['Id']).not_to be_nil
|
|
24
|
-
expect(refund['Status']).to eq('SUCCEEDED')
|
|
25
|
-
expect(refund['Type']).to eq('PAYOUT')
|
|
26
|
-
expect(refund['Nature']).to eq('REFUND')
|
|
27
|
-
expect(refund['InitialTransactionType']).to eq('PAYIN')
|
|
28
|
-
expect(refund['InitialTransactionId']).to eq(pay_in['Id'])
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
describe 'PAY_IN APPLE_PAY' do
|
|
33
|
-
it 'creates an ApplePay direct PayIn' do
|
|
34
|
-
created = MangoPay::Acquiring::PayIn::ApplePay::Direct.create(
|
|
35
|
-
DebitedFunds: { Currency: 'EUR', Amount: 100 },
|
|
36
|
-
PaymentData: {
|
|
37
|
-
transactionId: "97e64d87f13a89ff6443cdcc205d5ccf7e15368b0d64126a8a2e0888a3a5c2a0",
|
|
38
|
-
network: "MasterCard",
|
|
39
|
-
tokenDataø: "{\"data\":\"2TihgKbmyPje02.........wAAAAAAAA==\",\"header\":{\"publicKeyHash\":\"xUyeFb75d359bfPEiq2JJMQj694UAxtTuBsaTWMOJxQ=\",\"ephemeralPublicKey\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEkeuICjZ7x15b7hPEBEBT5Zp43l95wCmJCU3QNxBvOCusG9w9sJMULuXlT4K8LOlPgaZzAcyWlfNwnLivVdOPfg==\",\"transactionId\":\"97e64d87f13a89ff6443cdcc205d5ccf7e15368b0d64126a8a2e0888a3a5c2a0\"},\"version\":\"EC_v1\"}"
|
|
40
|
-
}
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
assert_common_pay_in_properties(created)
|
|
44
|
-
expect(created['PaymentType']).to eq('APPLEPAY')
|
|
45
|
-
expect(created['ExecutionType']).to eq('DIRECT')
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
describe 'PAY_IN GOOGLE_PAY' do
|
|
50
|
-
it 'creates a GooglePay direct PayIn' do
|
|
51
|
-
created = MangoPay::Acquiring::PayIn::GooglePay::Direct.create(
|
|
52
|
-
DebitedFunds: { Currency: 'EUR', Amount: 199 },
|
|
53
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
|
54
|
-
SecureModeReturnURL: 'http://test.com',
|
|
55
|
-
BrowserInfo: {
|
|
56
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
57
|
-
JavaEnabled: true,
|
|
58
|
-
Language: "fr-FR",
|
|
59
|
-
ColorDepth: 4,
|
|
60
|
-
ScreenHeight: 1800,
|
|
61
|
-
ScreenWidth: 400,
|
|
62
|
-
JavascriptEnabled: true,
|
|
63
|
-
TimeZoneOffset: "+60",
|
|
64
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
65
|
-
},
|
|
66
|
-
PaymentData: "{\"signature\":\"MEUCIQDc49/Bw1lTk8ok2fUe4UT......................\\u003d\\\"}\"}"
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
assert_common_pay_in_properties(created)
|
|
70
|
-
expect(created['PaymentType']).to eq('GOOGLEPAY')
|
|
71
|
-
expect(created['ExecutionType']).to eq('DIRECT')
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
describe 'PAY_IN IDEAL WEB' do
|
|
76
|
-
it 'creates an Ideal Web PayIn' do
|
|
77
|
-
created = MangoPay::Acquiring::PayIn::Ideal::Web.create(
|
|
78
|
-
DebitedFunds: { Currency: 'EUR', Amount: 100 },
|
|
79
|
-
ReturnURL: 'http://www.my-site.com/returnURL'
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
assert_common_pay_in_properties(created)
|
|
83
|
-
expect(created['PaymentType']).to eq('IDEAL')
|
|
84
|
-
expect(created['ExecutionType']).to eq('WEB')
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
describe 'PAY_IN PAYPAL' do
|
|
89
|
-
it 'creates a PayPal Web PayIn' do
|
|
90
|
-
created = MangoPay::Acquiring::PayIn::PayPal::Web.create(
|
|
91
|
-
DebitedFunds: { Currency: 'EUR', Amount: 400 },
|
|
92
|
-
ReturnUrl: "http://example.com",
|
|
93
|
-
LineItems: [
|
|
94
|
-
{
|
|
95
|
-
Name: "running shoes",
|
|
96
|
-
Quantity: 1,
|
|
97
|
-
UnitAmount: 200,
|
|
98
|
-
TaxAmount: 0,
|
|
99
|
-
Description: "seller1 ID"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
Name: "running shoes",
|
|
103
|
-
Quantity: 1,
|
|
104
|
-
UnitAmount: 200,
|
|
105
|
-
TaxAmount: 0,
|
|
106
|
-
Description: "seller2 ID"
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
assert_common_pay_in_properties(created)
|
|
112
|
-
expect(created['PaymentType']).to eq('PAYPAL')
|
|
113
|
-
expect(created['ExecutionType']).to eq('WEB')
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
it 'creates PayPal DataCollection' do
|
|
117
|
-
data_collection = MangoPay::Acquiring::PayIn::PayPal::Web.create_data_collection(
|
|
118
|
-
{
|
|
119
|
-
"sender_account_id": "A12345N343",
|
|
120
|
-
"sender_first_name": "Jane",
|
|
121
|
-
"sender_last_name": "Doe",
|
|
122
|
-
"sender_email": "jane.doe@sample.com",
|
|
123
|
-
"sender_phone": "(042)11234567",
|
|
124
|
-
"sender_address_zip": "75009",
|
|
125
|
-
"sender_country_code": "FR",
|
|
126
|
-
"sender_create_date": "2012-12-09T19:14:55.277-0:00",
|
|
127
|
-
"sender_signup_ip": "10.220.90.20",
|
|
128
|
-
"sender_popularity_score": "high",
|
|
129
|
-
"receiver_account_id": "A12345N344",
|
|
130
|
-
"receiver_create_date": "2012-12-09T19:14:55.277-0:00",
|
|
131
|
-
"receiver_email": "jane@sample.com",
|
|
132
|
-
"receiver_address_country_code": "FR",
|
|
133
|
-
"business_name": "Jane Ltd",
|
|
134
|
-
"recipient_popularity_score": "high",
|
|
135
|
-
"first_interaction_date": "2012-12-09T19:14:55.277-0:00",
|
|
136
|
-
"txn_count_total": "34",
|
|
137
|
-
"vertical": "Household goods",
|
|
138
|
-
"transaction_is_tangible": "0"
|
|
139
|
-
}
|
|
140
|
-
)
|
|
141
|
-
expect(data_collection['dataCollectionId']).not_to be_nil
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
describe 'CARD VALIDATION' do
|
|
146
|
-
it 'creates card validation' do
|
|
147
|
-
params = {
|
|
148
|
-
AuthorId: author_id,
|
|
149
|
-
SecureModeReturnURL: "https://mangopay.com",
|
|
150
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
|
|
151
|
-
Tag: "custom meta",
|
|
152
|
-
BrowserInfo: {
|
|
153
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
154
|
-
JavaEnabled: true,
|
|
155
|
-
Language: "FR-FR",
|
|
156
|
-
ColorDepth: 4,
|
|
157
|
-
ScreenHeight: 1800,
|
|
158
|
-
ScreenWidth: 400,
|
|
159
|
-
JavascriptEnabled: true,
|
|
160
|
-
TimeZoneOffset: "+60",
|
|
161
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
card_validation = MangoPay::Acquiring::PayIn::Card.create_card_validation(card_id, params)
|
|
165
|
-
expect(card_validation).not_to be_nil
|
|
166
|
-
expect("SUCCEEDED").to eq(card_validation['Status'])
|
|
167
|
-
end
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
def create_new_pay_in_card_direct
|
|
171
|
-
MangoPay::Acquiring::PayIn::Card::Direct.create(
|
|
172
|
-
DebitedFunds: { Currency: 'EUR', Amount: 100 },
|
|
173
|
-
CardType: 'CB_VISA_MASTERCARD',
|
|
174
|
-
CardId: card_id,
|
|
175
|
-
SecureMode: 'DEFAULT',
|
|
176
|
-
SecureModeReturnURL: 'http://test.com',
|
|
177
|
-
Tag: 'Acquiring Test PayIn/Card/Direct',
|
|
178
|
-
BrowserInfo: {
|
|
179
|
-
AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
|
|
180
|
-
JavaEnabled: true,
|
|
181
|
-
Language: "FR-FR",
|
|
182
|
-
ColorDepth: 4,
|
|
183
|
-
ScreenHeight: 1800,
|
|
184
|
-
ScreenWidth: 400,
|
|
185
|
-
JavascriptEnabled: true,
|
|
186
|
-
TimeZoneOffset: "+60",
|
|
187
|
-
UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
|
188
|
-
},
|
|
189
|
-
IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
|
|
190
|
-
)
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
def assert_common_pay_in_properties(pay_in)
|
|
194
|
-
expect(pay_in['Id']).not_to be_nil
|
|
195
|
-
expect(pay_in['Type']).to eq('PAYIN')
|
|
196
|
-
expect(pay_in['Nature']).to eq('REGULAR')
|
|
197
|
-
expect(pay_in['Status']).to eq('SUCCEEDED')
|
|
198
|
-
expect(pay_in['ResultCode']).to eq('000000')
|
|
199
|
-
expect(pay_in['ResultMessage']).to eq('Success')
|
|
200
|
-
expect(pay_in['ExecutionDate']).to be > 0
|
|
201
|
-
end
|
|
202
|
-
end
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
describe MangoPay::AuthorizationToken do
|
|
2
|
-
|
|
3
|
-
_default_static_storage = MangoPay::AuthorizationToken::Manager.storage
|
|
4
|
-
_new_file_storage = MangoPay::AuthorizationToken::FileStorage.new
|
|
5
|
-
|
|
6
|
-
it 'uses StaticStorage strategy by default' do
|
|
7
|
-
storage = _default_static_storage
|
|
8
|
-
expect(storage).to be_kind_of MangoPay::AuthorizationToken::StaticStorage
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
it 'allows set different storage strategies' do
|
|
12
|
-
|
|
13
|
-
# set to FileStorage
|
|
14
|
-
file_storage = _new_file_storage
|
|
15
|
-
MangoPay::AuthorizationToken::Manager.storage = file_storage
|
|
16
|
-
storage = MangoPay::AuthorizationToken::Manager.storage
|
|
17
|
-
expect(storage).to be file_storage
|
|
18
|
-
|
|
19
|
-
# reset to StaticStorage
|
|
20
|
-
static_storage = _default_static_storage
|
|
21
|
-
MangoPay::AuthorizationToken::Manager.storage = static_storage
|
|
22
|
-
storage = MangoPay::AuthorizationToken::Manager.storage
|
|
23
|
-
expect(storage).to be static_storage
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
describe MangoPay::AuthorizationToken::StaticStorage do
|
|
27
|
-
it 'shares tokens between calls' do
|
|
28
|
-
MangoPay::AuthorizationToken::Manager.storage = _default_static_storage
|
|
29
|
-
users1 = MangoPay::User.fetch
|
|
30
|
-
token1 = MangoPay::AuthorizationToken::Manager.get_token
|
|
31
|
-
users2 = MangoPay::User.fetch
|
|
32
|
-
token2 = MangoPay::AuthorizationToken::Manager.get_token
|
|
33
|
-
expect(token1).to eq token2
|
|
34
|
-
expect(token1).to be token2 # moreover, it's the same instance
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
describe MangoPay::AuthorizationToken::FileStorage do
|
|
39
|
-
it 'shares tokens between calls' do
|
|
40
|
-
MangoPay::AuthorizationToken::Manager.storage = _new_file_storage
|
|
41
|
-
|
|
42
|
-
users1 = MangoPay::User.fetch
|
|
43
|
-
token1 = MangoPay::AuthorizationToken::Manager.get_token
|
|
44
|
-
users2 = MangoPay::User.fetch
|
|
45
|
-
token2 = MangoPay::AuthorizationToken::Manager.get_token
|
|
46
|
-
expect(token1).to eq token2
|
|
47
|
-
expect(token1).not_to be token2 # it's NOT the same instance
|
|
48
|
-
|
|
49
|
-
MangoPay::AuthorizationToken::Manager.storage = _default_static_storage # cleanup
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it 'uses temp file with serialized token' do
|
|
53
|
-
MangoPay::AuthorizationToken::Manager.storage = _new_file_storage
|
|
54
|
-
|
|
55
|
-
file_path = _new_file_storage.file_path
|
|
56
|
-
dir_path = MangoPay.configuration.temp_dir
|
|
57
|
-
expect(file_path.start_with? dir_path).to be(true)
|
|
58
|
-
|
|
59
|
-
token = MangoPay::AuthorizationToken::Manager.get_token
|
|
60
|
-
expect(File.exists? file_path).to be(true)
|
|
61
|
-
|
|
62
|
-
f = File.open(file_path, File::RDONLY)
|
|
63
|
-
txt = f.read
|
|
64
|
-
f.close
|
|
65
|
-
expect(txt.include? token['access_token']).to be(true)
|
|
66
|
-
|
|
67
|
-
MangoPay::AuthorizationToken::Manager.storage = _default_static_storage # cleanup
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
describe MangoPay::BankAccount do
|
|
2
|
-
include_context 'bank_accounts'
|
|
3
|
-
|
|
4
|
-
def create(params)
|
|
5
|
-
user = new_natural_user
|
|
6
|
-
params_fixed = { OwnerName: 'John', OwnerAddress: user['Address'] }.merge(params)
|
|
7
|
-
MangoPay::BankAccount.create(user['Id'], params_fixed)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
describe 'CREATE' do
|
|
11
|
-
|
|
12
|
-
it 'creates a new IBAN bank detail' do
|
|
13
|
-
expect(new_bank_account['Id']).not_to be_nil
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it 'creates a new GB bank detail' do
|
|
17
|
-
created = create({
|
|
18
|
-
Type: 'GB',
|
|
19
|
-
AccountNumber: '63956474',
|
|
20
|
-
SortCode: '200000',
|
|
21
|
-
})
|
|
22
|
-
expect(created['Id']).not_to be_nil
|
|
23
|
-
expect(created['Type']).to eq('GB')
|
|
24
|
-
expect(created['AccountNumber']).to eq('63956474')
|
|
25
|
-
expect(created['SortCode']).to eq('200000')
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
it 'creates a new US bank detail' do
|
|
29
|
-
created = create({
|
|
30
|
-
Type: 'US',
|
|
31
|
-
AccountNumber: '234234234234',
|
|
32
|
-
ABA: '234334789',
|
|
33
|
-
})
|
|
34
|
-
expect(created['Id']).not_to be_nil
|
|
35
|
-
expect(created['Type']).to eq('US')
|
|
36
|
-
expect(created['AccountNumber']).to eq('234234234234')
|
|
37
|
-
expect(created['ABA']).to eq('234334789')
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
it 'creates a new CA bank detail' do
|
|
41
|
-
created = create({
|
|
42
|
-
Type: 'CA',
|
|
43
|
-
BankName: 'TestBankName',
|
|
44
|
-
BranchCode: '12345',
|
|
45
|
-
AccountNumber: '234234234234',
|
|
46
|
-
InstitutionNumber: '123',
|
|
47
|
-
})
|
|
48
|
-
expect(created['Id']).not_to be_nil
|
|
49
|
-
expect(created['Type']).to eq('CA')
|
|
50
|
-
expect(created['BankName']).to eq('TestBankName')
|
|
51
|
-
expect(created['BranchCode']).to eq('12345')
|
|
52
|
-
expect(created['AccountNumber']).to eq('234234234234')
|
|
53
|
-
expect(created['InstitutionNumber']).to eq('123')
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
it 'creates a new OTHER bank detail' do
|
|
57
|
-
created = create({
|
|
58
|
-
Type: 'OTHER',
|
|
59
|
-
Country: 'FR',
|
|
60
|
-
AccountNumber: '234234234234',
|
|
61
|
-
BIC: 'BINAADADXXX',
|
|
62
|
-
})
|
|
63
|
-
expect(created['Id']).not_to be_nil
|
|
64
|
-
expect(created['Type']).to eq('OTHER')
|
|
65
|
-
expect(created['Country']).to eq('FR')
|
|
66
|
-
expect(created['AccountNumber']).to eq('234234234234')
|
|
67
|
-
expect(created['BIC']).to eq('BINAADADXXX')
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
describe 'FETCH' do
|
|
73
|
-
|
|
74
|
-
it 'fetches all the bank details' do
|
|
75
|
-
list = MangoPay::BankAccount.fetch(new_bank_account['UserId'])
|
|
76
|
-
expect(list).to be_kind_of(Array)
|
|
77
|
-
expect(list[0]['Id']).to eq(new_bank_account['Id'])
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
it 'fetches single bank detail' do
|
|
81
|
-
single = MangoPay::BankAccount.fetch(new_bank_account['UserId'], new_bank_account['Id'])
|
|
82
|
-
expect(single['Id']).to eq(new_bank_account['Id'])
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
describe 'UPDATE' do
|
|
87
|
-
it 'disactivates a bank account' do
|
|
88
|
-
usr_id = new_bank_account['UserId']
|
|
89
|
-
acc_id = new_bank_account['Id']
|
|
90
|
-
|
|
91
|
-
changed = MangoPay::BankAccount.update(usr_id, acc_id, {Active: false})
|
|
92
|
-
fetched = MangoPay::BankAccount.fetch(usr_id, acc_id)
|
|
93
|
-
expect(changed['Active']).to eq(false)
|
|
94
|
-
expect(fetched['Active']).to eq(false)
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
describe 'FETCH Transaction' do
|
|
99
|
-
it "fetches a bank account's transactions" do
|
|
100
|
-
bank_account = new_bank_account
|
|
101
|
-
transactions = MangoPay::BankAccount.transactions(bank_account['Id'])
|
|
102
|
-
expect(transactions).to be_an(Array)
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
describe MangoPay::BankingAliases do
|
|
2
|
-
include_context 'users'
|
|
3
|
-
include_context 'wallets'
|
|
4
|
-
include_context 'bankingaliases'
|
|
5
|
-
|
|
6
|
-
describe 'CREATE' do
|
|
7
|
-
it 'creates a new banking alias' do
|
|
8
|
-
expect(new_banking_alias['CreditedUserId']).to eq(new_natural_user['Id'])
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe 'UPDATE' do
|
|
13
|
-
it 'updates a banking alias' do
|
|
14
|
-
updated_banking_alias = MangoPay::BankingAliases.update(new_banking_alias['Id'] ,{
|
|
15
|
-
Active: false
|
|
16
|
-
})
|
|
17
|
-
expect(updated_banking_alias['Active']).to eq(false)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe 'FETCH' do
|
|
22
|
-
it 'fetches all the banking aliases for a wallet' do
|
|
23
|
-
bankingaliases = MangoPay::BankingAliases.fetch_for_wallet(new_banking_alias['WalletId'])
|
|
24
|
-
expect(bankingaliases).to be_kind_of(Array)
|
|
25
|
-
expect(bankingaliases).not_to be_empty
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
end
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
describe MangoPay::CardRegistration do
|
|
2
|
-
include_context 'users'
|
|
3
|
-
include_context 'payins'
|
|
4
|
-
|
|
5
|
-
describe 'CREATE' do
|
|
6
|
-
it 'creates a new card registration' do
|
|
7
|
-
created = new_card_registration
|
|
8
|
-
expect(created['Id']).not_to be_nil
|
|
9
|
-
expect(created['AccessKey']).not_to be_nil
|
|
10
|
-
expect(created['PreregistrationData']).not_to be_nil
|
|
11
|
-
expect(created['CardRegistrationURL']).not_to be_nil
|
|
12
|
-
expect(created['RegistrationData']).to be_nil
|
|
13
|
-
expect(created['CardId']).to be_nil
|
|
14
|
-
expect(created['UserId']).to eq(new_natural_user["Id"])
|
|
15
|
-
expect(created['Currency']).to eq('EUR')
|
|
16
|
-
expect(created['Status']).to eq('CREATED')
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
describe 'UPDATE' do
|
|
21
|
-
it 'updates a card registration' do
|
|
22
|
-
created = new_card_registration
|
|
23
|
-
updated = MangoPay::CardRegistration.update(created['Id'] ,{
|
|
24
|
-
RegistrationData: 'test RegistrationData'
|
|
25
|
-
})
|
|
26
|
-
expect(updated['RegistrationData']).to eq('test RegistrationData')
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
describe 'FETCH' do
|
|
31
|
-
it 'fetches a card registration' do
|
|
32
|
-
created = new_card_registration
|
|
33
|
-
fetched = MangoPay::CardRegistration.fetch(created['Id'])
|
|
34
|
-
expect(fetched['Id']).to eq(created['Id'])
|
|
35
|
-
expect(fetched['UserId']).to eq(created['UserId'])
|
|
36
|
-
expect(fetched['Tag']).to eq(created['Tag'])
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
describe 'TOKENIZATION PROCESS' do
|
|
41
|
-
it 'fills-in registration data and links it to a newly created card' do
|
|
42
|
-
completed = new_card_registration_completed
|
|
43
|
-
reg_data = completed['RegistrationData']
|
|
44
|
-
card_id = completed['CardId']
|
|
45
|
-
|
|
46
|
-
# reg data filled-in
|
|
47
|
-
expect(reg_data).not_to be_nil
|
|
48
|
-
expect(reg_data).to be_kind_of String
|
|
49
|
-
expect(reg_data).not_to be_empty
|
|
50
|
-
|
|
51
|
-
# card id filled-in...
|
|
52
|
-
expect(card_id).not_to be_nil
|
|
53
|
-
|
|
54
|
-
# ...and points to existing (newly created) card
|
|
55
|
-
card = MangoPay::Card.fetch(card_id)
|
|
56
|
-
expect(card['Id']).to eq card_id
|
|
57
|
-
|
|
58
|
-
################################################################################
|
|
59
|
-
# cannot test updating: one can only put a CARD from "VALID" to "INVALID"
|
|
60
|
-
# # let's test updating the card too
|
|
61
|
-
# expect(card['Validity']).to eq 'UNKNOWN'
|
|
62
|
-
# card_updated = MangoPay::Card.update(card_id ,{
|
|
63
|
-
# Validity: 'INVALID'
|
|
64
|
-
# })
|
|
65
|
-
# expect(card_updated['Validity']).to eq 'INVALID'
|
|
66
|
-
# expect(MangoPay::Card.fetch(card_id)['Validity']).to eq 'INVALID'
|
|
67
|
-
################################################################################
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
describe '.get_by_fingerprint' do
|
|
71
|
-
it 'retrieves list of cards having same fingerprint' do
|
|
72
|
-
completed = new_card_registration_completed
|
|
73
|
-
card_id = completed['CardId']
|
|
74
|
-
card = MangoPay::Card.fetch(card_id)
|
|
75
|
-
fingerprint = card['Fingerprint']
|
|
76
|
-
result = MangoPay::Card.get_by_fingerprint(fingerprint)
|
|
77
|
-
|
|
78
|
-
expect(result).to be_kind_of(Array)
|
|
79
|
-
result.each do |card|
|
|
80
|
-
expect(card['Fingerprint']).to eq fingerprint
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
describe 'FETCH Transactions' do
|
|
87
|
-
it "retrieves list of card's transactions" do
|
|
88
|
-
card_id = new_card_registration_completed['CardId']
|
|
89
|
-
transactions = MangoPay::Card.transactions(card_id)
|
|
90
|
-
expect(transactions).to be_an(Array)
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
describe 'VALIDATE CARD' do
|
|
95
|
-
it "validates a card" do
|
|
96
|
-
created = new_card_registration_completed
|
|
97
|
-
validated = create_card_validation(created['UserId'], created['CardId'])
|
|
98
|
-
|
|
99
|
-
expect(validated).to_not be_nil
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
it "fetches card validation" do
|
|
103
|
-
created = new_card_registration_completed
|
|
104
|
-
card_validation = create_card_validation(created['UserId'], created['CardId'])
|
|
105
|
-
fetched_card_validation = MangoPay::Card.get_card_validation(created['CardId'], card_validation['Id'])
|
|
106
|
-
|
|
107
|
-
expect(card_validation['Id']).equal? fetched_card_validation['Id']
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
describe 'Get transactions by card fingerprint' do
|
|
112
|
-
it 'retrieves list of transactions for a fingerprint' do
|
|
113
|
-
completed = new_card_registration_completed
|
|
114
|
-
card_id = completed['CardId']
|
|
115
|
-
card = MangoPay::Card.fetch(card_id)
|
|
116
|
-
fingerprint = card['Fingerprint']
|
|
117
|
-
result = MangoPay::Card.get_transactions_by_fingerprint(fingerprint)
|
|
118
|
-
|
|
119
|
-
expect(result).to be_kind_of(Array)
|
|
120
|
-
expect(result.count).to be > 0
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
end
|
|
Binary file
|