Class: Workarea::Affirm::BogusGateway

Inherits:
Object
  • Object
show all
Defined in:
lib/workarea/affirm/bogus_gateway.rb

Instance Method Summary collapse

Constructor Details

#initializeBogusGateway

Returns a new instance of BogusGateway.



4
# File 'lib/workarea/affirm/bogus_gateway.rb', line 4

def initialize(*); end

Instance Method Details

#authorize(_token, _order_id = '', _request_id) ⇒ Object



31
32
33
# File 'lib/workarea/affirm/bogus_gateway.rb', line 31

def authorize(_token, _order_id = '', _request_id)
  Response.new(response(payment_response_body, 200))
end

#capture(_payment_id, _amount, _request_id) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/workarea/affirm/bogus_gateway.rb', line 15

def capture(_payment_id, _amount, _request_id)
  b = {
    "fee": 600,
    "created": '2016-03-18T00:03:44Z',
    "order_id": 'JKLM4321',
    "currency": 'USD',
    "amount": 6100,
    "type": 'capture',
    "id": 'O5DZHKL942503649',
    "transaction_id": '6dH0LrrgUaMD7Llc',
    "merchant_transaction_id": 'A2189192837'
  }

  Response.new(response(b, 200))
end

#get_checkout(token) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/workarea/affirm/bogus_gateway.rb', line 6

def get_checkout(token)
  b = if token == 'total_error'
        get_checkout_response_total_error_body
      else
        get_checkout_response_body
      end
  Response.new(response(b))
end

#purchase(_token, _order_id = '', _request_id) ⇒ Object



35
36
37
# File 'lib/workarea/affirm/bogus_gateway.rb', line 35

def purchase(_token, _order_id = '', _request_id)
  Response.new(response(payment_response_body, 200))
end

#refund(_affirm_order_id, _amount, _request_id) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/workarea/affirm/bogus_gateway.rb', line 39

def refund(_affirm_order_id, _amount, _request_id)
  b = {
    "created": '2014-03-18T19:20:30Z',
    "fee_refunded": 1500,
    "amount": 50_000,
    "type": 'refund',
    "id": 'OWA49MWUCA29SBVQ',
    "transaction_id": 'r86zdkHONPcaiVJJ'
  }

  Response.new(response(b))
end

#void(_payment_id) ⇒ Object



52
53
54
# File 'lib/workarea/affirm/bogus_gateway.rb', line 52

def void(_payment_id)
  Response.new(response(payment_response_body))
end