Class: ActiveMerchant::Billing::CardprocessGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::CardprocessGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/cardprocess.rb
Constant Summary
collapse
- STANDARD_ERROR_CODE_MAPPING =
{}
Constants inherited
from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
#options
Instance Method Summary
collapse
-
#authorize(money, payment, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#credit(money, payment, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ CardprocessGateway
constructor
Creates a new CardProcess Gateway.
-
#purchase(money, payment, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#verify(credit_card, options = {}) ⇒ Object
-
#void(authorization, _options = {}) ⇒ Object
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?
#expdate, #format, #strftime_yyyymm
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Creates a new CardProcess Gateway
The gateway requires a valid login, password, and entity ID to be passed in the options
hash.
Options
-
:user_id
– The CardProcess user ID
-
:password
– The CardProcess password
-
:entity_id
– The CardProcess channel or entity ID for any transactions
29
30
31
32
33
34
35
|
# File 'lib/active_merchant/billing/gateways/cardprocess.rb', line 29
def initialize(options = {})
requires!(options, :user_id, :password, :entity_id)
super
@test_options = {}
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'lib/active_merchant/billing/gateways/cardprocess.rb', line 47
def authorize(money, payment, options = {})
post = {}
add_invoice(post, money, options)
add_payment(post, payment)
add_address(post, payment, options)
add_customer_data(post, options)
commit('PA', post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/active_merchant/billing/gateways/cardprocess.rb', line 57
def capture(money, authorization, options = {})
post = {
id: authorization
}
add_invoice(post, money, options)
commit('CP', post)
end
|
#credit(money, payment, options = {}) ⇒ Object
73
74
75
76
77
78
79
80
81
|
# File 'lib/active_merchant/billing/gateways/cardprocess.rb', line 73
def credit(money, payment, options = {})
post = {}
add_invoice(post, money, options)
add_payment(post, payment)
add_address(post, payment, options)
add_customer_data(post, options)
commit('CD', post)
end
|
#purchase(money, payment, options = {}) ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/active_merchant/billing/gateways/cardprocess.rb', line 37
def purchase(money, payment, options = {})
post = {}
add_invoice(post, money, options)
add_payment(post, payment)
add_address(post, payment, options)
add_customer_data(post, options)
commit('DB', post)
end
|
#refund(money, authorization, options = {}) ⇒ Object
65
66
67
68
69
70
71
|
# File 'lib/active_merchant/billing/gateways/cardprocess.rb', line 65
def refund(money, authorization, options = {})
post = {
id: authorization
}
add_invoice(post, money, options)
commit('RF', post)
end
|
#scrub(transcript) ⇒ Object
101
102
103
104
105
106
|
# File 'lib/active_merchant/billing/gateways/cardprocess.rb', line 101
def scrub(transcript)
transcript.
gsub(%r{(authentication\.[^=]+=)[^&]+}, '\1[FILTERED]').
gsub(%r{(card\.number=)\d+}, '\1[FILTERED]').
gsub(%r{(cvv=)\d{3,4}}, '\1[FILTERED]\2')
end
|
#supports_scrubbing? ⇒ Boolean
97
98
99
|
# File 'lib/active_merchant/billing/gateways/cardprocess.rb', line 97
def supports_scrubbing?
true
end
|
#verify(credit_card, options = {}) ⇒ Object
90
91
92
93
94
95
|
# File 'lib/active_merchant/billing/gateways/cardprocess.rb', line 90
def verify(credit_card, options = {})
MultiResponse.run do |r|
r.process { authorize(100, credit_card, options) }
r.process { void(r.authorization, options) }
end
end
|
#void(authorization, _options = {}) ⇒ Object
83
84
85
86
87
88
|
# File 'lib/active_merchant/billing/gateways/cardprocess.rb', line 83
def void(authorization, _options = {})
post = {
id: authorization
}
commit('RV', post)
end
|