mangopay 3.0.12 → 3.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mangopay/authorization_token.rb +1 -0
- data/lib/mangopay/bank_account.rb +4 -2
- data/lib/mangopay/card.rb +2 -0
- data/lib/mangopay/card_registration.rb +2 -0
- data/lib/mangopay/errors.rb +3 -0
- data/lib/mangopay/event.rb +3 -1
- data/lib/mangopay/hook.rb +2 -0
- data/lib/mangopay/http_calls.rb +9 -4
- data/lib/mangopay/kyc_document.rb +18 -0
- data/lib/mangopay/legal_user.rb +3 -0
- data/lib/mangopay/natural_user.rb +2 -0
- data/lib/mangopay/pay_in.rb +18 -0
- data/lib/mangopay/pay_out.rb +1 -0
- data/lib/mangopay/pre_authorization.rb +2 -0
- data/lib/mangopay/refund.rb +2 -0
- data/lib/mangopay/transaction.rb +2 -2
- data/lib/mangopay/transfer.rb +2 -0
- data/lib/mangopay/user.rb +9 -4
- data/lib/mangopay/version.rb +1 -1
- data/lib/mangopay/wallet.rb +3 -1
- data/spec/mangopay/kyc_document_spec.rb +38 -0
- data/spec/mangopay/payin_card_web_spec.rb +0 -16
- data/spec/mangopay/payin_directdebit_web_spec.rb +38 -0
- data/spec/mangopay/shared_resources.rb +25 -5
- data/spec/spec_helper.rb +0 -2
- 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: 399bb23725d407dca5bdc8650e2f98aaeb64ebc5
|
4
|
+
data.tar.gz: 6fa52ebd8674dd692694325d056b4f55522c2cb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2606747f1f0643e35634af72448ae872bcffc49afdef3a29f086326bce0e5d48a33e9b20ccc6368208a63780966faab469fb71a163b49bceb26204f667d5ae7
|
7
|
+
data.tar.gz: 39f1b1c4a851e162c69a6ee3b405e14a1940b6e64d68361812fa1ff5474985cf4c206512002d308de5655e05050c061b356c0adfa9c91d5749c171e63a3f1adb
|
@@ -1,4 +1,6 @@
|
|
1
1
|
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/bank-accounts/
|
2
4
|
class BankAccount < Resource
|
3
5
|
include HTTPCalls::Fetch
|
4
6
|
class << self
|
@@ -11,8 +13,8 @@ module MangoPay
|
|
11
13
|
# - list of bank accounts belonging to the given +user_id+
|
12
14
|
# - or single bank account belonging to the given +user_id+ with the given +bank_account_id+.
|
13
15
|
#
|
14
|
-
# In case of list query, optional +filters+ is a hash accepting pagination params
|
15
|
-
# (+page+, +per_page+; see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
16
|
+
# In case of list query, optional +filters+ is a hash accepting pagination and sorting params
|
17
|
+
# (+page+, +per_page+, +sort+; see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
16
18
|
#
|
17
19
|
def fetch(user_id, bank_account_id_or_filters={})
|
18
20
|
bank_account_id, filters = HTTPCalls::Fetch.parse_id_or_filters(bank_account_id_or_filters)
|
data/lib/mangopay/card.rb
CHANGED
data/lib/mangopay/errors.rb
CHANGED
@@ -6,6 +6,9 @@ module MangoPay
|
|
6
6
|
class Error < StandardError
|
7
7
|
end
|
8
8
|
|
9
|
+
# See http://docs.mangopay.com/api-references/response-codes-rules/
|
10
|
+
# and http://docs.mangopay.com/api-references/error-codes/
|
11
|
+
#
|
9
12
|
# Thrown from any MangoPay API call whenever
|
10
13
|
# it returns response with HTTP code != 200.
|
11
14
|
# Check @details hash for further info.
|
data/lib/mangopay/event.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/events/
|
2
4
|
class Event < Resource
|
3
5
|
|
4
6
|
# Fetches list of events (PayIns, PayOuts, Transfers).
|
5
7
|
#
|
6
8
|
# Optional +filters+ is a hash accepting following keys:
|
7
|
-
# - +page+, +per_page+: pagination params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
9
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
8
10
|
# - +EventType+: {PAYIN_NORMAL_CREATED, PAYIN_NORMAL_SUCCEEDED, PAYIN_NORMAL_FAILED etc...} (see http://docs.mangopay.com/api-references/events/)
|
9
11
|
# - +BeforeDate+ (timestamp): filters events with Date _before_ this date
|
10
12
|
# - +AfterDate+ (timestamp): filters events with Date _after_ this date
|
data/lib/mangopay/hook.rb
CHANGED
data/lib/mangopay/http_calls.rb
CHANGED
@@ -29,16 +29,18 @@ module MangoPay
|
|
29
29
|
module Fetch
|
30
30
|
module ClassMethods
|
31
31
|
|
32
|
-
# - Fetching
|
32
|
+
# - Fetching _single_entity_ by +id+:
|
33
33
|
#
|
34
34
|
# MangoPay::User.fetch("user-id") # => {"FirstName"=>"Mango", "LastName"=>"Pay", ...}
|
35
35
|
#
|
36
|
-
# -
|
37
|
-
# including _pagination_ params
|
38
|
-
#
|
36
|
+
# - or fetching _multiple_entities_ with _optional_ +filters+ hash,
|
37
|
+
# including _pagination_ and _sorting_ params
|
38
|
+
# +page+, +per_page+, +sort+ (see http://docs.mangopay.com/api-references/pagination/):
|
39
39
|
#
|
40
40
|
# MangoPay::User.fetch() # => [{...}, ...]: list of user data hashes (10 per page by default)
|
41
41
|
# MangoPay::User.fetch({'page' => 2, 'per_page' => 3}) # => list of 3 hashes from 2nd page
|
42
|
+
# MangoPay::BankAccount.fetch(user_id, {'sort' => 'CreationDate:desc'}) # => bank accounts by user, sorting by date descending (with default pagination)
|
43
|
+
# MangoPay::BankAccount.fetch(user_id, {'sort' => 'CreationDate:desc', 'page' => 2, 'per_page' => 3}) # both sorting and pagination params provided
|
42
44
|
#
|
43
45
|
# - For paginated queries the +filters+ param will be supplemented by +total_pages+ and +total_items+ info:
|
44
46
|
#
|
@@ -62,6 +64,9 @@ module MangoPay
|
|
62
64
|
|
63
65
|
module Refund
|
64
66
|
module ClassMethods
|
67
|
+
|
68
|
+
# See http://docs.mangopay.com/api-references/refund/%E2%80%A2-refund-a-pay-in/
|
69
|
+
# See http://docs.mangopay.com/api-references/refund/%E2%80%A2-refund-a-transfer/
|
65
70
|
def refund(id = nil, params = {})
|
66
71
|
MangoPay.request(:post, url(id) + '/refunds', params)
|
67
72
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'base64'
|
2
2
|
|
3
3
|
module MangoPay
|
4
|
+
|
5
|
+
# See http://docs.mangopay.com/api-references/kyc/documents/
|
4
6
|
class KycDocument < Resource
|
5
7
|
class << self
|
6
8
|
def create(user_id, params)
|
@@ -11,10 +13,26 @@ module MangoPay
|
|
11
13
|
MangoPay.request(:put, url(user_id, document_id), params)
|
12
14
|
end
|
13
15
|
|
16
|
+
# Fetches the KYC document belonging to the given +user_id+, with the given +document_id+.
|
14
17
|
def fetch(user_id, document_id)
|
15
18
|
MangoPay.request(:get, url(user_id, document_id))
|
16
19
|
end
|
17
20
|
|
21
|
+
# Fetches list of KYC documents:
|
22
|
+
# - for the particular user if +user_id+ is provided (not nil)
|
23
|
+
# - or for all users otherwise.
|
24
|
+
#
|
25
|
+
# Optional +filters+ is a hash accepting following keys:
|
26
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
27
|
+
# - filters such as +Type+ (e.g. 'IDENTITY_PROOF') and +Status+ (e.g. 'VALIDATED')
|
28
|
+
# - +BeforeDate+ (timestamp): filters documents with CreationDate _before_ this date
|
29
|
+
# - +AfterDate+ (timestamp): filters documents with CreationDate _after_ this date
|
30
|
+
#
|
31
|
+
def fetch_all(user_id = nil, filters = {})
|
32
|
+
url = (user_id) ? url(user_id) : "#{MangoPay.api_path}/KYC/documents"
|
33
|
+
MangoPay.request(:get, url, {}, filters)
|
34
|
+
end
|
35
|
+
|
18
36
|
# Adds the file page (attachment) to the given document.
|
19
37
|
#
|
20
38
|
# See http://docs.mangopay.com/api-references/kyc/pages/ :
|
data/lib/mangopay/legal_user.rb
CHANGED
data/lib/mangopay/pay_in.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/payins/
|
2
4
|
class PayIn < Resource
|
3
5
|
include HTTPCalls::Fetch
|
4
6
|
include HTTPCalls::Refund
|
5
7
|
|
6
8
|
module Card
|
7
9
|
|
10
|
+
# See http://docs.mangopay.com/api-references/payins/payins-card-web/
|
8
11
|
class Web < Resource
|
9
12
|
include HTTPCalls::Create
|
10
13
|
def self.url(*)
|
@@ -12,6 +15,7 @@ module MangoPay
|
|
12
15
|
end
|
13
16
|
end
|
14
17
|
|
18
|
+
# See http://docs.mangopay.com/api-references/payins/payindirectcard/
|
15
19
|
class Direct < Resource
|
16
20
|
include HTTPCalls::Create
|
17
21
|
def self.url(*)
|
@@ -23,6 +27,7 @@ module MangoPay
|
|
23
27
|
|
24
28
|
module PreAuthorized
|
25
29
|
|
30
|
+
# See http://docs.mangopay.com/api-references/payins/preauthorized-payin/
|
26
31
|
class Direct < Resource
|
27
32
|
include HTTPCalls::Create
|
28
33
|
def self.url(*)
|
@@ -34,6 +39,7 @@ module MangoPay
|
|
34
39
|
|
35
40
|
module BankWire
|
36
41
|
|
42
|
+
# See http://docs.mangopay.com/api-references/payins/payinbankwire/
|
37
43
|
class Direct < Resource
|
38
44
|
include HTTPCalls::Create
|
39
45
|
def self.url(*)
|
@@ -43,5 +49,17 @@ module MangoPay
|
|
43
49
|
|
44
50
|
end
|
45
51
|
|
52
|
+
module DirectDebit
|
53
|
+
|
54
|
+
# See http://docs.mangopay.com/api-references/payins/direct-debit-pay-in-web/
|
55
|
+
class Web < Resource
|
56
|
+
include HTTPCalls::Create
|
57
|
+
def self.url(*)
|
58
|
+
"#{MangoPay.api_path}/payins/directdebit/#{CGI.escape(class_name.downcase)}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
46
64
|
end
|
47
65
|
end
|
data/lib/mangopay/pay_out.rb
CHANGED
data/lib/mangopay/refund.rb
CHANGED
data/lib/mangopay/transaction.rb
CHANGED
@@ -2,16 +2,16 @@ module MangoPay
|
|
2
2
|
class Transaction < Resource
|
3
3
|
class << self
|
4
4
|
# Fetches list of transactions belonging to the given +wallet_id+.
|
5
|
+
# See also transactions for user: MangoPay::User#transactions
|
5
6
|
#
|
6
7
|
# Optional +filters+ is a hash accepting following keys:
|
7
|
-
# - +page+, +per_page+: pagination params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
8
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
8
9
|
# - +Status+: TransactionStatus {CREATED, SUCCEEDED, FAILED}
|
9
10
|
# - +Type+: TransactionType {PAYIN, PAYOUT, TRANSFER}
|
10
11
|
# - +Nature+: TransactionNature {NORMAL, REFUND, REPUDIATION}
|
11
12
|
# - +Direction+: TransactionDirection {DEBIT, CREDIT}
|
12
13
|
# - +BeforeDate+ (timestamp): filters transactions with CreationDate _before_ this date
|
13
14
|
# - +AfterDate+ (timestamp): filters transactions with CreationDate _after_ this date
|
14
|
-
#
|
15
15
|
def fetch(wallet_id, filters={})
|
16
16
|
MangoPay.request(:get, url(wallet_id), {}, filters)
|
17
17
|
end
|
data/lib/mangopay/transfer.rb
CHANGED
data/lib/mangopay/user.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/users/
|
4
|
+
# See also children classes:
|
5
|
+
# - MangoPay::NaturalUser
|
6
|
+
# - MangoPay::LegalUser
|
2
7
|
class User < Resource
|
3
8
|
include HTTPCalls::Create
|
4
9
|
include HTTPCalls::Update
|
@@ -6,22 +11,22 @@ module MangoPay
|
|
6
11
|
class << self
|
7
12
|
# Fetches list of wallets belonging to the given +user_id+.
|
8
13
|
# Optional +filters+ is a hash accepting following keys:
|
9
|
-
# - +page+, +per_page+: pagination params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
10
|
-
# - other keys specific for transactions filtering (see MangoPay::Transaction.fetch)
|
14
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
11
15
|
def wallets(user_id, filters={})
|
12
16
|
MangoPay.request(:get, url(user_id) + '/wallets', {}, filters)
|
13
17
|
end
|
14
18
|
|
15
19
|
# Fetches list of cards belonging to the given +user_id+.
|
16
20
|
# Optional +filters+ is a hash accepting following keys:
|
17
|
-
# - +page+, +per_page+: pagination params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
21
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
18
22
|
def cards(user_id, filters={})
|
19
23
|
MangoPay.request(:get, url(user_id) + '/cards', {}, filters)
|
20
24
|
end
|
21
25
|
|
22
26
|
# Fetches list of transactions belonging to the given +user_id+.
|
23
27
|
# Optional +filters+ is a hash accepting following keys:
|
24
|
-
# - +page+, +per_page+: pagination params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
28
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
29
|
+
# - other keys specific for transactions filtering (see MangoPay::Transaction#fetch)
|
25
30
|
def transactions(user_id, filters={})
|
26
31
|
MangoPay.request(:get, url(user_id) + '/transactions', {}, filters)
|
27
32
|
end
|
data/lib/mangopay/version.rb
CHANGED
data/lib/mangopay/wallet.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
module MangoPay
|
2
|
+
|
3
|
+
# See http://docs.mangopay.com/api-references/wallets/
|
2
4
|
class Wallet < Resource
|
3
5
|
include HTTPCalls::Create
|
4
6
|
include HTTPCalls::Update
|
@@ -6,7 +8,7 @@ module MangoPay
|
|
6
8
|
|
7
9
|
# Fetches list of transactions belonging to the given +wallet_id+.
|
8
10
|
# Optional +filters+ is a hash accepting following keys:
|
9
|
-
# - +page+, +per_page+: pagination params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
11
|
+
# - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
|
10
12
|
# - other keys specific for transactions filtering (see MangoPay::Transaction.fetch)
|
11
13
|
def self.transactions(wallet_id, filters = {})
|
12
14
|
Transaction.fetch(wallet_id, filters)
|
@@ -28,6 +28,44 @@ describe MangoPay::KycDocument do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
describe 'FETCH ALL' do
|
32
|
+
it 'fetches a list of documents' do
|
33
|
+
usr1 = create_new_natural_user()
|
34
|
+
usr2 = create_new_natural_user()
|
35
|
+
doc1 = create_new_document(usr1)
|
36
|
+
doc2 = create_new_document(usr1)
|
37
|
+
doc3 = create_new_document(usr2)
|
38
|
+
|
39
|
+
# fetch all docs for user 1
|
40
|
+
docs = MangoPay::KycDocument.fetch_all(usr1['Id'])
|
41
|
+
expect(docs).to be_kind_of(Array)
|
42
|
+
expect(docs.count).to eq 2
|
43
|
+
expect(docs[0]['Id']).to eq doc1['Id']
|
44
|
+
expect(docs[1]['Id']).to eq doc2['Id']
|
45
|
+
|
46
|
+
# fetch all docs for user 2
|
47
|
+
docs = MangoPay::KycDocument.fetch_all(usr2['Id'])
|
48
|
+
expect(docs).to be_kind_of(Array)
|
49
|
+
expect(docs.count).to eq 1
|
50
|
+
expect(docs[0]['Id']).to eq doc3['Id']
|
51
|
+
|
52
|
+
# fetch all docs ever
|
53
|
+
docs = MangoPay::KycDocument.fetch_all()
|
54
|
+
expect(docs).to be_kind_of(Array)
|
55
|
+
expect(docs.count).to be >= 3 # at least last 3 docs, but probably many more
|
56
|
+
|
57
|
+
# fetch last 3 docs (sorting by date descending)
|
58
|
+
docs = MangoPay::KycDocument.fetch_all(nil, filter = {'page' => 1, 'per_page' => 3, 'sort' => 'CreationDate:desc'})
|
59
|
+
expect(docs).to be_kind_of(Array)
|
60
|
+
expect(docs.count).to eq 3
|
61
|
+
# all 3 are at top as lastly created
|
62
|
+
# but may share the same CreationDate
|
63
|
+
# so the order between them is undetermined
|
64
|
+
expect(docs).to include(doc1, doc2, doc3)
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
31
69
|
describe 'CREATE PAGE' do
|
32
70
|
|
33
71
|
def create_page(file)
|
@@ -35,20 +35,4 @@ describe MangoPay::PayIn::Card::Web, type: :feature do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
describe 'REFUND' do
|
39
|
-
it 'refunds a payin' do
|
40
|
-
payin = new_payin_card_web
|
41
|
-
refund = MangoPay::PayIn.refund(payin['Id'], {AuthorId: payin['AuthorId']})
|
42
|
-
expect(refund['Id']).not_to be_nil
|
43
|
-
expect(refund['Type']).to eq('PAYOUT')
|
44
|
-
expect(refund['Nature']).to eq('REFUND')
|
45
|
-
expect(refund['InitialTransactionType']).to eq('PAYIN')
|
46
|
-
expect(refund['InitialTransactionId']).to eq(payin['Id'])
|
47
|
-
expect(refund['DebitedWalletId']).to eq(payin['CreditedWalletId'])
|
48
|
-
expect(refund['Status']).to eq('FAILED')
|
49
|
-
expect(refund['ResultCode']).to eq('001001')
|
50
|
-
expect(refund['ResultMessage']).to eq('Unsufficient wallet balance')
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
38
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
describe MangoPay::PayIn::DirectDebit::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('DIRECT_DEBIT')
|
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 directdebit web payin' do
|
19
|
+
created = new_payin_directdebit_web
|
20
|
+
expect(created['Id']).not_to be_nil
|
21
|
+
check_type_and_status(created)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'FETCH' do
|
26
|
+
it 'fetches a payin' do
|
27
|
+
created = new_payin_directdebit_web
|
28
|
+
fetched = MangoPay::PayIn.fetch(created['Id'])
|
29
|
+
expect(fetched['Id']).to eq(created['Id'])
|
30
|
+
expect(fetched['CreationDate']).to eq(created['CreationDate'])
|
31
|
+
expect(fetched['CreditedFunds']).to eq(created['CreditedFunds'])
|
32
|
+
expect(fetched['CreditedWalletId']).to eq(created['CreditedWalletId'])
|
33
|
+
check_type_and_status(created)
|
34
|
+
check_type_and_status(fetched)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -33,7 +33,8 @@ end
|
|
33
33
|
shared_context 'users' do
|
34
34
|
###############################################
|
35
35
|
|
36
|
-
let(:new_natural_user) {
|
36
|
+
let(:new_natural_user) { create_new_natural_user }
|
37
|
+
def create_new_natural_user
|
37
38
|
MangoPay::NaturalUser.create({
|
38
39
|
Tag: 'Test natural user',
|
39
40
|
Email: 'my@email.com',
|
@@ -47,7 +48,7 @@ shared_context 'users' do
|
|
47
48
|
Occupation: 'Worker',
|
48
49
|
IncomeRange: 1
|
49
50
|
})
|
50
|
-
|
51
|
+
end
|
51
52
|
|
52
53
|
let(:new_legal_user) {
|
53
54
|
MangoPay::LegalUser.create({
|
@@ -119,12 +120,13 @@ shared_context 'kyc_documents' do
|
|
119
120
|
###############################################
|
120
121
|
include_context 'users'
|
121
122
|
|
122
|
-
let(:new_document) {
|
123
|
-
|
123
|
+
let(:new_document) { create_new_document(new_natural_user) }
|
124
|
+
def create_new_document(user)
|
125
|
+
MangoPay::KycDocument.create(user['Id'], {
|
124
126
|
Type: 'IDENTITY_PROOF',
|
125
127
|
Tag: 'Test document'
|
126
128
|
})
|
127
|
-
|
129
|
+
end
|
128
130
|
end
|
129
131
|
|
130
132
|
###############################################
|
@@ -133,6 +135,24 @@ shared_context 'payins' do
|
|
133
135
|
include_context 'users'
|
134
136
|
include_context 'wallets'
|
135
137
|
|
138
|
+
###############################################
|
139
|
+
# directdebit/web
|
140
|
+
###############################################
|
141
|
+
|
142
|
+
let(:new_payin_directdebit_web) {
|
143
|
+
MangoPay::PayIn::DirectDebit::Web.create({
|
144
|
+
AuthorId: new_natural_user['Id'],
|
145
|
+
CreditedUserId: new_wallet['Owners'][0],
|
146
|
+
CreditedWalletId: new_wallet['Id'],
|
147
|
+
DebitedFunds: { Currency: 'EUR', Amount: 1000 },
|
148
|
+
Fees: { Currency: 'EUR', Amount: 0 },
|
149
|
+
DirectDebitType: 'GIROPAY',
|
150
|
+
ReturnURL: MangoPay.configuration.root_url,
|
151
|
+
Culture: 'FR',
|
152
|
+
Tag: 'Test PayIn/DirectDebit/Web'
|
153
|
+
})
|
154
|
+
}
|
155
|
+
|
136
156
|
###############################################
|
137
157
|
# card/web
|
138
158
|
###############################################
|
data/spec/spec_helper.rb
CHANGED
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.13
|
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: 2014-
|
12
|
+
date: 2014-09-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- spec/mangopay/payin_bankwire_direct_spec.rb
|
109
109
|
- spec/mangopay/payin_card_direct_spec.rb
|
110
110
|
- spec/mangopay/payin_card_web_spec.rb
|
111
|
+
- spec/mangopay/payin_directdebit_web_spec.rb
|
111
112
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
112
113
|
- spec/mangopay/payout_bankwire_spec.rb
|
113
114
|
- spec/mangopay/preauthorization_spec.rb
|
@@ -156,6 +157,7 @@ test_files:
|
|
156
157
|
- spec/mangopay/payin_bankwire_direct_spec.rb
|
157
158
|
- spec/mangopay/payin_card_direct_spec.rb
|
158
159
|
- spec/mangopay/payin_card_web_spec.rb
|
160
|
+
- spec/mangopay/payin_directdebit_web_spec.rb
|
159
161
|
- spec/mangopay/payin_preauthorized_direct_spec.rb
|
160
162
|
- spec/mangopay/payout_bankwire_spec.rb
|
161
163
|
- spec/mangopay/preauthorization_spec.rb
|