Class: ActiveMerchant::Billing::BogusCyberSourceGateway

Inherits:
BogusGateway
  • Object
show all
Defined in:
lib/active_merchant/billing/bogus_cyber_source_gateway.rb

Instance Method Summary collapse

Instance Method Details

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



16
17
18
19
20
21
22
23
24
25
# File 'lib/active_merchant/billing/bogus_cyber_source_gateway.rb', line 16

def authorize(money, credit_card_or_subscription, options = {})
  case normalize(credit_card_or_subscription)
  when /1$/, "5118839074516426404010"
    succuessful_auth_response
  when /2$/
    Response.new(false, FAILURE_MESSAGE, { authorized_amount: money, error: FAILURE_MESSAGE }, { test: true, error_code: STANDARD_ERROR_CODE[:processing_error] })
  else
    raise Error, error_message(credit_card_or_subscription)
  end
end

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



27
28
29
30
31
32
33
34
35
36
# File 'lib/active_merchant/billing/bogus_cyber_source_gateway.rb', line 27

def purchase(money, credit_card_or_subscription, options = {})
  case normalize(credit_card_or_subscription)
  when /1$/, "5118839074516426404010"
    succuessful_purchase_response
  when /2$/
    Response.new(false, FAILURE_MESSAGE, { authorized_amount: money, error: FAILURE_MESSAGE }, { test: true, error_code: STANDARD_ERROR_CODE[:processing_error] })
  else
    raise Error, error_message(credit_card_or_subscription)
  end
end

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



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/active_merchant/billing/bogus_cyber_source_gateway.rb', line 4

def store(paysource, options = {})
  authorization = ";5118839074516426404010;Ahj/7wSTFX4pmYA85bCqKhDdq4ZOWjNklxakXpGAKXFqRekZpABykhk0kyro9JiuKBOTFX4pmYA85bCqAAAA5wQ4;store;;;5118839074516426404010"
  case normalize(paysource)
  when /1$/
    Response.new(true, SUCCESS_MESSAGE, { billingid: "1" }, { test: true, authorization: authorization })
  when /2$/
    Response.new(false, FAILURE_MESSAGE, { billingid: nil, error: FAILURE_MESSAGE }, { test: true, error_code: STANDARD_ERROR_CODE[:processing_error] })
  else
    raise Error, error_message(paysource)
  end
end