payline 0.0.2 → 0.0.3

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: c3d869329565b49c6354a07e77d88f9d21c87e33
4
- data.tar.gz: 5d9c63efc05ba39072b61311410f051e485b8a09
3
+ metadata.gz: b3c625f6bec31b410e849e830804d25b9d562cf3
4
+ data.tar.gz: b8161b441daa9f14f3b53a88d1b3ee170214742b
5
5
  SHA512:
6
- metadata.gz: aa62619e02a347707c113a29d08c08a78c7a6f44b1ef6c4f07e3c504ad912b741b8d83e95d36c2c04e955c41d5173d2c347567c60f600ca1d2e33af6d2bd5ab9
7
- data.tar.gz: 754a3107c9f31bc1d47f611b7953fcf9dace4792a93822b8d7c7b1def5b30c6892c279e9b0e3b001625e9921de825da7d2c943bb261b79b34721ca0ab89e140f
6
+ metadata.gz: fbfbf9a79feac0ebac06c36285d0d1ce12cea40fea58e1837397bc9a9e4abf8ff52bd85dd605c728286078670b74bd3618d7ef6445d15580274e0605e4551c64
7
+ data.tar.gz: 3f562c8b7faf2faafce4c38b4167d410c2b54fe0effc1bdd563d2a163cdcb2516ed7e4a5aed24a5f1becff89c1ae5701dca156581a0bf8a35f6ba313670c2ace
@@ -6,9 +6,42 @@ module Payline
6
6
  @response_handler = Payline::ResponseHandler.new
7
7
  end
8
8
 
9
+ def debit(guid, amount, credit_card)
10
+ proccess("CC.DB", guid, amount, credit_card)
11
+ end
12
+
9
13
  def reserve(guid, amount, credit_card)
14
+ proccess("CC.PA", guid, amount, credit_card)
15
+ end
16
+
17
+ def capture(reserve_response, amount)
10
18
  params = {
11
- 'PAYMENT.CODE' => "CC.PA",
19
+ 'PRESENTATION.CURRENCY' => @config.currency,
20
+ 'PAYMENT.CODE' => "CC.CP",
21
+ 'PRESENTATION.AMOUNT' => amount,
22
+ 'IDENTIFICATION.TRANSACTIONID'=>reserve_response.merchant_reference,
23
+ 'IDENTIFICATION.REFERENCEID'=> reserve_response.transaction_id
24
+ }
25
+ do_request(params)
26
+ end
27
+
28
+
29
+ def reverse(reserve_response, amount)
30
+ params = {
31
+ 'PRESENTATION.CURRENCY' => @config.currency,
32
+ 'PAYMENT.CODE' => "CC.RV",
33
+ 'PRESENTATION.AMOUNT' => amount,
34
+ 'IDENTIFICATION.TRANSACTIONID'=> reserve_response.merchant_reference,
35
+ 'IDENTIFICATION.REFERENCEID'=> reserve_response.transaction_id
36
+ }
37
+ do_request(params)
38
+ end
39
+
40
+ private
41
+
42
+ def proccess(code, guid, amount, credit_card)
43
+ params = {
44
+ 'PAYMENT.CODE' => code,
12
45
  'PRESENTATION.AMOUNT' => amount,
13
46
  'PRESENTATION.CURRENCY' => @config.currency,
14
47
 
@@ -37,30 +70,6 @@ module Payline
37
70
  Payline::ReserveResponse.new(merchant_id, ref_id)
38
71
  end
39
72
 
40
- def capture(reserve_response, amount)
41
- params = {
42
- 'PRESENTATION.CURRENCY' => @config.currency,
43
- 'PAYMENT.CODE' => "CC.CP",
44
- 'PRESENTATION.AMOUNT' => amount,
45
- 'IDENTIFICATION.TRANSACTIONID'=>reserve_response.merchant_reference,
46
- 'IDENTIFICATION.REFERENCEID'=> reserve_response.transaction_id
47
- }
48
- do_request(params)
49
- end
50
-
51
- def reverse(reserve_response, amount)
52
- params = {
53
- 'PRESENTATION.CURRENCY' => @config.currency,
54
- 'PAYMENT.CODE' => "CC.RV",
55
- 'PRESENTATION.AMOUNT' => amount,
56
- 'IDENTIFICATION.TRANSACTIONID'=> reserve_response.merchant_reference,
57
- 'IDENTIFICATION.REFERENCEID'=> reserve_response.transaction_id
58
- }
59
- do_request(params)
60
- end
61
-
62
- private
63
-
64
73
  def do_request(params)
65
74
  uri = URI(Payline::Urls::PAYMENT)
66
75
  http = Net::HTTP.new(uri.host, uri.port)
@@ -1,3 +1,3 @@
1
1
  module Payline
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rubin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-13 00:00:00.000000000 Z
11
+ date: 2015-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler