Class: Payline::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/payline/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Client

Returns a new instance of Client.

[View source]

4
5
6
7
# File 'lib/payline/client.rb', line 4

def initialize(config)
  @config = config
  @response_handler = Payline::ResponseHandler.new
end

Instance Method Details

#capture(reserve_response, amount) ⇒ Object

[View source]

17
18
19
20
21
22
23
24
25
26
# File 'lib/payline/client.rb', line 17

def capture(reserve_response, amount)
  params = {
      'PRESENTATION.CURRENCY' => @config.currency,
      'PAYMENT.CODE' => "CC.CP",
      'PRESENTATION.AMOUNT' => amount,
      'IDENTIFICATION.TRANSACTIONID'=>reserve_response.merchant_reference,
      'IDENTIFICATION.REFERENCEID'=> reserve_response.transaction_id
  }
  do_request(params)
end

#debit(guid, amount, credit_card) ⇒ Object

[View source]

9
10
11
# File 'lib/payline/client.rb', line 9

def debit(guid, amount, credit_card)
  proccess("CC.DB", guid, amount, credit_card)
end

#reserve(guid, amount, credit_card) ⇒ Object

[View source]

13
14
15
# File 'lib/payline/client.rb', line 13

def reserve(guid, amount, credit_card)
  proccess("CC.PA", guid, amount, credit_card)
end

#reverse(reserve_response, amount) ⇒ Object

[View source]

29
30
31
32
33
34
35
36
37
38
# File 'lib/payline/client.rb', line 29

def reverse(reserve_response, amount)
  params = {
      'PRESENTATION.CURRENCY' => @config.currency,
      'PAYMENT.CODE' => "CC.RV",
      'PRESENTATION.AMOUNT' => amount,
      'IDENTIFICATION.TRANSACTIONID'=> reserve_response.merchant_reference,
      'IDENTIFICATION.REFERENCEID'=> reserve_response.transaction_id
  }
  do_request(params)
end