activemerchant 1.14.0 → 1.15.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.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +18 -0
- data/CONTRIBUTORS +4 -0
- data/README.rdoc +1 -0
- data/lib/active_merchant.rb +1 -1
- data/lib/active_merchant/billing/credit_card.rb +53 -42
- data/lib/active_merchant/billing/gateway.rb +6 -6
- data/lib/active_merchant/billing/gateways/authorize_net.rb +4 -2
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -1
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +3 -3
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +1 -1
- data/lib/active_merchant/billing/gateways/bogus.rb +12 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +77 -16
- data/lib/active_merchant/billing/gateways/eway.rb +0 -4
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +1 -1
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +1 -1
- data/lib/active_merchant/billing/gateways/orbital.rb +1 -1
- data/lib/active_merchant/billing/gateways/pay_junction.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow.rb +22 -8
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +10 -10
- data/lib/active_merchant/billing/gateways/payflow_express.rb +115 -36
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/qbms.rb +1 -1
- data/lib/active_merchant/billing/gateways/realex.rb +7 -20
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +5 -5
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -1
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +18 -10
- data/lib/active_merchant/billing/integrations/directebanking.rb +47 -0
- data/lib/active_merchant/billing/integrations/directebanking/helper.rb +90 -0
- data/lib/active_merchant/billing/integrations/directebanking/notification.rb +120 -0
- data/lib/active_merchant/billing/integrations/directebanking/return.rb +11 -0
- data/lib/active_merchant/billing/integrations/helper.rb +4 -4
- data/lib/active_merchant/billing/integrations/notification.rb +1 -1
- data/lib/active_merchant/common/post_data.rb +1 -1
- data/lib/active_merchant/common/posts_data.rb +1 -1
- data/lib/active_merchant/common/validateable.rb +20 -15
- data/lib/active_merchant/version.rb +1 -1
- metadata +20 -21
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
= ActiveMerchant CHANGELOG
|
2
2
|
|
3
|
+
== Version 1.15.0 (May 12, 2011)
|
4
|
+
* DirecPay: Fix address to not include address2 twice in some cases [Soleone]
|
5
|
+
* DirecPay: Send company if available [Soleone]
|
6
|
+
* Realex: Fix hash signature [ntalbott/Soleone]
|
7
|
+
* SecurePay AU: Update remote tests [ntalbott]
|
8
|
+
* SecurePay AU: Fix method arity for #capture, #refund, #credit and #void [Soleone]
|
9
|
+
* Barclays ePDQ: Make response parsing more robust [Soleone]
|
10
|
+
* Payflow Express: Add line item support [wolframarnold]
|
11
|
+
* Payflow Express: Add comment field support [wolframarnold]
|
12
|
+
* Payflow: Add more optional fields [wolframarnold]
|
13
|
+
* Beanstream/Paypal: Fix CREDIT_DEPRECATION_MESSAGE errors [Jonathan Rudenberg]
|
14
|
+
* BraintreeBlue: Return a hash instead of a transaction object [braintreeps]
|
15
|
+
* BraintreeBlue: Return proper AVS/CVV values [braintreeps]
|
16
|
+
* Bogus: Add #recurring [trwomey]
|
17
|
+
* Make Validateable compatible with ActiveModel [CodeMonkeySteve]
|
18
|
+
* Add DirectEBanking offsite gateway [Gerwin Brunner/Soleone]
|
19
|
+
* ActiveSupport 3.1 beta support [cgriego]
|
20
|
+
|
3
21
|
== Version 1.14.0 (Apr 29, 2011)
|
4
22
|
|
5
23
|
* SagePayForm: Implement #cancelled? for Return. [wisq]
|
data/CONTRIBUTORS
CHANGED
data/README.rdoc
CHANGED
@@ -83,6 +83,7 @@ The {ActiveMerchant Wiki}[http://github.com/Shopify/active_merchant/wikis] conta
|
|
83
83
|
* {2 Checkout}[http://www.2checkout.com]
|
84
84
|
* {Banca Sella GestPay}[https://www.sella.it/banca/ecommerce/gestpay/gestpay.jsp]
|
85
85
|
* {Chronopay}[http://www.chronopay.com]
|
86
|
+
* {Direct-eBanking / sofortueberweisung.de by Payment-Networks AG}[https://www.payment-network.com/deb_com_en/merchantarea/home] - DE, AT, CH, BE, UK, NL
|
86
87
|
* {DirecPay}[http://www.timesofmoney.com/direcpay/jsp/home.jsp]
|
87
88
|
* {HiTRUST}[http://www.hitrust.com.hk/]
|
88
89
|
* {Moneybookers}[http://www.moneybookers.com]
|
data/lib/active_merchant.rb
CHANGED
@@ -27,7 +27,7 @@ require 'active_support'
|
|
27
27
|
require 'active_support/core_ext/string/inflections'
|
28
28
|
require 'active_support/core_ext/hash/indifferent_access'
|
29
29
|
require 'active_support/core_ext/hash/conversions'
|
30
|
-
require 'active_support/core_ext/class/
|
30
|
+
require 'active_support/core_ext/class/attribute'
|
31
31
|
require 'active_support/core_ext/class/attribute_accessors'
|
32
32
|
require 'active_support/core_ext/class/delegating_attributes'
|
33
33
|
require 'active_support/core_ext/module/attribute_accessors'
|
@@ -7,49 +7,49 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
# == Description
|
8
8
|
# This credit card object can be used as a stand alone object. It acts just like an ActiveRecord object
|
9
9
|
# but doesn't support the .save method as its not backed by a database.
|
10
|
-
#
|
11
|
-
# For testing purposes, use the 'bogus' credit card type. This card skips the vast majority of
|
12
|
-
# validations. This allows you to focus on your core concerns until you're ready to be more concerned
|
10
|
+
#
|
11
|
+
# For testing purposes, use the 'bogus' credit card type. This card skips the vast majority of
|
12
|
+
# validations. This allows you to focus on your core concerns until you're ready to be more concerned
|
13
13
|
# with the details of particular creditcards or your gateway.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# == Testing With CreditCard
|
16
|
-
# Often when testing we don't care about the particulars of a given card type. When using the 'test'
|
17
|
-
# mode in your Gateway, there are six different valid card numbers: 1, 2, 3, 'success', 'fail',
|
16
|
+
# Often when testing we don't care about the particulars of a given card type. When using the 'test'
|
17
|
+
# mode in your Gateway, there are six different valid card numbers: 1, 2, 3, 'success', 'fail',
|
18
18
|
# and 'error'.
|
19
|
-
#
|
19
|
+
#
|
20
20
|
#--
|
21
21
|
# For details, see CreditCardMethods#valid_number?
|
22
22
|
#++
|
23
|
-
#
|
23
|
+
#
|
24
24
|
# == Example Usage
|
25
25
|
# cc = CreditCard.new(
|
26
|
-
# :first_name => 'Steve',
|
27
|
-
# :last_name => 'Smith',
|
28
|
-
# :month => '9',
|
29
|
-
# :year => '2010',
|
30
|
-
# :type => 'visa',
|
26
|
+
# :first_name => 'Steve',
|
27
|
+
# :last_name => 'Smith',
|
28
|
+
# :month => '9',
|
29
|
+
# :year => '2010',
|
30
|
+
# :type => 'visa',
|
31
31
|
# :number => '4242424242424242'
|
32
32
|
# )
|
33
|
-
#
|
33
|
+
#
|
34
34
|
# cc.valid? # => true
|
35
35
|
# cc.display_number # => XXXX-XXXX-XXXX-4242
|
36
36
|
#
|
37
37
|
class CreditCard
|
38
38
|
include CreditCardMethods
|
39
39
|
include Validateable
|
40
|
-
|
40
|
+
|
41
41
|
## Attributes
|
42
|
-
|
42
|
+
|
43
43
|
cattr_accessor :require_verification_value
|
44
44
|
self.require_verification_value = true
|
45
|
-
|
45
|
+
|
46
46
|
# Essential attributes for a valid, non-bogus creditcards
|
47
47
|
attr_accessor :number, :month, :year, :type, :first_name, :last_name
|
48
|
-
|
48
|
+
|
49
49
|
# Required for Switch / Solo cards
|
50
50
|
attr_accessor :start_month, :start_year, :issue_number
|
51
51
|
|
52
|
-
# Optional verification_value (CVV, CVV2 etc). Gateways will try their best to
|
52
|
+
# Optional verification_value (CVV, CVV2 etc). Gateways will try their best to
|
53
53
|
# run validation on the passed in value if it is supplied
|
54
54
|
attr_accessor :verification_value
|
55
55
|
|
@@ -63,23 +63,23 @@ module ActiveMerchant #:nodoc:
|
|
63
63
|
def expired?
|
64
64
|
expiry_date.expired?
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
def name?
|
68
68
|
first_name? || last_name?
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
def first_name?
|
72
72
|
@first_name.present?
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
def last_name?
|
76
76
|
@last_name.present?
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
def name
|
80
80
|
[@first_name, @last_name].compact.join(' ')
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
def verification_value?
|
84
84
|
!@verification_value.blank?
|
85
85
|
end
|
@@ -88,11 +88,11 @@ module ActiveMerchant #:nodoc:
|
|
88
88
|
def display_number
|
89
89
|
self.class.mask(number)
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
def last_digits
|
93
93
|
self.class.last_digits(number)
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
def validate
|
97
97
|
validate_essential_attributes
|
98
98
|
|
@@ -104,14 +104,14 @@ module ActiveMerchant #:nodoc:
|
|
104
104
|
validate_verification_value
|
105
105
|
validate_switch_or_solo_attributes
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
def self.requires_verification_value?
|
109
109
|
require_verification_value
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
private
|
113
|
-
|
114
|
-
def before_validate #:nodoc:
|
113
|
+
|
114
|
+
def before_validate #:nodoc:
|
115
115
|
self.month = month.to_i
|
116
116
|
self.year = year.to_i
|
117
117
|
self.start_month = start_month.to_i unless start_month.nil?
|
@@ -120,27 +120,38 @@ module ActiveMerchant #:nodoc:
|
|
120
120
|
self.type.downcase! if type.respond_to?(:downcase)
|
121
121
|
self.type = self.class.type?(number) if type.blank?
|
122
122
|
end
|
123
|
-
|
123
|
+
|
124
124
|
def validate_card_number #:nodoc:
|
125
|
-
|
125
|
+
if number.blank?
|
126
|
+
errors.add :number, "is required"
|
127
|
+
elsif !CreditCard.valid_number?(number)
|
128
|
+
errors.add :number, "is not a valid credit card number"
|
129
|
+
end
|
130
|
+
|
126
131
|
unless errors.on(:number) || errors.on(:type)
|
127
132
|
errors.add :type, "is not the correct card type" unless CreditCard.matching_type?(number, type)
|
128
133
|
end
|
129
134
|
end
|
130
|
-
|
135
|
+
|
131
136
|
def validate_card_type #:nodoc:
|
132
|
-
errors.add :type, "is required" if type.blank?
|
133
|
-
errors.add :type, "is invalid" unless CreditCard.card_companies.keys.include?(type)
|
137
|
+
errors.add :type, "is required" if type.blank? && number.present?
|
138
|
+
errors.add :type, "is invalid" unless type.blank? || CreditCard.card_companies.keys.include?(type)
|
134
139
|
end
|
135
|
-
|
140
|
+
|
136
141
|
def validate_essential_attributes #:nodoc:
|
137
142
|
errors.add :first_name, "cannot be empty" if @first_name.blank?
|
138
143
|
errors.add :last_name, "cannot be empty" if @last_name.blank?
|
139
|
-
|
140
|
-
|
141
|
-
|
144
|
+
|
145
|
+
if @month.to_i.zero? || @year.to_i.zero?
|
146
|
+
errors.add :month, "is required" if @month.to_i.zero?
|
147
|
+
errors.add :year, "is required" if @year.to_i.zero?
|
148
|
+
else
|
149
|
+
errors.add :month, "is not a valid month" unless valid_month?(@month)
|
150
|
+
errors.add :year, "expired" if expired?
|
151
|
+
errors.add :year, "is not a valid year" unless valid_expiry_year?(@year)
|
152
|
+
end
|
142
153
|
end
|
143
|
-
|
154
|
+
|
144
155
|
def validate_switch_or_solo_attributes #:nodoc:
|
145
156
|
if %w[switch solo].include?(type)
|
146
157
|
unless valid_month?(@start_month) && valid_start_year?(@start_year) || valid_issue_number?(@issue_number)
|
@@ -150,10 +161,10 @@ module ActiveMerchant #:nodoc:
|
|
150
161
|
end
|
151
162
|
end
|
152
163
|
end
|
153
|
-
|
164
|
+
|
154
165
|
def validate_verification_value #:nodoc:
|
155
166
|
if CreditCard.requires_verification_value?
|
156
|
-
errors.add :verification_value, "is required" unless verification_value?
|
167
|
+
errors.add :verification_value, "is required" unless verification_value?
|
157
168
|
end
|
158
169
|
end
|
159
170
|
end
|
@@ -76,22 +76,22 @@ module ActiveMerchant #:nodoc:
|
|
76
76
|
# The format of the amounts used by the gateway
|
77
77
|
# :dollars => '12.50'
|
78
78
|
# :cents => '1250'
|
79
|
-
|
79
|
+
class_attribute :money_format
|
80
80
|
self.money_format = :dollars
|
81
81
|
|
82
82
|
# The default currency for the transactions if no currency is provided
|
83
|
-
|
83
|
+
class_attribute :default_currency
|
84
84
|
|
85
85
|
# The countries of merchants the gateway supports
|
86
|
-
|
86
|
+
class_attribute :supported_countries
|
87
87
|
self.supported_countries = []
|
88
88
|
|
89
89
|
# The supported card types for the gateway
|
90
|
-
|
90
|
+
class_attribute :supported_cardtypes
|
91
91
|
self.supported_cardtypes = []
|
92
92
|
|
93
|
-
|
94
|
-
|
93
|
+
class_attribute :homepage_url
|
94
|
+
class_attribute :display_name
|
95
95
|
|
96
96
|
# The application making the calls to the gateway
|
97
97
|
# Useful for things like the PayPal build notation (BN) id fields
|
@@ -26,7 +26,7 @@ module ActiveMerchant #:nodoc:
|
|
26
26
|
class AuthorizeNetGateway < Gateway
|
27
27
|
API_VERSION = '3.1'
|
28
28
|
|
29
|
-
|
29
|
+
class_attribute :test_url, :live_url, :arb_test_url, :arb_live_url
|
30
30
|
|
31
31
|
self.test_url = "https://test.authorize.net/gateway/transact.dll"
|
32
32
|
self.live_url = "https://secure.authorize.net/gateway/transact.dll"
|
@@ -34,7 +34,7 @@ module ActiveMerchant #:nodoc:
|
|
34
34
|
self.arb_test_url = 'https://apitest.authorize.net/xml/v1/request.api'
|
35
35
|
self.arb_live_url = 'https://api.authorize.net/xml/v1/request.api'
|
36
36
|
|
37
|
-
|
37
|
+
class_attribute :duplicate_window
|
38
38
|
|
39
39
|
APPROVED, DECLINED, ERROR, FRAUD_REVIEW = 1, 2, 3, 4
|
40
40
|
|
@@ -131,6 +131,7 @@ module ActiveMerchant #:nodoc:
|
|
131
131
|
# * <tt>authorization</tt> - The authorization returned from the previous authorize request.
|
132
132
|
def void(authorization, options = {})
|
133
133
|
post = {:trans_id => authorization}
|
134
|
+
add_duplicate_window(post)
|
134
135
|
commit('VOID', nil, post)
|
135
136
|
end
|
136
137
|
|
@@ -155,6 +156,7 @@ module ActiveMerchant #:nodoc:
|
|
155
156
|
:card_num => options[:card_number]
|
156
157
|
}
|
157
158
|
add_invoice(post, options)
|
159
|
+
add_duplicate_window(post)
|
158
160
|
|
159
161
|
commit('CREDIT', money, post)
|
160
162
|
end
|
@@ -27,7 +27,7 @@ module ActiveMerchant #:nodoc:
|
|
27
27
|
# 5. Click Submit
|
28
28
|
class AuthorizeNetCimGateway < Gateway
|
29
29
|
|
30
|
-
|
30
|
+
class_attribute :test_url, :live_url
|
31
31
|
|
32
32
|
self.test_url = 'https://apitest.authorize.net/xml/v1/request.api'
|
33
33
|
self.live_url = 'https://api.authorize.net/xml/v1/request.api'
|
@@ -136,15 +136,15 @@ module ActiveMerchant #:nodoc:
|
|
136
136
|
|
137
137
|
def parse
|
138
138
|
doc = REXML::Document.new(@response)
|
139
|
-
auth_type = find(doc, "//Transaction/Type").
|
139
|
+
auth_type = find(doc, "//Transaction/Type").to_s
|
140
140
|
|
141
141
|
message = find(doc, "//Message/Text")
|
142
142
|
if message.blank?
|
143
143
|
message = find(doc, "//Transaction/CardProcResp/CcReturnMsg")
|
144
144
|
end
|
145
145
|
|
146
|
-
case auth_type
|
147
|
-
when
|
146
|
+
case auth_type
|
147
|
+
when 'Credit', 'Void'
|
148
148
|
success = find(doc, "//CcReturnMsg") == "Approved."
|
149
149
|
else
|
150
150
|
success = find(doc, "//Transaction/AuthCode").present?
|
@@ -42,6 +42,18 @@ module ActiveMerchant #:nodoc:
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
def recurring(money, creditcard, options = {})
|
46
|
+
money = amount(money)
|
47
|
+
case creditcard.number
|
48
|
+
when '1'
|
49
|
+
Response.new(true, SUCCESS_MESSAGE, {:paid_amount => money}, :test => true)
|
50
|
+
when '2'
|
51
|
+
Response.new(false, FAILURE_MESSAGE, {:paid_amount => money, :error => FAILURE_MESSAGE },:test => true)
|
52
|
+
else
|
53
|
+
raise Error, ERROR_MESSAGE
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
45
57
|
def credit(money, creditcard, options = {})
|
46
58
|
if creditcard.is_a?(String)
|
47
59
|
deprecated CREDIT_DEPRECATION_MESSAGE
|
@@ -12,7 +12,7 @@ module ActiveMerchant #:nodoc:
|
|
12
12
|
module Billing #:nodoc:
|
13
13
|
class BraintreeBlueGateway < Gateway
|
14
14
|
include BraintreeCommon
|
15
|
-
|
15
|
+
|
16
16
|
self.display_name = 'Braintree (Blue Platform)'
|
17
17
|
|
18
18
|
def initialize(options = {})
|
@@ -55,7 +55,7 @@ module ActiveMerchant #:nodoc:
|
|
55
55
|
commit do
|
56
56
|
result = Braintree::Transaction.refund(transaction_id, money)
|
57
57
|
Response.new(result.success?, message_from_result(result),
|
58
|
-
{:braintree_transaction => (result.transaction if result.success?)},
|
58
|
+
{:braintree_transaction => (transaction_hash(result.transaction) if result.success?)},
|
59
59
|
{:authorization => (result.transaction.id if result.success?)}
|
60
60
|
)
|
61
61
|
end
|
@@ -65,7 +65,7 @@ module ActiveMerchant #:nodoc:
|
|
65
65
|
commit do
|
66
66
|
result = Braintree::Transaction.void(authorization)
|
67
67
|
Response.new(result.success?, message_from_result(result),
|
68
|
-
{:braintree_transaction => (result.transaction if result.success?)},
|
68
|
+
{:braintree_transaction => (transaction_hash(result.transaction) if result.success?)},
|
69
69
|
{:authorization => (result.transaction.id if result.success?)}
|
70
70
|
)
|
71
71
|
end
|
@@ -86,7 +86,7 @@ module ActiveMerchant #:nodoc:
|
|
86
86
|
)
|
87
87
|
Response.new(result.success?, message_from_result(result),
|
88
88
|
{
|
89
|
-
:braintree_customer => (result.customer if result.success?),
|
89
|
+
:braintree_customer => (customer_hash(result.customer) if result.success?),
|
90
90
|
:customer_vault_id => (result.customer.id if result.success?)
|
91
91
|
}
|
92
92
|
)
|
@@ -104,7 +104,7 @@ module ActiveMerchant #:nodoc:
|
|
104
104
|
:email => options[:email]
|
105
105
|
)
|
106
106
|
Response.new(result.success?, message_from_result(result),
|
107
|
-
:braintree_customer => (Braintree::Customer.find(vault_id) if result.success?)
|
107
|
+
:braintree_customer => (customer_hash(Braintree::Customer.find(vault_id)) if result.success?)
|
108
108
|
)
|
109
109
|
end
|
110
110
|
return customer_update_result unless customer_update_result.success?
|
@@ -115,7 +115,7 @@ module ActiveMerchant #:nodoc:
|
|
115
115
|
:expiration_year => creditcard.year.to_s
|
116
116
|
)
|
117
117
|
Response.new(result.success?, message_from_result(result),
|
118
|
-
:braintree_customer => (Braintree::Customer.find(vault_id) if result.success?)
|
118
|
+
:braintree_customer => (customer_hash(Braintree::Customer.find(vault_id)) if result.success?)
|
119
119
|
)
|
120
120
|
end
|
121
121
|
end
|
@@ -190,26 +190,23 @@ module ActiveMerchant #:nodoc:
|
|
190
190
|
result = Braintree::Transaction.send(transaction_type, parameters)
|
191
191
|
response_params, response_options, avs_result, cvv_result = {}, {}, {}, {}
|
192
192
|
if result.success?
|
193
|
-
response_params[:braintree_transaction] = result.transaction
|
193
|
+
response_params[:braintree_transaction] = transaction_hash(result.transaction)
|
194
194
|
response_params[:customer_vault_id] = result.transaction.customer_details.id
|
195
195
|
response_options[:authorization] = result.transaction.id
|
196
196
|
end
|
197
197
|
if result.transaction
|
198
|
-
avs_result = {
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
}
|
203
|
-
cvv_result = {
|
204
|
-
'code' => result.transaction.cvv_response_code, 'message' => ''
|
198
|
+
response_options[:avs_result] = {
|
199
|
+
:code => nil, :message => nil,
|
200
|
+
:street_match => result.transaction.avs_street_address_response_code,
|
201
|
+
:postal_match => result.transaction.avs_postal_code_response_code
|
205
202
|
}
|
203
|
+
response_options[:cvv_result] = result.transaction.cvv_response_code
|
206
204
|
message = result.transaction.processor_response_code + " " + result.transaction.processor_response_text
|
207
205
|
else
|
208
206
|
message = message_from_result(result)
|
209
207
|
end
|
210
208
|
response = Response.new(result.success?, message, response_params, response_options)
|
211
|
-
response.
|
212
|
-
response.instance_variable_set("@cvv_result", cvv_result)
|
209
|
+
response.cvv_result['message'] = ''
|
213
210
|
response
|
214
211
|
end
|
215
212
|
end
|
@@ -226,6 +223,70 @@ module ActiveMerchant #:nodoc:
|
|
226
223
|
raise ArgumentError, "wrong number of arguments (#{args.length} for 2)"
|
227
224
|
end
|
228
225
|
end
|
226
|
+
|
227
|
+
def customer_hash(customer)
|
228
|
+
credit_cards = customer.credit_cards.map do |cc|
|
229
|
+
{
|
230
|
+
"bin" => cc.bin,
|
231
|
+
"expiration_date" => cc.expiration_date
|
232
|
+
}
|
233
|
+
end
|
234
|
+
|
235
|
+
{
|
236
|
+
"email" => customer.email,
|
237
|
+
"first_name" => customer.first_name,
|
238
|
+
"last_name" => customer.last_name,
|
239
|
+
"credit_cards" => credit_cards
|
240
|
+
}
|
241
|
+
end
|
242
|
+
|
243
|
+
def transaction_hash(transaction)
|
244
|
+
if transaction.vault_customer
|
245
|
+
vault_customer = {
|
246
|
+
}
|
247
|
+
vault_customer["credit_cards"] = transaction.vault_customer.credit_cards.map do |cc|
|
248
|
+
{
|
249
|
+
"bin" => cc.bin
|
250
|
+
}
|
251
|
+
end
|
252
|
+
else
|
253
|
+
vault_customer = nil
|
254
|
+
end
|
255
|
+
|
256
|
+
customer_details = {
|
257
|
+
"id" => transaction.customer_details.id,
|
258
|
+
"email" => transaction.customer_details.email
|
259
|
+
}
|
260
|
+
|
261
|
+
billing_details = {
|
262
|
+
"street_address" => transaction.billing_details.street_address,
|
263
|
+
"extended_address" => transaction.billing_details.extended_address,
|
264
|
+
"company" => transaction.billing_details.company,
|
265
|
+
"locality" => transaction.billing_details.locality,
|
266
|
+
"region" => transaction.billing_details.region,
|
267
|
+
"postal_code" => transaction.billing_details.postal_code,
|
268
|
+
"country_name" => transaction.billing_details.country_name,
|
269
|
+
}
|
270
|
+
|
271
|
+
shipping_details = {
|
272
|
+
"street_address" => transaction.shipping_details.street_address,
|
273
|
+
"extended_address" => transaction.shipping_details.extended_address,
|
274
|
+
"company" => transaction.shipping_details.company,
|
275
|
+
"locality" => transaction.shipping_details.locality,
|
276
|
+
"region" => transaction.shipping_details.region,
|
277
|
+
"postal_code" => transaction.shipping_details.postal_code,
|
278
|
+
"country_name" => transaction.shipping_details.country_name,
|
279
|
+
}
|
280
|
+
|
281
|
+
{
|
282
|
+
"order_id" => transaction.order_id,
|
283
|
+
"status" => transaction.status,
|
284
|
+
"customer_details" => customer_details,
|
285
|
+
"billing_details" => billing_details,
|
286
|
+
"shipping_details" => shipping_details,
|
287
|
+
"vault_customer" => vault_customer
|
288
|
+
}
|
289
|
+
end
|
229
290
|
end
|
230
291
|
end
|
231
292
|
end
|