Class: ActiveMerchant::Billing::ModernPaymentsCimGateway

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

Overview

:nodoc:

Constant Summary

LIVE_XMLNS =
"https://secure.modpay.com/ws/"
TEST_XMLNS =
"https://secure.modpay.com/netservices/test/"
SUCCESS_MESSAGE =
"Transaction accepted"
FAILURE_MESSAGE =
"Transaction failed"
ERROR_MESSAGE =
"Transaction error"
PAYMENT_METHOD =
{
  :check => 1,
  :credit_card => 2
}

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

Methods inherited from Gateway

card_brand, #card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #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 = {}) ⇒ ModernPaymentsCimGateway



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

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

Instance Method Details

#authorize_credit_card_payment(customer_id, amount) ⇒ Object

Raises:

  • (ArgumentError)


47
48
49
50
51
52
53
54
55
# File 'lib/active_merchant/billing/gateways/modern_payments_cim.rb', line 47

def authorize_credit_card_payment(customer_id, amount)
  raise ArgumentError, "The customer_id cannot be blank" if customer_id.blank?

  post = {}
  add_customer_id(post, customer_id)
  add_amount(post, amount)

  commit('AuthorizeCreditCardPayment', post)
end

#create_customer(options = {}) ⇒ Object



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

def create_customer(options = {})
  post = {}
  add_customer_data(post, options)
  add_address(post, options)

  commit('CreateCustomer', post)
end

#create_payment(customer_id, amount, options = {}) ⇒ Object

Raises:

  • (ArgumentError)


57
58
59
60
61
62
63
64
65
66
# File 'lib/active_merchant/billing/gateways/modern_payments_cim.rb', line 57

def create_payment(customer_id, amount, options = {})
  raise ArgumentError, "The customer_id cannot be blank" if customer_id.blank?

  post = {}
  add_customer_id(post, customer_id)
  add_amount(post, amount)
  add_payment_details(post, options)

  commit('CreatePayment', post)
end

#modify_customer_credit_card(customer_id, credit_card) ⇒ Object

Raises:

  • (ArgumentError)


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

def modify_customer_credit_card(customer_id, credit_card)
  raise ArgumentError, "The customer_id cannot be blank" if customer_id.blank?

  post = {}
  add_customer_id(post, customer_id)
  add_credit_card(post, credit_card)

  commit('ModifyCustomerCreditCard', post)
end