Class: ActiveMerchant::Billing::NetbillingGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::NetbillingGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/netbilling.rb
Overview
To perform PCI Compliant Repeat Billing
Ensure that PCI Compliant Repeat Billing is enabled on your merchant account:
"Enable PCI Compliant Repeat Billing, Up-selling and Cross-selling" in Step 6 of the Credit Cards setup page
Instead of passing a credit_card to authorize or purchase, pass the transaction id (res.authorization)
of a past Netbilling transaction
To store billing information without performing an operation, use the ‘store’ method which invokes the tran_type ‘Q’ (Quasi) operation and returns a transaction id to use in future Repeat Billing operations
Constant Summary
collapse
- TRANSACTIONS =
{
:authorization => 'A',
:purchase => 'S',
:refund => 'R',
:credit => 'C',
:capture => 'D',
:void => 'U',
:quasi => 'Q'
}
- SUCCESS_CODES =
[ '1', 'T' ]
- SUCCESS_MESSAGE =
'The transaction was approved'
- FAILURE_MESSAGE =
'The transaction failed'
- TEST_LOGIN =
'104901072025'
Constants inherited
from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
#options
Instance Method Summary
collapse
-
#authorize(money, payment_source, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#credit(money, credit_card, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ NetbillingGateway
constructor
A new instance of NetbillingGateway.
-
#purchase(money, payment_source, options = {}) ⇒ Object
-
#refund(money, source, options = {}) ⇒ Object
-
#store(credit_card, options = {}) ⇒ Object
-
#test? ⇒ Boolean
-
#void(source, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_scrubbing?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of NetbillingGateway.
36
37
38
39
|
# File 'lib/active_merchant/billing/gateways/netbilling.rb', line 36
def initialize(options = {})
requires!(options, :login)
super
end
|
Instance Method Details
#authorize(money, payment_source, options = {}) ⇒ Object
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/active_merchant/billing/gateways/netbilling.rb', line 41
def authorize(money, payment_source, options = {})
post = {}
add_amount(post, money)
add_invoice(post, options)
add_payment_source(post, payment_source)
add_address(post, payment_source, options)
add_customer_data(post, options)
commit(:authorization, post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
63
64
65
66
67
|
# File 'lib/active_merchant/billing/gateways/netbilling.rb', line 63
def capture(money, authorization, options = {})
post = {}
add_reference(post, authorization)
commit(:capture, post)
end
|
#credit(money, credit_card, options = {}) ⇒ Object
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/active_merchant/billing/gateways/netbilling.rb', line 76
def credit(money, credit_card, options = {})
post = {}
add_amount(post, money)
add_invoice(post, options)
add_credit_card(post, credit_card)
add_address(post, credit_card, options)
add_customer_data(post, options)
commit(:credit, post)
end
|
#purchase(money, payment_source, options = {}) ⇒ Object
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/active_merchant/billing/gateways/netbilling.rb', line 52
def purchase(money, payment_source, options = {})
post = {}
add_amount(post, money)
add_invoice(post, options)
add_payment_source(post, payment_source)
add_address(post, payment_source, options)
add_customer_data(post, options)
commit(:purchase, post)
end
|
#refund(money, source, options = {}) ⇒ Object
69
70
71
72
73
74
|
# File 'lib/active_merchant/billing/gateways/netbilling.rb', line 69
def refund(money, source, options = {})
post = {}
add_amount(post, money)
add_reference(post, source)
commit(:refund, post)
end
|
#store(credit_card, options = {}) ⇒ Object
93
94
95
96
97
98
99
100
101
|
# File 'lib/active_merchant/billing/gateways/netbilling.rb', line 93
def store(credit_card, options = {})
post = {}
add_amount(post, 0)
add_payment_source(post, credit_card)
add_address(post, credit_card, options)
add_customer_data(post, options)
commit(:quasi, post)
end
|
#test? ⇒ Boolean
103
104
105
|
# File 'lib/active_merchant/billing/gateways/netbilling.rb', line 103
def test?
(@options[:login] == TEST_LOGIN || super)
end
|
#void(source, options = {}) ⇒ Object
87
88
89
90
91
|
# File 'lib/active_merchant/billing/gateways/netbilling.rb', line 87
def void(source, options = {})
post = {}
add_reference(post, source)
commit(:void, post)
end
|