mangopay 3.42.1 → 3.43.0

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
  SHA256:
3
- metadata.gz: 879bafa3fe5fd5adfea4cd26ae6ee9999f6943178748f9000f52c7a523dcfc9e
4
- data.tar.gz: 52c1b5b99f13209340f0c96d1229241a32c83e6b3baa1c503c34d27dfead0325
3
+ metadata.gz: e8e415a3b362b0ba193e2477fdc7508c7559b9523b40a590612e4e74150003ea
4
+ data.tar.gz: 7c9cbca2320c1398508f208d9650d2adce0a10817df521ca37d96ca8901c3135
5
5
  SHA512:
6
- metadata.gz: 50b75a77849b4414d345e5d16f2ccec95cd388cd74c9162baed376837dd734b58fb907b0d6f7b020a416cf0c26b7fe649d3f454c1046690708b9f4da6d81faef
7
- data.tar.gz: d4168edc1c8dbe69c86ba13462bfe716d61bd035c489c21ac24a547b1e4bce8d9fb312e10195633339efafc5b912991b9bc61052eb5133d0e4ca3d9a431e30ce
6
+ metadata.gz: 7384bcd1a7c53eef9dc2a069693087283667b256e575ae216ea0ddc242a3e66ea9e7888f4dfe9a4911acb44c5d884621149ea8c2db87ae3f98617078dc9033ab
7
+ data.tar.gz: 2aa7998c203b484274941a2cb5c67190d3364920c8968ec0095944145993dc0288ab92e71fd0a0a1f60ad4d39ae030607d01a44a79c9cbba602ffff734c499bc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [3.43.0] - 2025-11-19
2
+ ### Added
3
+ First batch of endpoints for direct acquiring solution (in private beta).
4
+
1
5
  ## [3.42.1] - 2025-11-06
2
6
  ### Improved
3
7
  - Support for case variations in error handler #313
@@ -0,0 +1,56 @@
1
+ module MangoPay
2
+
3
+ class Acquiring < Resource
4
+ module PayIn
5
+ module Card
6
+ class Direct < Resource
7
+ def self.create(params, idempotency_key = nil)
8
+ MangoPay.request(:post, "#{MangoPay.api_path}/acquiring/payins/card/direct", params, {}, idempotency_key)
9
+ end
10
+ end
11
+ end
12
+
13
+ module ApplePay
14
+ class Direct < Resource
15
+ def self.create(params, idempotency_key = nil)
16
+ MangoPay.request(:post, "#{MangoPay.api_path}/acquiring/payins/payment-methods/applepay", params, {}, idempotency_key)
17
+ end
18
+ end
19
+ end
20
+
21
+ module GooglePay
22
+ class Direct < Resource
23
+ def self.create(params, idempotency_key = nil)
24
+ MangoPay.request(:post, "#{MangoPay.api_path}/acquiring/payins/payment-methods/googlepay", params, {}, idempotency_key)
25
+ end
26
+ end
27
+ end
28
+
29
+ module Ideal
30
+ class Web < Resource
31
+ def self.create(params, idempotency_key = nil)
32
+ MangoPay.request(:post, "#{MangoPay.api_path}/acquiring/payins/payment-methods/ideal", params, {}, idempotency_key)
33
+ end
34
+ end
35
+ end
36
+
37
+ module PayPal
38
+ class Web < Resource
39
+ def self.create(params, idempotency_key = nil)
40
+ MangoPay.request(:post, "#{MangoPay.api_path}/acquiring/payins/payment-methods/paypal", params, {}, idempotency_key)
41
+ end
42
+
43
+ def self.create_data_collection(params, idempotency_key = nil)
44
+ MangoPay.request(:post, "#{MangoPay.api_path}/acquiring/payins/payment-methods/paypal/data-collection", params, {}, idempotency_key)
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ class Refund < Resource
51
+ def self.create(pay_in_id, params, idempotency_key = nil)
52
+ MangoPay.request(:post, "#{MangoPay.api_path}/acquiring/payins/#{pay_in_id}/refunds", params, {}, idempotency_key)
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,3 +1,3 @@
1
1
  module MangoPay
2
- VERSION = '3.42.1'
2
+ VERSION = '3.43.0'
3
3
  end
data/lib/mangopay.rb CHANGED
@@ -54,6 +54,7 @@ module MangoPay
54
54
  autoload :IdentityVerification, 'mangopay/identity_verification'
55
55
  autoload :Recipient, 'mangopay/recipient'
56
56
  autoload :Settlement, 'mangopay/settlement'
57
+ autoload :Acquiring, 'mangopay/acquiring'
57
58
 
58
59
  # temporary
59
60
  autoload :Temp, 'mangopay/temp'
@@ -0,0 +1,176 @@
1
+ xdescribe MangoPay::Hook do
2
+ include_context 'wallets'
3
+ include_context 'payins'
4
+
5
+ let(:card_id) { 'placeholder' }
6
+
7
+ describe 'PAY_IN CARD DIRECT' do
8
+ it 'creates a Card Direct PayIn' do
9
+ created = create_new_pay_in_card_direct
10
+
11
+ assert_common_pay_in_properties(created)
12
+ expect(created['PaymentType']).to eq('CARD')
13
+ expect(created['ExecutionType']).to eq('DIRECT')
14
+ end
15
+ end
16
+
17
+ describe 'REFUND' do
18
+ it 'creates a Refund for a PayIn' do
19
+ pay_in = create_new_pay_in_card_direct
20
+ refund = MangoPay::Acquiring::Refund.create(pay_in['Id'], { DebitedFunds: { Currency: 'EUR', Amount: 10 } })
21
+
22
+ expect(refund['Id']).not_to be_nil
23
+ expect(refund['Status']).to eq('SUCCEEDED')
24
+ expect(refund['Type']).to eq('PAYOUT')
25
+ expect(refund['Nature']).to eq('REFUND')
26
+ expect(refund['InitialTransactionType']).to eq('PAYIN')
27
+ expect(refund['InitialTransactionId']).to eq(pay_in['Id'])
28
+ end
29
+ end
30
+
31
+ describe 'PAY_IN APPLE_PAY' do
32
+ it 'creates an ApplePay direct PayIn' do
33
+ created = MangoPay::Acquiring::PayIn::ApplePay::Direct.create(
34
+ DebitedFunds: { Currency: 'EUR', Amount: 100 },
35
+ PaymentData: {
36
+ transactionId: "97e64d87f13a89ff6443cdcc205d5ccf7e15368b0d64126a8a2e0888a3a5c2a0",
37
+ network: "MasterCard",
38
+ tokenDataø: "{\"data\":\"2TihgKbmyPje02.........wAAAAAAAA==\",\"header\":{\"publicKeyHash\":\"xUyeFb75d359bfPEiq2JJMQj694UAxtTuBsaTWMOJxQ=\",\"ephemeralPublicKey\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEkeuICjZ7x15b7hPEBEBT5Zp43l95wCmJCU3QNxBvOCusG9w9sJMULuXlT4K8LOlPgaZzAcyWlfNwnLivVdOPfg==\",\"transactionId\":\"97e64d87f13a89ff6443cdcc205d5ccf7e15368b0d64126a8a2e0888a3a5c2a0\"},\"version\":\"EC_v1\"}"
39
+ }
40
+ )
41
+
42
+ assert_common_pay_in_properties(created)
43
+ expect(created['PaymentType']).to eq('APPLEPAY')
44
+ expect(created['ExecutionType']).to eq('DIRECT')
45
+ end
46
+ end
47
+
48
+ describe 'PAY_IN GOOGLE_PAY' do
49
+ it 'creates a GooglePay direct PayIn' do
50
+ created = MangoPay::Acquiring::PayIn::GooglePay::Direct.create(
51
+ DebitedFunds: { Currency: 'EUR', Amount: 199 },
52
+ IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C",
53
+ SecureModeReturnURL: 'http://test.com',
54
+ BrowserInfo: {
55
+ AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
56
+ JavaEnabled: true,
57
+ Language: "fr-FR",
58
+ ColorDepth: 4,
59
+ ScreenHeight: 1800,
60
+ ScreenWidth: 400,
61
+ JavascriptEnabled: true,
62
+ TimeZoneOffset: "+60",
63
+ UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
64
+ },
65
+ PaymentData: "{\"signature\":\"MEUCIQDc49/Bw1lTk8ok2fUe4UT......................\\u003d\\\"}\"}"
66
+ )
67
+
68
+ assert_common_pay_in_properties(created)
69
+ expect(created['PaymentType']).to eq('GOOGLEPAY')
70
+ expect(created['ExecutionType']).to eq('DIRECT')
71
+ end
72
+ end
73
+
74
+ describe 'PAY_IN IDEAL WEB' do
75
+ it 'creates an Ideal Web PayIn' do
76
+ created = MangoPay::Acquiring::PayIn::Ideal::Web.create(
77
+ DebitedFunds: { Currency: 'EUR', Amount: 100 },
78
+ ReturnURL: 'http://www.my-site.com/returnURL'
79
+ )
80
+
81
+ assert_common_pay_in_properties(created)
82
+ expect(created['PaymentType']).to eq('IDEAL')
83
+ expect(created['ExecutionType']).to eq('WEB')
84
+ end
85
+ end
86
+
87
+ describe 'PAY_IN PAYPAL' do
88
+ it 'creates a PayPal Web PayIn' do
89
+ created = MangoPay::Acquiring::PayIn::PayPal::Web.create(
90
+ DebitedFunds: { Currency: 'EUR', Amount: 400 },
91
+ ReturnUrl: "http://example.com",
92
+ LineItems: [
93
+ {
94
+ Name: "running shoes",
95
+ Quantity: 1,
96
+ UnitAmount: 200,
97
+ TaxAmount: 0,
98
+ Description: "seller1 ID"
99
+ },
100
+ {
101
+ Name: "running shoes",
102
+ Quantity: 1,
103
+ UnitAmount: 200,
104
+ TaxAmount: 0,
105
+ Description: "seller2 ID"
106
+ }
107
+ ]
108
+ )
109
+
110
+ assert_common_pay_in_properties(created)
111
+ expect(created['PaymentType']).to eq('PAYPAL')
112
+ expect(created['ExecutionType']).to eq('WEB')
113
+ end
114
+
115
+ it 'creates PayPal DataCollection' do
116
+ data_collection = MangoPay::Acquiring::PayIn::PayPal::Web.create_data_collection(
117
+ {
118
+ "sender_account_id": "A12345N343",
119
+ "sender_first_name": "Jane",
120
+ "sender_last_name": "Doe",
121
+ "sender_email": "jane.doe@sample.com",
122
+ "sender_phone": "(042)11234567",
123
+ "sender_address_zip": "75009",
124
+ "sender_country_code": "FR",
125
+ "sender_create_date": "2012-12-09T19:14:55.277-0:00",
126
+ "sender_signup_ip": "10.220.90.20",
127
+ "sender_popularity_score": "high",
128
+ "receiver_account_id": "A12345N344",
129
+ "receiver_create_date": "2012-12-09T19:14:55.277-0:00",
130
+ "receiver_email": "jane@sample.com",
131
+ "receiver_address_country_code": "FR",
132
+ "business_name": "Jane Ltd",
133
+ "recipient_popularity_score": "high",
134
+ "first_interaction_date": "2012-12-09T19:14:55.277-0:00",
135
+ "txn_count_total": "34",
136
+ "vertical": "Household goods",
137
+ "transaction_is_tangible": "0"
138
+ }
139
+ )
140
+ expect(data_collection['dataCollectionId']).not_to be_nil
141
+ end
142
+ end
143
+
144
+ def create_new_pay_in_card_direct
145
+ MangoPay::Acquiring::PayIn::Card::Direct.create(
146
+ DebitedFunds: { Currency: 'EUR', Amount: 100 },
147
+ CardType: 'CB_VISA_MASTERCARD',
148
+ CardId: card_id,
149
+ SecureMode: 'DEFAULT',
150
+ SecureModeReturnURL: 'http://test.com',
151
+ Tag: 'Acquiring Test PayIn/Card/Direct',
152
+ BrowserInfo: {
153
+ AcceptHeader: "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
154
+ JavaEnabled: true,
155
+ Language: "FR-FR",
156
+ ColorDepth: 4,
157
+ ScreenHeight: 1800,
158
+ ScreenWidth: 400,
159
+ JavascriptEnabled: true,
160
+ TimeZoneOffset: "+60",
161
+ UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
162
+ },
163
+ IpAddress: "2001:0620:0000:0000:0211:24FF:FE80:C12C"
164
+ )
165
+ end
166
+
167
+ def assert_common_pay_in_properties(pay_in)
168
+ expect(pay_in['Id']).not_to be_nil
169
+ expect(pay_in['Type']).to eq('PAYIN')
170
+ expect(pay_in['Nature']).to eq('REGULAR')
171
+ expect(pay_in['Status']).to eq('SUCCEEDED')
172
+ expect(pay_in['ResultCode']).to eq('000000')
173
+ expect(pay_in['ResultMessage']).to eq('Success')
174
+ expect(pay_in['ExecutionDate']).to be > 0
175
+ end
176
+ 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.42.1
4
+ version: 3.43.0
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: 2025-11-06 00:00:00.000000000 Z
12
+ date: 2025-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -75,6 +75,7 @@ files:
75
75
  - lib/generators/mangopay/install_generator.rb
76
76
  - lib/generators/templates/mangopay.rb.erb
77
77
  - lib/mangopay.rb
78
+ - lib/mangopay/acquiring.rb
78
79
  - lib/mangopay/authorization_token.rb
79
80
  - lib/mangopay/bank_account.rb
80
81
  - lib/mangopay/bankingaliases.rb
@@ -118,6 +119,7 @@ files:
118
119
  - lib/mangopay/virtual_account.rb
119
120
  - lib/mangopay/wallet.rb
120
121
  - mangopay.gemspec
122
+ - spec/mangopay/acquiring_spec.rb
121
123
  - spec/mangopay/authorization_token_spec.rb
122
124
  - spec/mangopay/bank_account_spec.rb
123
125
  - spec/mangopay/bankingaliases_spec.rb
@@ -208,6 +210,7 @@ signing_key:
208
210
  specification_version: 4
209
211
  summary: Ruby bindings for the version 2 of the MANGOPAY API
210
212
  test_files:
213
+ - spec/mangopay/acquiring_spec.rb
211
214
  - spec/mangopay/authorization_token_spec.rb
212
215
  - spec/mangopay/bank_account_spec.rb
213
216
  - spec/mangopay/bankingaliases_spec.rb