Class: ActiveMerchant::Billing::ModernPaymentsCimGateway

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

Overview

:nodoc:

Constant Summary collapse

TEST_URL =
"https://secure.modpay.com/netservices/test/ModpayTest.asmx"
LIVE_URL =
'https://secure.modpay.com/ws/modpay.asmx'
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::DEBIT_CARDS

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, inherited, supports?, #test?

Methods included from Utils

generate_unique_id

Methods included from CreditCardFormatting

#format

Methods included from RequiresParameters

#requires!

Methods included from PostsData

included, #ssl_get, #ssl_post

Constructor Details

#initialize(options = {}) ⇒ ModernPaymentsCimGateway

Returns a new instance of ModernPaymentsCimGateway.



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

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

Instance Method Details

#authorize_credit_card_payment(customer_id, amount) ⇒ Object

Raises:

  • (ArgumentError)


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

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



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

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)


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

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)


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

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