Class: ActiveMerchant::Billing::PaystationGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/paystation.rb

Constant Summary collapse

SUCCESSFUL_RESPONSE_CODE =

an “error code” of “0” means “No error - transaction successful”

'0'
SUCCESSFUL_FUTURE_PAYMENT =

an “error code” of “34” means “Future Payment Stored OK”

'34'

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

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?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ PaystationGateway

Returns a new instance of PaystationGateway.


24
25
26
27
# File 'lib/active_merchant/billing/gateways/paystation.rb', line 24

def initialize(options = {})
  requires!(options, :paystation_id, :gateway_id)
  super
end

Instance Method Details

#authorize(money, credit_card, options = {}) ⇒ Object


29
30
31
32
33
34
35
36
37
38
# File 'lib/active_merchant/billing/gateways/paystation.rb', line 29

def authorize(money, credit_card, options = {})
  post = new_request

  add_invoice(post, options)
  add_amount(post, money, options)
  add_credit_card(post, credit_card)
  add_authorize_flag(post, options)

  commit(post)
end

#capture(money, authorization_token, options = {}) ⇒ Object


40
41
42
43
44
45
46
47
48
# File 'lib/active_merchant/billing/gateways/paystation.rb', line 40

def capture(money, authorization_token, options = {})
  post = new_request

  add_invoice(post, options)
  add_amount(post, money, options)
  add_authorization_token(post, authorization_token, options[:credit_card_verification])

  commit(post)
end

#purchase(money, payment_source, options = {}) ⇒ Object


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/active_merchant/billing/gateways/paystation.rb', line 50

def purchase(money, payment_source, options = {})
  post = new_request

  add_invoice(post, options)
  add_amount(post, money, options)

  if payment_source.is_a?(String)
    add_token(post, payment_source)
  else
    add_credit_card(post, payment_source)
  end

  add_customer_data(post, options) if options.has_key?(:customer)

  commit(post)
end

#refund(money, authorization, options = {}) ⇒ Object


77
78
79
80
81
82
83
84
# File 'lib/active_merchant/billing/gateways/paystation.rb', line 77

def refund(money, authorization, options = {})
  post = new_request
  add_amount(post, money, options)
  add_invoice(post, options)
  add_refund_specific_fields(post, authorization)

  commit(post)
end

#scrub(transcript) ⇒ Object


94
95
96
97
98
# File 'lib/active_merchant/billing/gateways/paystation.rb', line 94

def scrub(transcript)
  transcript.
    gsub(%r((pstn_cn=)\d*), '\1[FILTERED]').
    gsub(%r((pstn_cc=)\d*), '\1[FILTERED]')
end

#store(credit_card, options = {}) ⇒ Object


67
68
69
70
71
72
73
74
75
# File 'lib/active_merchant/billing/gateways/paystation.rb', line 67

def store(credit_card, options = {})
  post = new_request

  add_invoice(post, options)
  add_credit_card(post, credit_card)
  store_credit_card(post, options)

  commit(post)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)

90
91
92
# File 'lib/active_merchant/billing/gateways/paystation.rb', line 90

def supports_scrubbing?
  true
end

#verify(credit_card, options = {}) ⇒ Object


86
87
88
# File 'lib/active_merchant/billing/gateways/paystation.rb', line 86

def verify(credit_card, options = {})
  authorize(0, credit_card, options)
end