active_merchant_first_data 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/CHANGELOG.md +4 -0
- data/README.md +14 -4
- data/lib/active_merchant/billing/first_data_gateway.rb +17 -20
- data/lib/active_merchant/billing/first_data_response.rb +148 -0
- data/lib/active_merchant_first_data.rb +2 -0
- metadata +37 -36
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NTNiNmM3MzU2ZjEyZDIwYmFmM2FkZTE4NjU3NzdlZTIxNWU2MmEwOA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7c847bdc7d68f8782735ac29421f2ad5ded03607
|
4
|
+
data.tar.gz: 552bb14ccf65b5310ebaeed6909da816d532895e
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZWQwMWZjYWZkMTY4YzczZGFmMDc1OWZkOWIwYjE1MjYwOTEzZTEwZTQ5ZTY0
|
11
|
-
ZTgzZDZiZmQzMDIzYWFkZWY3YWUyM2U2ZTA1YzBmZThmNWVhMjM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YWY1Y2JlMDBiYmQ2NTg5OTBkZDFjZGVjYTg5MWM4M2ZlYTRmYmEzMjRjZmUy
|
14
|
-
ZDRjMDBjMGI4YjE2YmEzYWU5ZmZhNWZiZGRkZWY2N2MwMWVlMzhjYzRhNmE3
|
15
|
-
ZGU2ZmVhMjExNWYzNWZkNDE3MjcwYjRlZmRjNzg1Y2FjNmFlNTI=
|
6
|
+
metadata.gz: 0c22fc2e61afb361f82ea6f501931d77c07d7f0187fef26899ddacf7b22d2147145fe1a77a57b5d739bc842b727cacd130e5e4585a6488d08f04124f20f48f2b
|
7
|
+
data.tar.gz: aef5468d0f9087c2c6e74acb6c49e1aa7445af9ba4a86e148dc4f9de448450d0e46c4bd9a90d2055fb25d6f91bb58c8a9af091c7dbc294713e49f2a9761ca477
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -13,10 +13,20 @@ $ gem install active_merchant_first_data
|
|
13
13
|
|
14
14
|
```ruby
|
15
15
|
require "active_merchant_first_data"
|
16
|
-
|
17
|
-
|
18
|
-
:
|
16
|
+
|
17
|
+
gateway = ActiveMerchant::Billing::FirstDataGateway.new(
|
18
|
+
pem: "1234567_keystore.pem"
|
19
|
+
pem_password: "5x64jq8n234c"
|
19
20
|
)
|
21
|
+
|
22
|
+
# Authorize for 10 euros (1000 euro cents)
|
23
|
+
response = gateway.authorize(1000, client_ip_addr: '127.0.0.1')
|
24
|
+
|
25
|
+
# Use this url to enter credit card data
|
26
|
+
gateway.redirect_url(response.authorization)
|
27
|
+
|
28
|
+
# Capture the money
|
29
|
+
gateway.capture(1000, response.authorization, client_ip_addr: '127.0.0.1')
|
20
30
|
```
|
21
31
|
|
22
32
|
## First Data test environment setup
|
@@ -24,7 +34,7 @@ require "active_merchant_first_data"
|
|
24
34
|
1. Generate a new certificate
|
25
35
|
|
26
36
|
```bash
|
27
|
-
$ openssl req -newkey rsa:
|
37
|
+
$ openssl req -newkey rsa:2048 -keyout spec/certs/1234567_key.pem -out spec/certs/1234567_req.pem -subj "/C=lv/O=example.com/CN=1234567" -outform PEM
|
28
38
|
Enter PEM pass phrase: 81f174259v45
|
29
39
|
```
|
30
40
|
|
@@ -1,23 +1,7 @@
|
|
1
|
-
require "active_merchant"
|
2
|
-
|
3
1
|
module ActiveMerchant #:nodoc:
|
4
2
|
module Billing #:nodoc:
|
5
3
|
class FirstDataGateway < Gateway
|
6
|
-
|
7
|
-
|
8
|
-
self.test_redirect_url = 'https://secureshop-test.firstdata.lv/ecomm/ClientHandler'
|
9
|
-
self.live_redirect_url = 'https://secureshop.firstdata.lv/ecomm/ClientHandler'
|
10
|
-
|
11
|
-
self.test_url = 'https://secureshop-test.firstdata.lv:8443/ecomm/MerchantHandler'
|
12
|
-
self.live_url = 'https://secureshop.firstdata.lv:8443/ecomm/MerchantHandler'
|
13
|
-
|
14
|
-
self.homepage_url = 'http://www.firstdata.lv/'
|
15
|
-
self.display_name = 'First Data'
|
16
|
-
|
17
|
-
self.ssl_strict = false
|
18
|
-
self.default_currency = '978' # LVL (http://en.wikipedia.org/wiki/ISO_4217)
|
19
|
-
self.money_format = :cents
|
20
|
-
|
4
|
+
# http://en.wikipedia.org/wiki/ISO_4217
|
21
5
|
CURRENCY_CODES = {
|
22
6
|
'ADP' => '020', 'AED' => '784', 'AFA' => '004', 'ALL' => '008', 'AMD' => '051',
|
23
7
|
'ANG' => '532', 'AOA' => '973', 'ARS' => '032', 'AUD' => '036', 'AWG' => '533',
|
@@ -56,6 +40,21 @@ module ActiveMerchant #:nodoc:
|
|
56
40
|
'ZMK' => '894', 'ZWD' => '716'
|
57
41
|
}
|
58
42
|
|
43
|
+
class_attribute :test_url, :live_url, :test_redirect_url, :live_redirect_url, :pem_file, :pem_password
|
44
|
+
|
45
|
+
self.test_redirect_url = 'https://secureshop-test.firstdata.lv/ecomm/ClientHandler'
|
46
|
+
self.live_redirect_url = 'https://secureshop.firstdata.lv/ecomm/ClientHandler'
|
47
|
+
|
48
|
+
self.test_url = 'https://secureshop-test.firstdata.lv:8443/ecomm/MerchantHandler'
|
49
|
+
self.live_url = 'https://secureshop.firstdata.lv:8443/ecomm/MerchantHandler'
|
50
|
+
|
51
|
+
self.homepage_url = 'http://www.firstdata.lv/'
|
52
|
+
self.display_name = 'First Data'
|
53
|
+
|
54
|
+
self.ssl_strict = false
|
55
|
+
self.default_currency = CURRENCY_CODES['EUR']
|
56
|
+
self.money_format = :cents
|
57
|
+
|
59
58
|
class Error < StandardError
|
60
59
|
attr_reader :response
|
61
60
|
|
@@ -261,7 +260,6 @@ module ActiveMerchant #:nodoc:
|
|
261
260
|
:command => :p,
|
262
261
|
:amount => 0,
|
263
262
|
:currency => default_currency,
|
264
|
-
:msg_type => 'SMS',
|
265
263
|
:msg_type => 'AUTH',
|
266
264
|
:perspayee_gen => 1,
|
267
265
|
:perspayee_overwrite => 1
|
@@ -287,7 +285,6 @@ module ActiveMerchant #:nodoc:
|
|
287
285
|
end
|
288
286
|
|
289
287
|
private
|
290
|
-
|
291
288
|
def lookup_currency(params)
|
292
289
|
params[:currency] = CURRENCY_CODES[params[:currency]] || params[:currency]
|
293
290
|
end
|
@@ -307,7 +304,7 @@ module ActiveMerchant #:nodoc:
|
|
307
304
|
# FIXME: test cases 17 and 19 return unnecessary error even when result and result_code are present
|
308
305
|
# should be removed when this issue is fixed on gataway side
|
309
306
|
raise Error.new(response) if !response[:error].blank? && response[:result_code].blank?
|
310
|
-
response
|
307
|
+
ActiveMerchant::Billing::FirstDataResponse.new response
|
311
308
|
end
|
312
309
|
|
313
310
|
def post_data(params)
|
@@ -0,0 +1,148 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class FirstDataResponse < Response
|
4
|
+
RESPONSE_CODES = {
|
5
|
+
"000" => "Approved",
|
6
|
+
"001" => "Approved, honour with identification",
|
7
|
+
"002" => "Approved for partial amount",
|
8
|
+
"003" => "Approved for VIP",
|
9
|
+
"004" => "Approved, update track 3",
|
10
|
+
"005" => "Approved, account type specified by card issuer",
|
11
|
+
"006" => "Approved for partial amount, account type specified by card issuer",
|
12
|
+
"007" => "Approved, update ICC",
|
13
|
+
"100" => "Decline (general, no comments)",
|
14
|
+
"101" => "Decline, expired card",
|
15
|
+
"102" => "Decline, suspected fraud",
|
16
|
+
"103" => "Decline, card acceptor contact acquirer",
|
17
|
+
"104" => "Decline, restricted card",
|
18
|
+
"105" => "Decline, card acceptor call acquirer's security department",
|
19
|
+
"106" => "Decline, allowable PIN tries exceeded",
|
20
|
+
"107" => "Decline, refer to card issuer",
|
21
|
+
"108" => "Decline, refer to card issuer's special conditions",
|
22
|
+
"109" => "Decline, invalid merchant",
|
23
|
+
"110" => "Decline, invalid amount",
|
24
|
+
"111" => "Decline, invalid card number",
|
25
|
+
"112" => "Decline, PIN data required",
|
26
|
+
"113" => "Decline, unacceptable fee",
|
27
|
+
"114" => "Decline, no account of type requested",
|
28
|
+
"115" => "Decline, requested function not supported",
|
29
|
+
"116" => "Decline, not sufficient funds",
|
30
|
+
"117" => "Decline, incorrect PIN",
|
31
|
+
"118" => "Decline, no card record",
|
32
|
+
"119" => "Decline, transaction not permitted to cardholder",
|
33
|
+
"120" => "Decline, transaction not permitted to terminal",
|
34
|
+
"121" => "Decline, exceeds withdrawal amount limit",
|
35
|
+
"122" => "Decline, security violation",
|
36
|
+
"123" => "Decline, exceeds withdrawal frequency limit",
|
37
|
+
"124" => "Decline, violation of law",
|
38
|
+
"125" => "Decline, card not effective",
|
39
|
+
"126" => "Decline, invalid PIN block",
|
40
|
+
"127" => "Decline, PIN length error",
|
41
|
+
"128" => "Decline, PIN kay synch error",
|
42
|
+
"129" => "Decline, suspected counterfeit card",
|
43
|
+
"197" => "Declined, call AmEx",
|
44
|
+
"198" => "Declined, call Card Processing Centre",
|
45
|
+
"200" => "Pick-up (general, no comments)",
|
46
|
+
"201" => "Pick-up, expired card",
|
47
|
+
"202" => "Pick-up, suspected fraud",
|
48
|
+
"203" => "Pick-up, card acceptor contact card acquirer",
|
49
|
+
"204" => "Pick-up, restricted card",
|
50
|
+
"205" => "Pick-up, card acceptor call acquirer's security department",
|
51
|
+
"206" => "Pick-up, allowable PIN tries exceeded",
|
52
|
+
"207" => "Pick-up, special conditions",
|
53
|
+
"208" => "Pick-up, lost card",
|
54
|
+
"209" => "Pick-up, stolen card",
|
55
|
+
"210" => "Pick-up, suspected counterfeit card",
|
56
|
+
"300" => "Status message: file action successful",
|
57
|
+
"301" => "Status message: file action not supported by receiver",
|
58
|
+
"302" => "Status message: unable to locate record on file",
|
59
|
+
"303" => "Status message: duplicate record, old record replaced",
|
60
|
+
"304" => "Status message: file record field edit error",
|
61
|
+
"305" => "Status message: file locked out",
|
62
|
+
"306" => "Status message: file action not successful",
|
63
|
+
"307" => "Status message: file data format error",
|
64
|
+
"308" => "Status message: duplicate record, new record rejected",
|
65
|
+
"309" => "Status message: unknown file",
|
66
|
+
"400" => "Accepted (for reversal)",
|
67
|
+
"500" => "Status message: reconciled, in balance",
|
68
|
+
"501" => "Status message: reconciled, out of balance",
|
69
|
+
"502" => "Status message: amount not reconciled, totals provided",
|
70
|
+
"503" => "Status message: totals for reconciliation not available",
|
71
|
+
"504" => "Status message: not reconciled, totals provided",
|
72
|
+
"600" => "Accepted (for administrative info)",
|
73
|
+
"601" => "Status message: impossible to trace back original transaction",
|
74
|
+
"602" => "Status message: invalid transaction reference number",
|
75
|
+
"603" => "Status message: reference number/PAN incompatible",
|
76
|
+
"604" => "Status message: POS photograph is not available",
|
77
|
+
"605" => "Status message: requested item supplied",
|
78
|
+
"606" => "Status message: request cannot be fulfilled - required documentation is not available",
|
79
|
+
"700" => "Accepted (for fee collection)",
|
80
|
+
"800" => "Accepted (for network management)",
|
81
|
+
"900" => "Advice acknowledged, no financial liability accepted",
|
82
|
+
"901" => "Advice acknowledged, finansial liability accepted",
|
83
|
+
"902" => "Decline reason message: invalid transaction",
|
84
|
+
"903" => "Status message: re-enter transaction",
|
85
|
+
"904" => "Decline reason message: format error",
|
86
|
+
"905" => "Decline reason message: acqiurer not supported by switch",
|
87
|
+
"906" => "Decline reason message: cutover in process",
|
88
|
+
"907" => "Decline reason message: card issuer or switch inoperative",
|
89
|
+
"908" => "Decline reason message: transaction destination cannot be found for routing",
|
90
|
+
"909" => "Decline reason message: system malfunction",
|
91
|
+
"910" => "Decline reason message: card issuer signed off",
|
92
|
+
"911" => "Decline reason message: card issuer timed out",
|
93
|
+
"912" => "Decline reason message: card issuer unavailable",
|
94
|
+
"913" => "Decline reason message: duplicate transmission",
|
95
|
+
"914" => "Decline reason message: not able to trace back to original transaction",
|
96
|
+
"915" => "Decline reason message: reconciliation cutover or checkpoint error",
|
97
|
+
"916" => "Decline reason message: MAC incorrect",
|
98
|
+
"917" => "Decline reason message: MAC key sync error",
|
99
|
+
"918" => "Decline reason message: no communication keys available for use",
|
100
|
+
"919" => "Decline reason message: encryption key sync error",
|
101
|
+
"920" => "Decline reason message: security software/hardware error - try again",
|
102
|
+
"921" => "Decline reason message: security software/hardware error - no action",
|
103
|
+
"922" => "Decline reason message: message number out of sequence",
|
104
|
+
"923" => "Status message: request in progress",
|
105
|
+
"940" => "Decline, blocked by fraud filter",
|
106
|
+
"950" => "Decline reason message: violation of business arrangement"
|
107
|
+
}
|
108
|
+
|
109
|
+
attr_accessor :authorization, :error_code, :error_message, :success, :message
|
110
|
+
|
111
|
+
def initialize params, options={}
|
112
|
+
success = params[:result] == 'OK'
|
113
|
+
message = RESPONSE_CODES[params[:result_code]]
|
114
|
+
|
115
|
+
unless success
|
116
|
+
error_code = params[:result_code]
|
117
|
+
error_message = message
|
118
|
+
end
|
119
|
+
|
120
|
+
super success, message, params, options.merge(
|
121
|
+
authorization: params[:transaction_id]
|
122
|
+
)
|
123
|
+
end
|
124
|
+
|
125
|
+
def recurring?
|
126
|
+
recc_pmnt_id.present? && recc_pmnt_expiry.present?
|
127
|
+
end
|
128
|
+
|
129
|
+
[:recc_pmnt_expiry, :recc_pmnt_id, :result, :result_code, :transaction_id].each do |name|
|
130
|
+
define_method name do
|
131
|
+
params[name]
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def _3d_secure
|
136
|
+
params[:'3dsecure']
|
137
|
+
end
|
138
|
+
|
139
|
+
def result_message
|
140
|
+
message
|
141
|
+
end
|
142
|
+
|
143
|
+
def [](value)
|
144
|
+
params[value]
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
metadata
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_merchant_first_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgars Beigarts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
version_requirements: !ruby/object:Gem::Requirement
|
15
|
-
requirements:
|
16
|
-
- - ! '>='
|
17
|
-
- !ruby/object:Gem::Version
|
18
|
-
version: 1.15.0
|
19
14
|
name: activemerchant
|
20
|
-
type: :runtime
|
21
15
|
requirement: !ruby/object:Gem::Requirement
|
22
16
|
requirements:
|
23
|
-
- -
|
17
|
+
- - ">="
|
24
18
|
- !ruby/object:Gem::Version
|
25
19
|
version: 1.15.0
|
20
|
+
type: :runtime
|
26
21
|
prerelease: false
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
22
|
version_requirements: !ruby/object:Gem::Requirement
|
29
23
|
requirements:
|
30
|
-
- -
|
24
|
+
- - ">="
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: 1.15.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
33
28
|
name: rake
|
34
|
-
type: :development
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
|
-
- -
|
31
|
+
- - ">="
|
38
32
|
- !ruby/object:Gem::Version
|
39
33
|
version: '0'
|
34
|
+
type: :development
|
40
35
|
prerelease: false
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
|
-
- -
|
38
|
+
- - ">="
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
|
-
type: :development
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
44
|
requirements:
|
51
|
-
- - ~>
|
45
|
+
- - "~>"
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '2
|
47
|
+
version: '3.2'
|
48
|
+
type: :development
|
54
49
|
prerelease: false
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
51
|
requirements:
|
58
|
-
- - ~>
|
52
|
+
- - "~>"
|
59
53
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
54
|
+
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
61
56
|
name: vcr
|
62
|
-
type: :development
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
64
58
|
requirements:
|
65
|
-
- - ~>
|
59
|
+
- - "~>"
|
66
60
|
- !ruby/object:Gem::Version
|
67
61
|
version: '1.11'
|
62
|
+
type: :development
|
68
63
|
prerelease: false
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
64
|
version_requirements: !ruby/object:Gem::Requirement
|
71
65
|
requirements:
|
72
|
-
- - ~>
|
66
|
+
- - "~>"
|
73
67
|
- !ruby/object:Gem::Version
|
74
|
-
version: '1.
|
68
|
+
version: '1.11'
|
69
|
+
- !ruby/object:Gem::Dependency
|
75
70
|
name: fakeweb
|
76
|
-
type: :development
|
77
71
|
requirement: !ruby/object:Gem::Requirement
|
78
72
|
requirements:
|
79
|
-
- - ~>
|
73
|
+
- - "~>"
|
80
74
|
- !ruby/object:Gem::Version
|
81
75
|
version: '1.3'
|
76
|
+
type: :development
|
82
77
|
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
83
|
description: First Data Latvia gateway for Active Merchant
|
84
84
|
email:
|
85
85
|
- edgars.beigarts@makit.lv
|
@@ -87,11 +87,12 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- lib/active_merchant/billing/first_data_gateway.rb
|
91
|
-
- lib/active_merchant_first_data.rb
|
92
|
-
- README.md
|
93
90
|
- CHANGELOG.md
|
94
91
|
- LICENSE
|
92
|
+
- README.md
|
93
|
+
- lib/active_merchant/billing/first_data_gateway.rb
|
94
|
+
- lib/active_merchant/billing/first_data_response.rb
|
95
|
+
- lib/active_merchant_first_data.rb
|
95
96
|
homepage: https://github.com/ebeigarts/active_merchant_first_data
|
96
97
|
licenses: []
|
97
98
|
metadata: {}
|
@@ -101,17 +102,17 @@ require_paths:
|
|
101
102
|
- lib
|
102
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
103
104
|
requirements:
|
104
|
-
- -
|
105
|
+
- - ">="
|
105
106
|
- !ruby/object:Gem::Version
|
106
107
|
version: '0'
|
107
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
109
|
requirements:
|
109
|
-
- -
|
110
|
+
- - ">="
|
110
111
|
- !ruby/object:Gem::Version
|
111
112
|
version: '0'
|
112
113
|
requirements: []
|
113
114
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
115
|
+
rubygems_version: 2.4.5
|
115
116
|
signing_key:
|
116
117
|
specification_version: 4
|
117
118
|
summary: First Data Latvia gateway for Active Merchant
|