mangopay 3.0.28 → 3.0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/mangopay.rb +6 -2
- data/lib/mangopay/pay_in.rb +3 -0
- data/lib/mangopay/version.rb +1 -1
- data/spec/mangopay/payin_bankwire_external_instruction_spec.rb +65 -0
- data/spec/mangopay/shared_resources.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc119d2e97e5a65875c73429965f2d5ec15f87c2
|
4
|
+
data.tar.gz: 684a90dca09a017de713dd477fbf5d6b34ec5db7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46e62de7beaa7c86049dd37effb36022e5e74f1c24749d29a7fb7d79dd267745e1eb41639bf07a8bad5284b5d3b6cf486004bf2fe0b89bf4c6f6d4b8df890029
|
7
|
+
data.tar.gz: 23da69054b9fcd7fb61f1a73d1aebbd4d4ca0df9f2f94c5de0cc736c4afa9bf70266343e889a0565696ab75588701cf35ff7aee2ae80eac8aff731c1d2390462
|
data/README.md
CHANGED
data/lib/mangopay.rb
CHANGED
@@ -47,7 +47,7 @@ module MangoPay
|
|
47
47
|
class Configuration
|
48
48
|
attr_accessor :preproduction, :root_url,
|
49
49
|
:client_id, :client_passphrase,
|
50
|
-
:temp_dir, :log_file
|
50
|
+
:temp_dir, :log_file, :http_timeout
|
51
51
|
|
52
52
|
def preproduction
|
53
53
|
@preproduction || false
|
@@ -56,6 +56,10 @@ module MangoPay
|
|
56
56
|
def root_url
|
57
57
|
@root_url || (@preproduction == true ? "https://api.sandbox.mangopay.com" : "https://api.mangopay.com")
|
58
58
|
end
|
59
|
+
|
60
|
+
def http_timeout
|
61
|
+
@http_timeout || 10000
|
62
|
+
end
|
59
63
|
end
|
60
64
|
|
61
65
|
class << self
|
@@ -128,7 +132,7 @@ module MangoPay
|
|
128
132
|
headers['Idempotency-Key'] = headers_or_idempotency_key if headers_or_idempotency_key != nil
|
129
133
|
end
|
130
134
|
|
131
|
-
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
135
|
+
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true, :read_timeout => configuration.http_timeout) do |http|
|
132
136
|
req = Net::HTTP::const_get(method.capitalize).new(uri.request_uri, headers)
|
133
137
|
req.body = JSON.dump(params)
|
134
138
|
before_request_proc.call(req) if before_request_proc
|
data/lib/mangopay/pay_in.rb
CHANGED
data/lib/mangopay/version.rb
CHANGED
@@ -0,0 +1,65 @@
|
|
1
|
+
describe MangoPay::PayIn::BankWire::ExternalInstruction, 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('BANK_WIRE')
|
9
|
+
expect(payin['ExecutionType']).to eq('EXTERNAL_INSTRUCTION')
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'FETCH' do
|
13
|
+
it 'fetches a payin' do
|
14
|
+
MangoPay.configure do |c|
|
15
|
+
c.preproduction = true
|
16
|
+
c.client_id = 'sdk-unit-tests'
|
17
|
+
c.root_url = 'https://api-test.mangopay.com'
|
18
|
+
c.client_passphrase = '9RMGpwVUwFLK0SurxObJ2yaadDcO0zeKFKxWmthjB93SQjFzy0'
|
19
|
+
c.http_timeout = 10000
|
20
|
+
end
|
21
|
+
|
22
|
+
id = "2826947"
|
23
|
+
payIn = MangoPay::PayIn.fetch(id)
|
24
|
+
expect(payIn['Id']).to eq(id)
|
25
|
+
check_type_and_status(payIn)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
###############################################
|
30
|
+
# refund not implemented for this type of payin
|
31
|
+
###############################################
|
32
|
+
# describe 'REFUND' do
|
33
|
+
# it 'refunds a payin' do
|
34
|
+
# payin = new_payin_bankwire_direct
|
35
|
+
# refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']})
|
36
|
+
# expect(refund['Id']).not_to be_nil
|
37
|
+
# expect(refund['Status']).to eq('SUCCEEDED')
|
38
|
+
# expect(refund['Type']).to eq('PAYOUT')
|
39
|
+
# expect(refund['Nature']).to eq('REFUND')
|
40
|
+
# expect(refund['InitialTransactionType']).to eq('PAYIN')
|
41
|
+
# expect(refund['InitialTransactionId']).to eq(payin['Id'])
|
42
|
+
# expect(refund['DebitedWalletId']).to eq(payin['CreditedWalletId'])
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
###############################################
|
47
|
+
# status is CREATED instead of SUCCEEDED
|
48
|
+
# so no cash flow yet
|
49
|
+
###############################################
|
50
|
+
# describe 'CASH FLOW' do
|
51
|
+
# it 'changes balances correctly' do
|
52
|
+
# wlt = new_wallet
|
53
|
+
# wallets_check_amounts(wlt, 0)
|
54
|
+
#
|
55
|
+
# # payin: feed wlt1 with money
|
56
|
+
# payin = create_new_payin_bankwire_direct(wlt, 1000)
|
57
|
+
# wallets_reload_and_check_amounts(wlt, 1000)
|
58
|
+
#
|
59
|
+
# # refund the payin
|
60
|
+
# refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']})
|
61
|
+
# wallets_reload_and_check_amounts(wlt, 0)
|
62
|
+
# end
|
63
|
+
# end
|
64
|
+
|
65
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mangopay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoffroy Lorieux
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- spec/mangopay/log_requests_filter_spec.rb
|
122
122
|
- spec/mangopay/mandate_spec.rb
|
123
123
|
- spec/mangopay/payin_bankwire_direct_spec.rb
|
124
|
+
- spec/mangopay/payin_bankwire_external_instruction_spec.rb
|
124
125
|
- spec/mangopay/payin_card_direct_spec.rb
|
125
126
|
- spec/mangopay/payin_card_web_spec.rb
|
126
127
|
- spec/mangopay/payin_directdebit_direct_spec.rb
|
@@ -182,6 +183,7 @@ test_files:
|
|
182
183
|
- spec/mangopay/log_requests_filter_spec.rb
|
183
184
|
- spec/mangopay/mandate_spec.rb
|
184
185
|
- spec/mangopay/payin_bankwire_direct_spec.rb
|
186
|
+
- spec/mangopay/payin_bankwire_external_instruction_spec.rb
|
185
187
|
- spec/mangopay/payin_card_direct_spec.rb
|
186
188
|
- spec/mangopay/payin_card_web_spec.rb
|
187
189
|
- spec/mangopay/payin_directdebit_direct_spec.rb
|