Class: ActiveMerchant::Billing::BpointGateway

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

Defined Under Namespace

Classes: AddTokenResponse, BPointResponse, ProcessPaymentResponse

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

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 = {}) ⇒ BpointGateway

Returns a new instance of BpointGateway.



15
16
17
18
# File 'lib/active_merchant/billing/gateways/bpoint.rb', line 15

def initialize(options = {})
  requires!(options, :username, :password, :merchant_number)
  super
end

Instance Method Details

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



37
38
39
40
41
42
43
44
# File 'lib/active_merchant/billing/gateways/bpoint.rb', line 37

def authorize(amount, credit_card, options = {})
  request_body = soap_request do |xml|
    process_payment(xml) do |payment_xml|
      add_authorize(payment_xml, amount, credit_card, options)
    end
  end
  commit(request_body)
end

#capture(amount, authorization, options = {}) ⇒ Object



46
47
48
49
50
51
52
53
# File 'lib/active_merchant/billing/gateways/bpoint.rb', line 46

def capture(amount, authorization, options = {})
  request_body = soap_request do |xml|
    process_payment(xml) do |payment_xml|
      add_capture(payment_xml, amount, authorization, options)
    end
  end
  commit(request_body)
end

#purchase(amount, credit_card, options = {}) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/active_merchant/billing/gateways/bpoint.rb', line 28

def purchase(amount, credit_card, options = {})
  request_body = soap_request do |xml|
    process_payment(xml) do |payment_xml|
      add_purchase(payment_xml, amount, credit_card, options)
    end
  end
  commit(request_body)
end

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



55
56
57
58
59
60
61
62
# File 'lib/active_merchant/billing/gateways/bpoint.rb', line 55

def refund(amount, authorization, options = {})
  request_body = soap_request do |xml|
    process_payment(xml) do |payment_xml|
      add_refund(payment_xml, amount, authorization, options)
    end
  end
  commit(request_body)
end

#scrub(transcript) ⇒ Object



84
85
86
87
88
89
# File 'lib/active_merchant/billing/gateways/bpoint.rb', line 84

def scrub(transcript)
  transcript.
    gsub(%r((<password>).+(</password>)), '\1[FILTERED]\2').
    gsub(%r((<CardNumber>).+(</CardNumber>)), '\1[FILTERED]\2').
    gsub(%r((<CVC>).+(</CVC>)), '\1[FILTERED]\2')
end

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



20
21
22
23
24
25
26
# File 'lib/active_merchant/billing/gateways/bpoint.rb', line 20

def store(credit_card, options = {})
  options[:crn1] ||= 'DEFAULT'
  request_body = soap_request do |xml|
    add_token(xml, credit_card, options)
  end
  commit(request_body)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/active_merchant/billing/gateways/bpoint.rb', line 80

def supports_scrubbing?
  true
end

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



73
74
75
76
77
78
# File 'lib/active_merchant/billing/gateways/bpoint.rb', line 73

def verify(credit_card, options = {})
  MultiResponse.run(:use_first_response) do |r|
    r.process { authorize(100, credit_card, options) }
    r.process(:ignore_result) { void(r.authorization, options.merge(amount: 100)) }
  end
end

#void(authorization, options = {}) ⇒ Object



64
65
66
67
68
69
70
71
# File 'lib/active_merchant/billing/gateways/bpoint.rb', line 64

def void(authorization, options = {})
  request_body = soap_request do |xml|
    process_payment(xml) do |payment_xml|
      add_void(payment_xml, authorization, options)
    end
  end
  commit(request_body)
end