Class: ActiveMerchant::Billing::MicropaymentGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::MicropaymentGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/micropayment.rb
Constant Summary
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(amount, payment_method, options = {}) ⇒ Object
-
#capture(amount, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ MicropaymentGateway
constructor
A new instance of MicropaymentGateway.
-
#purchase(amount, payment_method, options = {}) ⇒ Object
-
#refund(amount, 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
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of MicropaymentGateway.
14
15
16
17
|
# File 'lib/active_merchant/billing/gateways/micropayment.rb', line 14
def initialize(options = {})
requires!(options, :access_key)
super
end
|
Instance Method Details
#authorize(amount, payment_method, options = {}) ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/active_merchant/billing/gateways/micropayment.rb', line 28
def authorize(amount, payment_method, options = {})
post = {}
add_invoice(post, amount, options)
add_payment_method(post, payment_method, options)
add_customer_data(post, options)
add_address(post, options)
commit('authorize', post)
end
|
#capture(amount, authorization, options = {}) ⇒ Object
37
38
39
40
41
42
|
# File 'lib/active_merchant/billing/gateways/micropayment.rb', line 37
def capture(amount, authorization, options = {})
post = {}
add_reference(post, authorization)
add_invoice(post, amount, options)
commit('capture', post)
end
|
#purchase(amount, payment_method, options = {}) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/active_merchant/billing/gateways/micropayment.rb', line 19
def purchase(amount, payment_method, options = {})
post = {}
add_invoice(post, amount, options)
add_payment_method(post, payment_method, options)
add_customer_data(post, options)
add_address(post, options)
commit('purchase', post)
end
|
#refund(amount, authorization, options = {}) ⇒ Object
50
51
52
53
54
55
|
# File 'lib/active_merchant/billing/gateways/micropayment.rb', line 50
def refund(amount, authorization, options = {})
post = {}
add_reference(post, authorization)
add_invoice(post, amount, options)
commit('refund', post)
end
|
#scrub(transcript) ⇒ Object
68
69
70
71
72
73
|
# File 'lib/active_merchant/billing/gateways/micropayment.rb', line 68
def scrub(transcript)
transcript.
gsub(%r((accessKey=)\w+), '\1[FILTERED]').
gsub(%r((number=)\d+), '\1[FILTERED]').
gsub(%r((cvc2=)\d+), '\1[FILTERED]')
end
|
#supports_scrubbing? ⇒ Boolean
64
65
66
|
# File 'lib/active_merchant/billing/gateways/micropayment.rb', line 64
def supports_scrubbing?
true
end
|
#verify(credit_card, options = {}) ⇒ Object
57
58
59
60
61
62
|
# File 'lib/active_merchant/billing/gateways/micropayment.rb', line 57
def verify(credit_card, options = {})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(250, credit_card, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
end
|
#void(authorization, options = {}) ⇒ Object
44
45
46
47
48
|
# File 'lib/active_merchant/billing/gateways/micropayment.rb', line 44
def void(authorization, options = {})
post = {}
add_reference(post, authorization)
commit('void', post)
end
|