mangopay 3.0.13 → 3.0.14

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: 399bb23725d407dca5bdc8650e2f98aaeb64ebc5
4
- data.tar.gz: 6fa52ebd8674dd692694325d056b4f55522c2cb7
3
+ metadata.gz: 9df99db85801718450fba187b20520f5cd41a907
4
+ data.tar.gz: baccad9529b9c855a6336aa00cef278b8c84fcf2
5
5
  SHA512:
6
- metadata.gz: e2606747f1f0643e35634af72448ae872bcffc49afdef3a29f086326bce0e5d48a33e9b20ccc6368208a63780966faab469fb71a163b49bceb26204f667d5ae7
7
- data.tar.gz: 39f1b1c4a851e162c69a6ee3b405e14a1940b6e64d68361812fa1ff5474985cf4c206512002d308de5655e05050c061b356c0adfa9c91d5749c171e63a3f1adb
6
+ metadata.gz: 3936971f152acb16d0ced41de67f7260dd8769e86e9bc730303a2fb1c9b335454bc0ae51f2e5e872e8e5a2e3f2a4a2a18b85ba22934ef60859a063ef6bb46fa4
7
+ data.tar.gz: 1d52a67d41f38ddf055c252a7b2ec9b77391dc3154bfdf7e2d0107980686f0e2b3147f58afe91613536430f73a3e229d6746a35747aa60c6828344de16a32431
data/lib/mangopay.rb CHANGED
@@ -31,6 +31,9 @@ module MangoPay
31
31
  autoload :JSON, 'mangopay/json'
32
32
  autoload :AuthorizationToken, 'mangopay/authorization_token'
33
33
 
34
+ # temporary
35
+ autoload :Temp, 'mangopay/temp'
36
+
34
37
  class Configuration
35
38
  attr_accessor :preproduction, :root_url,
36
39
  :client_id, :client_passphrase,
@@ -0,0 +1,74 @@
1
+ module MangoPay
2
+
3
+ module Temp
4
+
5
+ # As part of our migration project to allow users
6
+ # to move from v1 to v2 of our API,
7
+ # we have added a couple of temporary calls to the v2 API.
8
+ #
9
+ # They are not documented in normal way, but the calls are related to:
10
+ # - registering a card (POST & GET /temp/paymentcards)
11
+ # - and doing a web card payin with this card (POST /temp/immediate-payins)
12
+ # For the latter, a GET or refunds are done
13
+ # via the previously existing resources.
14
+ #
15
+ # !!! WARNING !!!
16
+ # These are TEMPORARY functions and WILL BE REMOVED in the future!
17
+ # You should CONTACT SUPPORT TEAM before using these features
18
+ # or if you have any questions.
19
+ class PaymentCard < Resource
20
+
21
+ # POST /temp/paymentcards
22
+ #
23
+ # Sent data:
24
+ # - UserId e.g. "12424242"
25
+ # - Tag e.g. "my tag"
26
+ # - Culture e.g. "FR"
27
+ # - ReturnURL e.g. "http://mysite.com/return"
28
+ # - TemplateURL e.g. "http://mysite.com/template"
29
+ #
30
+ # Received data:
31
+ # - UserId e.g. "12424242"
32
+ # - Tag e.g. "my tag"
33
+ # - Culture e.g. "FR"
34
+ # - ReturnURL e.g. "http://mysite.com/return"
35
+ # - TemplateURL e.g. "http://mysite.com/template"
36
+ # - RedirectURL e.g. "http://payline.com/redirect"
37
+ # - Alias e.g. null (but would be e.g. 497010XXXXXX4422 once the user has inputed their info and the card has been successfully registered"
38
+ # - Id: "1213131"
39
+ # - CreationDate: "13452522657"
40
+ include HTTPCalls::Create
41
+
42
+ # GET /temp/paymentcards
43
+ # Received data: as above
44
+ include HTTPCalls::Fetch
45
+
46
+ # POST /temp/immediate-payins
47
+ #
48
+ # Sent data:
49
+ # - AuthorId e.g. "121412"
50
+ # - CreditUserId e.g. "121412"
51
+ # - PaymentCardId e.g. "322311"
52
+ # - Tag e.g. "my tag"
53
+ # - CreditedWalletId e.g. "123134"
54
+ # - DebitedFunds e.g. normal Money object of Currency and Amount
55
+ # - Fees e.g. normal Money object of Currency and Amount
56
+ #
57
+ # Received data:
58
+ # Normal card web payin transaction, with the addition of:
59
+ # - PaymentCardId e.g. "322311"
60
+ def self.immediate_payin(params)
61
+ url = "#{MangoPay.api_path}/temp/immediate-payins"
62
+ MangoPay.request(:post, url, params)
63
+ end
64
+
65
+ def self.url(id = nil)
66
+ if id
67
+ "#{MangoPay.api_path}/temp/paymentcards/#{CGI.escape(id.to_s)}"
68
+ else
69
+ "#{MangoPay.api_path}/temp/paymentcards"
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.0.13'
2
+ VERSION = '3.0.14'
3
3
  end
@@ -0,0 +1,31 @@
1
+ describe MangoPay::Temp::PaymentCard do
2
+ include_context 'users'
3
+
4
+ def new_temp_paymentcard
5
+ MangoPay::Temp::PaymentCard.create({
6
+ Tag: 'Test temp payment card',
7
+ UserId: new_natural_user['Id'],
8
+ Culture: 'FR',
9
+ ReturnURL: 'https://mysite.com/return',
10
+ TemplateURL: 'https://mysite.com/template'
11
+ })
12
+ end
13
+
14
+ describe 'CREATE' do
15
+ it 'creates a temp payment card' do
16
+ created = new_temp_paymentcard
17
+ expect(created['Id']).to_not be_nil
18
+ expect(created['UserId']).to eq(new_natural_user['Id'])
19
+ end
20
+ end
21
+
22
+ describe 'FETCH' do
23
+ it 'fetches a temp payment card' do
24
+ created = new_temp_paymentcard
25
+ fetched = MangoPay::Temp::PaymentCard.fetch(created['Id'])
26
+ expect(fetched['Id']).to eq(created['Id'])
27
+ expect(fetched['UserId']).to eq(created['UserId'])
28
+ end
29
+ end
30
+
31
+ 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.13
4
+ version: 3.0.14
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-09-15 00:00:00.000000000 Z
12
+ date: 2014-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -90,6 +90,7 @@ files:
90
90
  - lib/mangopay/pre_authorization.rb
91
91
  - lib/mangopay/refund.rb
92
92
  - lib/mangopay/resource.rb
93
+ - lib/mangopay/temp.rb
93
94
  - lib/mangopay/transaction.rb
94
95
  - lib/mangopay/transfer.rb
95
96
  - lib/mangopay/user.rb
@@ -114,6 +115,7 @@ files:
114
115
  - spec/mangopay/preauthorization_spec.rb
115
116
  - spec/mangopay/refund_spec.rb
116
117
  - spec/mangopay/shared_resources.rb
118
+ - spec/mangopay/temp_paymentcard_spec.rb
117
119
  - spec/mangopay/transaction_spec.rb
118
120
  - spec/mangopay/transfer_spec.rb
119
121
  - spec/mangopay/user_spec.rb
@@ -163,6 +165,7 @@ test_files:
163
165
  - spec/mangopay/preauthorization_spec.rb
164
166
  - spec/mangopay/refund_spec.rb
165
167
  - spec/mangopay/shared_resources.rb
168
+ - spec/mangopay/temp_paymentcard_spec.rb
166
169
  - spec/mangopay/transaction_spec.rb
167
170
  - spec/mangopay/transfer_spec.rb
168
171
  - spec/mangopay/user_spec.rb