mangopay 3.0.14 → 3.0.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9df99db85801718450fba187b20520f5cd41a907
4
- data.tar.gz: baccad9529b9c855a6336aa00cef278b8c84fcf2
3
+ metadata.gz: ac1062d37ee591f7ab222dd843d085d1906f0769
4
+ data.tar.gz: fedb8bffa95b81821d9914204dfd05830da60572
5
5
  SHA512:
6
- metadata.gz: 3936971f152acb16d0ced41de67f7260dd8769e86e9bc730303a2fb1c9b335454bc0ae51f2e5e872e8e5a2e3f2a4a2a18b85ba22934ef60859a063ef6bb46fa4
7
- data.tar.gz: 1d52a67d41f38ddf055c252a7b2ec9b77391dc3154bfdf7e2d0107980686f0e2b3147f58afe91613536430f73a3e229d6746a35747aa60c6828344de16a32431
6
+ metadata.gz: e48ebdaafab57a94efd1f40d676acb0e5612af28607ab718a444cfb20476fa8029832e172b6b1469a3398abe2c172b67914f11012c008f5baf9c7da3270a9055
7
+ data.tar.gz: dc0e9578c6b88670d631227ceabcebc436f9ce8d0ce6caaafe05c2c5ad34a0a06561e0e3234cc0710997e1ef0c936c156bf02001c55508ba187b6a1bde89c203
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # MangoPay2 Ruby SDK
1
+ # Mangopay Ruby SDK
2
2
 
3
- The gem for interacting with the version 2 of the MangoPay API.
3
+ The gem for interacting with the version 2 of the Mangopay API.
4
4
  See the [API documentation](http://docs.mangopay.com/api-references/)
5
5
  for more details on the API.
6
6
 
@@ -10,7 +10,7 @@ Tested on the following versions of Ruby: 1.9.2, 1.9.3, 2.0.0
10
10
 
11
11
  ### Version 3.*
12
12
  ** BREAKING CHANGES **
13
- This version (3.*) of the gem is targeting the MangoPay API Version 2.
13
+ This version (3.*) of the gem is targeting the Mangopay API Version 2.
14
14
  It has a brand new structure to make the api calls easier to use
15
15
  and is not backward compatible with 2.* series.
16
16
 
@@ -21,11 +21,11 @@ and is not backward compatible with 2.* series.
21
21
  or by adding it to your Gemfile ```gem 'mangopay'```
22
22
 
23
23
  * The Rails users will be happy to know that there is a new generator script
24
- that will help you configure your access to the MangoPay API version 2.
24
+ that will help you configure your access to the Mangopay API version 2.
25
25
  Simply run ``rails generate mangopay:install CLIENT_ID CLIENT_NAME CLIENT_EMAIL``
26
26
  where CLIENT_ID is the id you will use to connect to the api
27
27
  and CLIENT_NAME is a full name that will be use to identify all communications
28
- between you and the MangoPay Team.
28
+ between you and the Mangopay Team.
29
29
 
30
30
  * Otherwise, call ```MangoPay.configure``` in your script as shown in the snippet below.
31
31
 
@@ -86,7 +86,7 @@ end
86
86
  Make sure that you have run: ```bundle install```
87
87
  Then you just have to run rspec ```rspec``` to run all the test suite.
88
88
  Feel free to report any test failure by creating an issue
89
- on the [Gem's Github](https://github.com/MangoPay/mangopay2-ruby-sdk/issues)
89
+ on the [Gem's Github](https://github.com/Mangopay/mangopay2-ruby-sdk/issues)
90
90
 
91
91
  ## Contributing
92
92
 
@@ -40,15 +40,18 @@ module MangoPay
40
40
  # - You can create as many pages as needed
41
41
  # - Change Status to 'VALIDATION_ASKED' to submit KYC documents
42
42
  #
43
- # The file_or_base64 param may be:
44
- # - either a File instance
45
- # - or a string: in this case it has to be Base64 encoded!
43
+ # The file_content_base64 param may be:
44
+ # - Base64 encoded file content
45
+ # - or nil: in this case pass the file path in the next param
46
46
  #
47
- def create_page(user_id, document_id, file_or_base64)
48
- base64 = (file_or_base64.is_a? File) ? Base64.encode64(file_or_base64.read) : file_or_base64;
47
+ def create_page(user_id, document_id, file_content_base64, file_path = nil)
48
+ if file_content_base64.nil? && !file_path.nil?
49
+ bts = File.open(file_path, 'rb') { |f| f.read }
50
+ file_content_base64 = Base64.encode64(bts)
51
+ end
49
52
  # normally it returns 204 HTTP code on success
50
53
  begin
51
- MangoPay.request(:post, url(user_id, document_id) + '/pages', {'File' => base64})
54
+ MangoPay.request(:post, url(user_id, document_id) + '/pages', {'File' => file_content_base64})
52
55
  rescue ResponseError => ex
53
56
  raise ex unless ex.code == '204'
54
57
  end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.0.14'
2
+ VERSION = '3.0.15'
3
3
  end
Binary file
@@ -72,15 +72,17 @@ describe MangoPay::KycDocument do
72
72
  MangoPay::KycDocument.create_page(new_natural_user['Id'], new_document['Id'], file)
73
73
  end
74
74
 
75
- it 'accepts File instance' do
76
- file = File.open(__FILE__)
77
- ret = create_page(file)
75
+ it 'accepts Base64 encoded file content' do
76
+ fnm = __FILE__.sub('.rb', '.png')
77
+ bts = File.open(fnm, 'rb') { |f| f.read }
78
+ b64 = Base64.encode64(bts)
79
+ ret = create_page(b64)
78
80
  expect(ret).to be_nil
79
81
  end
80
82
 
81
- it 'accepts base64-encoded string' do
82
- file = Base64.encode64('any file content...')
83
- ret = create_page(file)
83
+ it 'accepts file path' do
84
+ fnm = __FILE__.sub('.rb', '.png')
85
+ ret = MangoPay::KycDocument.create_page(new_natural_user['Id'], new_document['Id'], nil, fnm)
84
86
  expect(ret).to be_nil
85
87
  end
86
88
 
@@ -192,7 +192,7 @@ shared_context 'payins' do
192
192
  data: cardreg['PreregistrationData'],
193
193
  accessKeyRef: cardreg['AccessKey'],
194
194
  cardNumber: 4970100000000154,
195
- cardExpirationDate: 1214,
195
+ cardExpirationDate: 1218,
196
196
  cardCvx: 123}
197
197
  res = Net::HTTP.post_form(URI(cardreg['CardRegistrationURL']), data)
198
198
  raise Exception, [res, res.body] unless (res.is_a?(Net::HTTPOK) && res.body.start_with?('data='))
@@ -307,7 +307,7 @@ shared_context 'transfers' do
307
307
  CreditedUserId: to_wallet['Owners'][0],
308
308
  CreditedWalletId: to_wallet['Id'],
309
309
  DebitedFunds: { Currency: 'EUR', Amount: amnt},
310
- Fees: { Currency: 'EUR', Amout: 0},
310
+ Fees: { Currency: 'EUR', Amount: 0},
311
311
  Tag: 'Test transfer'
312
312
  })
313
313
  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.14
4
+ version: 3.0.15
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-11-27 00:00:00.000000000 Z
12
+ date: 2015-05-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -105,6 +105,7 @@ files:
105
105
  - spec/mangopay/event_spec.rb
106
106
  - spec/mangopay/fetch_filters_spec.rb
107
107
  - spec/mangopay/hook_spec.rb
108
+ - spec/mangopay/kyc_document_spec.png
108
109
  - spec/mangopay/kyc_document_spec.rb
109
110
  - spec/mangopay/payin_bankwire_direct_spec.rb
110
111
  - spec/mangopay/payin_card_direct_spec.rb
@@ -155,6 +156,7 @@ test_files:
155
156
  - spec/mangopay/event_spec.rb
156
157
  - spec/mangopay/fetch_filters_spec.rb
157
158
  - spec/mangopay/hook_spec.rb
159
+ - spec/mangopay/kyc_document_spec.png
158
160
  - spec/mangopay/kyc_document_spec.rb
159
161
  - spec/mangopay/payin_bankwire_direct_spec.rb
160
162
  - spec/mangopay/payin_card_direct_spec.rb