paybox_direct 0.2.6 → 0.2.7

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: 34fff9a08ecf0a9365b13d17efd8887889824075
4
- data.tar.gz: 4d05879a70ae4921d632f6055ef59cc4c46cb0fa
3
+ metadata.gz: 222c174628a01ba212c380b912261c45b2b0688e
4
+ data.tar.gz: e211f9892a4c1d4de1f704c59df0bde2abeaab0d
5
5
  SHA512:
6
- metadata.gz: 6183d454010fc15878f7c9626c7010a58eb582fff013278df74de92243eb831bca06fab51c615c27a3038a930c131aa2a021d253bfc2a153958f97ae9cd4386a
7
- data.tar.gz: 172e334b321b41d195c220f93e6d51de8882d6df1b3f74cc99262de5cf2e3dbe2d66b5b0d2425f9d4a29beb656c0499f9f000aacb39188bb7e109a080af6bb53
6
+ metadata.gz: 5e0601005030b8ac884e334f8bb61ba90ef646d687a042a647c75ea4b7de7ea373ade1a2495769497d0f5ec7aacd1ce7eb80f7f1593c32630721efa0ead15601
7
+ data.tar.gz: 1c483c8e1cc27e12e1625b6a179e643c4e2f38cc587055142cc618f1ef4c3b2198e224485b87398758084c76a5cc55e85135387f2fd0b9b70d7549a1cc4e53f2
@@ -17,7 +17,6 @@ class PayboxDirect::Request
17
17
 
18
18
  def initialize(vars, http_conn = nil)
19
19
  defaults = {
20
- "URL_ENCODE" => "O",
21
20
  "VERSION" => PayboxDirect.config.version.to_s.rjust(5, "0"),
22
21
  "SITE" => PayboxDirect.config.site.to_s.rjust(7, "0"),
23
22
  "RANG" => PayboxDirect.config.rank.to_s.rjust(2, "0"),
@@ -31,7 +30,9 @@ class PayboxDirect::Request
31
30
  if !PayboxDirect.config.bank.nil?
32
31
  defaults["ACQUEREUR"] = PayboxDirect.config.bank
33
32
  end
34
- @vars = defaults.merge(vars)
33
+ @vars = defaults.merge(vars).merge({
34
+ "URL_ENCODE" => "O"
35
+ })
35
36
 
36
37
  @post_request = nil
37
38
  @fields = nil
data/lib/paybox_direct.rb CHANGED
@@ -147,6 +147,7 @@ module PayboxDirect
147
147
  # == Options:
148
148
  # * amount: The decimal amount, e.g. 49.9 for €49.90 (or other currency)
149
149
  # * currency: The currency code, e.g. :EUR
150
+ # * ref: The application reference for this authorization
150
151
  # * request_id: The Paybox request ID (NUMAPPEL)
151
152
  # * transaction_id: The Paybox transaction ID (NUMTRANS)
152
153
  # * connection: (optional) A specific Net::HTTP connection
@@ -161,6 +162,7 @@ module PayboxDirect
161
162
  # * PayboxDirect::ServerUnavailableError, if Paybox server is unavailable
162
163
  def self.debit_authorization(amount:,
163
164
  currency:,
165
+ ref:,
164
166
  request_id:,
165
167
  transaction_id:,
166
168
  connection: nil)
@@ -170,11 +172,12 @@ module PayboxDirect
170
172
  raise ArgumentError, "transaction_id: Expecting Fixnum" unless transaction_id.is_a? Fixnum
171
173
 
172
174
  req = Request.new({
173
- "TYPE" => "00002",
174
- "MONTANT" => (amount.round(2) * 100).round.to_s.rjust(10, "0"),
175
- "DEVISE" => CURRENCIES[currency].to_s.rjust(3, "0"),
176
- "NUMAPPEL" => request_id.to_s.rjust(10, "0"),
177
- "NUMTRANS" => transaction_id.to_s.rjust(10, "0")
175
+ "TYPE" => "00002",
176
+ "MONTANT" => (amount.round(2) * 100).round.to_s.rjust(10, "0"),
177
+ "DEVISE" => CURRENCIES[currency].to_s.rjust(3, "0"),
178
+ "REFERENCE" => @@config.ref_prefix + ref,
179
+ "NUMAPPEL" => request_id.to_s.rjust(10, "0"),
180
+ "NUMTRANS" => transaction_id.to_s.rjust(10, "0")
178
181
  })
179
182
  req.http_connection = connection
180
183
  req.execute!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paybox_direct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kévin Lesénéchal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-21 00:00:00.000000000 Z
11
+ date: 2017-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  version: '0'
73
73
  requirements: []
74
74
  rubyforge_project:
75
- rubygems_version: 2.5.1
75
+ rubygems_version: 2.6.8
76
76
  signing_key:
77
77
  specification_version: 4
78
78
  summary: An API to Paybox Direct and Paybox Direct Plus