Class: ActiveMerchant::Billing::QbmsGateway

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

Constant Summary collapse

API_VERSION =
'4.0'
TYPES =
{
  authorize: 'CustomerCreditCardAuth',
  capture: 'CustomerCreditCardCapture',
  purchase: 'CustomerCreditCardCharge',
  refund: 'CustomerCreditCardTxnVoidOrRefund',
  void: 'CustomerCreditCardTxnVoid',
  query: 'MerchantAccountQuery'
}

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

Creates a new QbmsGateway

The gateway requires that a valid app id, app login, and ticket be passed in the options hash.

Options

  • :login – The App Login (REQUIRED)

  • :ticket – The Connection Ticket. (REQUIRED)

  • :pem – The PEM-encoded SSL client key and certificate. (REQUIRED)

  • :testtrue or false. If true, perform transactions against the test server. Otherwise, perform transactions against the production server.



39
40
41
42
# File 'lib/active_merchant/billing/gateways/qbms.rb', line 39

def initialize(options = {})
  requires!(options, :login, :ticket)
  super
end

Instance Method Details

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

Performs an authorization, which reserves the funds on the customer’s credit card, but does not charge the card.

Parameters

  • money – The amount to be authorized as an Integer value in cents.

  • creditcard – The CreditCard details for the transaction.

  • options – A hash of optional parameters.



53
54
55
# File 'lib/active_merchant/billing/gateways/qbms.rb', line 53

def authorize(money, creditcard, options = {})
  commit(:authorize, money, options.merge(credit_card: creditcard))
end

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

Captures the funds from an authorized transaction.

Parameters

  • money – The amount to be captured as an Integer value in cents.

  • authorization – The authorization returned from the previous authorize request.



76
77
78
# File 'lib/active_merchant/billing/gateways/qbms.rb', line 76

def capture(money, authorization, options = {})
  commit(:capture, money, options.merge(transaction_id: authorization))
end

#credit(money, identification, options = {}) ⇒ Object

Credit an account.

This transaction is also referred to as a Refund and indicates to the gateway that money should flow from the merchant to the customer.

Parameters

  • money – The amount to be credited to the customer as an Integer value in cents.

  • identification – The ID of the original transaction against which the credit is being issued.

  • options – A hash of parameters.



102
103
104
105
# File 'lib/active_merchant/billing/gateways/qbms.rb', line 102

def credit(money, identification, options = {})
  ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
  refund(money, identification, {})
end

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

Perform a purchase, which is essentially an authorization and capture in a single operation.

Parameters

  • money – The amount to be purchased as an Integer value in cents.

  • creditcard – The CreditCard details for the transaction.

  • options – A hash of optional parameters.



65
66
67
# File 'lib/active_merchant/billing/gateways/qbms.rb', line 65

def purchase(money, creditcard, options = {})
  commit(:purchase, money, options.merge(credit_card: creditcard))
end

#queryObject

Query the merchant account status



112
113
114
# File 'lib/active_merchant/billing/gateways/qbms.rb', line 112

def query
  commit(:query, nil, {})
end

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



107
108
109
# File 'lib/active_merchant/billing/gateways/qbms.rb', line 107

def refund(money, identification, options = {})
  commit(:refund, money, options.merge(transaction_id: identification))
end

#scrub(transcript) ⇒ Object



120
121
122
123
124
125
# File 'lib/active_merchant/billing/gateways/qbms.rb', line 120

def scrub(transcript)
  transcript.
    gsub(%r((<ConnectionTicket>)[^<]*(</ConnectionTicket>))i, '\1[FILTERED]\2').
    gsub(%r((<CreditCardNumber>)[^<]*(</CreditCardNumber>))i, '\1[FILTERED]\2').
    gsub(%r((<CardSecurityCode>)[^<]*(</CardSecurityCode>))i, '\1[FILTERED]\2')
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


116
117
118
# File 'lib/active_merchant/billing/gateways/qbms.rb', line 116

def supports_scrubbing?
  true
end

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

Void a previous transaction

Parameters

  • authorization - The authorization returned from the previous authorize request.



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

def void(authorization, options = {})
  commit(:void, nil, options.merge(transaction_id: authorization))
end