leetchi-wallet-services 1.2.0 → 1.2.1

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: dc26d8921bea8df356743fd0fd2d534aeec418f3
4
- data.tar.gz: f638468690d921ae8da932cfda227b041c2b67af
3
+ metadata.gz: 9cda21312c1cdba35005835d50eed4c537a736c9
4
+ data.tar.gz: 70572b3a012f697ebba5c07d0a94ded826998954
5
5
  SHA512:
6
- metadata.gz: 168fdd1a1ff9d42d472f7bd8a5f2457582433952a2df45e1d5d3842adde53e40f7b46884b7519161e2f063f14cea9c3031c4dc4614e3f7721237c388feb9851f
7
- data.tar.gz: e04e4459f75772ed4b36b9832559199848a94fb5882afa79da4ab3803330a75095d9950a1583bf562e0a1c90950a73bc08f27a4dfc7aae23a05d36d1302af933
6
+ metadata.gz: 75cc9b947b8eb9ca55ecb2cb4633084a67cf0094393dac983ec9b750d238b911cf06e937c47b79955edd65d9caaabf97cb84dc4b5dd60f16c0238db2eb8e162b
7
+ data.tar.gz: 03ebe19bae37fa4487a165f94cbb67c36c9fa70ebf69b47958229f7b92738d46e197d3454da39e36a96c3579a8df01ce9ade9c6dbe408e8b332580901996b1bc
data/README.md CHANGED
@@ -58,6 +58,7 @@ The gem implements the following resources:
58
58
  - Contribution
59
59
  - Expense
60
60
  - Operation
61
+ - Immediate Contribution
61
62
  - Recurrent Contribution (only available in preproduction)
62
63
  - Strong Authentication
63
64
  - Transfer
@@ -22,12 +22,12 @@ module Leetchi
22
22
  def self.form_request(upload_url, file_name, file_path)
23
23
  url = URI(upload_url)
24
24
  File.open(file_path) do |file|
25
- req = Net::HTTP::Post::Multipart.new(url, :file => UploadIO.new(file_path, file_type(file_path)), :name => file_name)
25
+ req = Net::HTTP::Post::Multipart.new(url.request_uri, :file => UploadIO.new(file, file_type(file_path), file_name))
26
26
  res = Net::HTTP.start(url.host, url.port, :use_ssl => url.scheme == 'https') do |http|
27
27
  http.request(req)
28
28
  end
29
29
  res.code == "200" ? true : false
30
- end
30
+ end
31
31
  end
32
32
 
33
33
  private
@@ -89,7 +89,7 @@ module Leetchi
89
89
  'png' => 'image/png',
90
90
  'pdf' => 'image/pdf'
91
91
  }
92
- file_types[file_path.to_s]
92
+ file_types[file_path.gsub(/^[^\.]+\./, "")]
93
93
  end
94
94
  end
95
95
  end
@@ -23,7 +23,7 @@ describe Leetchi::Card, :type => :feature do
23
23
  fill_in('cvv', :with => '123')
24
24
  click_button('paybutton')
25
25
  card = Leetchi::Card.details(card['ID'])
26
- while card["IsSucceeded"] == false do
26
+ while (card["CardNumber"] || []).length != 16 do
27
27
  card = Leetchi::Card.details(card['ID'])
28
28
  end
29
29
  card
@@ -12,28 +12,28 @@ describe Leetchi::ImmediateContribution, :type => :feature do
12
12
  })
13
13
  }
14
14
 
15
- let(:new_immediate_contribution) do
16
- contribution = Leetchi::Contribution.create({
17
- 'Tag' => 'test_contribution',
18
- 'UserID' => new_user['ID'],
19
- 'WalletID' => 0,
20
- 'Amount' => 10000,
21
- 'ReturnURL' => 'https://leetchi.com',
22
- 'RegisterMeanOfPayment' => true
15
+ let(:new_card) do
16
+ card = Leetchi::Card.create({
17
+ 'Tag' => 'test-card',
18
+ 'OwnerID' => new_user['ID'],
19
+ 'ReturnURL' => 'http://leetchi.com'
23
20
  })
24
- visit(contribution['PaymentURL'])
21
+ visit(card['RedirectURL'])
25
22
  fill_in('number', :with => '4970100000000154')
26
23
  fill_in('cvv', :with => '123')
27
24
  click_button('paybutton')
28
- contribution = Leetchi::Contribution.details(contribution['ID'])
29
- while contribution["IsSucceeded"] == false do
30
- contribution = Leetchi::Contribution.details(contribution['ID'])
25
+ card = Leetchi::Card.details(card['ID'])
26
+ while (card["CardNumber"] || []).length != 16 do
27
+ card = Leetchi::Card.details(card['ID'])
31
28
  end
32
- payment_card_id = contribution['PaymentCardID']
33
- Leetchi::ImmediateContribution.create({
29
+ card
30
+ end
31
+
32
+ let(:new_immediate_contribution) do
33
+ c = Leetchi::ImmediateContribution.create({
34
34
  'Tag' => 'test_contribution',
35
35
  'UserID' => new_user['ID'],
36
- 'PaymentCardID' => payment_card_id,
36
+ 'PaymentCardID' => new_card['ID'],
37
37
  'WalletID' => 0,
38
38
  'Amount' => 33300
39
39
  })
@@ -52,7 +52,7 @@ describe Leetchi::ImmediateContribution, :type => :feature do
52
52
  expect(new_immediate_contribution['ID']).not_to be_nil
53
53
  end
54
54
  end
55
-
55
+
56
56
  describe "GET" do
57
57
  it "get the immediate contribution" do
58
58
  immediate_contribution = Leetchi::ImmediateContribution.details(new_immediate_contribution['ID'])
@@ -69,4 +69,5 @@ describe Leetchi::ImmediateContribution, :type => :feature do
69
69
  expect(immediate_contribution_refund['ID']).to eq(new_immediate_contribution_refund['ID'])
70
70
  end
71
71
  end
72
+
72
73
  end
@@ -23,12 +23,18 @@ describe Leetchi::StrongAuthentication do
23
23
  })
24
24
  }
25
25
 
26
- let(:new_strong_authentication) {
26
+ let(:new_strong_beneficiary_authentication) {
27
27
  Leetchi::Beneficiary.create_strong_authentication(new_beneficiary['ID'], {
28
28
  'Tag' => 'test_beneficiary_strong_authentication'
29
29
  })
30
30
  }
31
31
 
32
+ let(:new_strong_user_authentication) {
33
+ Leetchi::User.create_strong_authentication(new_user['ID'], {
34
+ 'Tag' => 'test_user_strong_authentication'
35
+ })
36
+ }
37
+
32
38
  describe "GET" do
33
39
  it "get the pending strong authentication requests" do
34
40
  strong_authentication = Leetchi::StrongAuthentication.get
@@ -36,22 +42,41 @@ describe Leetchi::StrongAuthentication do
36
42
  end
37
43
  end
38
44
 
39
- describe "UPLOAD" do
45
+ describe "UPLOAD BENEFICIARY" do
40
46
  it "uploads a PDF file to complete a beneficiary strong authentication request" do
41
- document_upload = Leetchi::StrongAuthentication.upload(new_strong_authentication['UrlRequest'], 'spec/support-files/test_upload.pdf')
47
+ document_upload = Leetchi::StrongAuthentication.upload(new_strong_beneficiary_authentication['UrlRequest'], 'spec/support-files/test_upload.pdf')
42
48
  expect(document_upload).to be_true
43
49
  end
44
50
  it "uploads a JPG file to complete a beneficiary strong authentication request" do
45
- document_upload = Leetchi::StrongAuthentication.upload(new_strong_authentication['UrlRequest'], 'spec/support-files/test_upload.jpg')
51
+ document_upload = Leetchi::StrongAuthentication.upload(new_strong_beneficiary_authentication['UrlRequest'], 'spec/support-files/test_upload.jpg')
46
52
  expect(document_upload).to be_true
47
53
  end
48
54
  it "uploads a PNG file to complete a beneficiary strong authentication request" do
49
- document_upload = Leetchi::StrongAuthentication.upload(new_strong_authentication['UrlRequest'], 'spec/support-files/test_upload.png')
55
+ document_upload = Leetchi::StrongAuthentication.upload(new_strong_beneficiary_authentication['UrlRequest'], 'spec/support-files/test_upload.png')
50
56
  expect(document_upload).to be_true
51
57
  end
52
58
  it "uploads a GIF file to complete a beneficiary strong authentication request" do
53
- document_upload = Leetchi::StrongAuthentication.upload(new_strong_authentication['UrlRequest'], 'spec/support-files/test_upload.gif')
59
+ document_upload = Leetchi::StrongAuthentication.upload(new_strong_beneficiary_authentication['UrlRequest'], 'spec/support-files/test_upload.gif')
54
60
  expect(document_upload).to be_true
55
61
  end
56
62
  end
63
+
64
+ describe "UPLOAD USER" do
65
+ it "uploads a PDF file to complete a user strong authentication request" do
66
+ document_upload = Leetchi::StrongAuthentication.upload(new_strong_user_authentication['UrlRequest'], 'spec/support-files/test_upload.pdf')
67
+ expect(document_upload).to be_true
68
+ end
69
+ it "uploads a JPG file to complete a user strong authentication request" do
70
+ document_upload = Leetchi::StrongAuthentication.upload(new_strong_user_authentication['UrlRequest'], 'spec/support-files/test_upload.jpg')
71
+ expect(document_upload).to be_true
72
+ end
73
+ it "uploads a PNG file to complete a user strong authentication request" do
74
+ document_upload = Leetchi::StrongAuthentication.upload(new_strong_user_authentication['UrlRequest'], 'spec/support-files/test_upload.png')
75
+ expect(document_upload).to be_true
76
+ end
77
+ it "uploads a GIF file to complete a user strong authentication request" do
78
+ document_upload = Leetchi::StrongAuthentication.upload(new_strong_user_authentication['UrlRequest'], 'spec/support-files/test_upload.gif')
79
+ expect(document_upload).to be_true
80
+ end
81
+ end
57
82
  end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leetchi-wallet-services
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoffroy Lorieux
8
8
  - Vincent Cogne
9
+ - Eric Larch
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-06-21 00:00:00.000000000 Z
13
+ date: 2013-06-24 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: json
@@ -194,7 +195,8 @@ files:
194
195
  - spec/support-files/test_upload.pdf
195
196
  - spec/support-files/test_upload.png
196
197
  homepage: http://www.mangopay.com/
197
- licenses: []
198
+ licenses:
199
+ - MIT
198
200
  metadata: {}
199
201
  post_install_message:
200
202
  rdoc_options: []