Class: Trolley::InvoicePaymentGateway

Inherits:
Object
  • Object
show all
Defined in:
lib/trolley/gateways/InvoicePaymentGateway.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ InvoicePaymentGateway

Returns a new instance of InvoicePaymentGateway.



5
6
7
# File 'lib/trolley/gateways/InvoicePaymentGateway.rb', line 5

def initialize(client)
  @client = client
end

Instance Method Details

#create(body) ⇒ Object



9
10
11
12
# File 'lib/trolley/gateways/InvoicePaymentGateway.rb', line 9

def create(body)
  response = @client.post('/v1/invoices/payment/create', body)
  invoice_payment_builder(response)
end

#delete(body) ⇒ Object



19
20
21
22
# File 'lib/trolley/gateways/InvoicePaymentGateway.rb', line 19

def delete(body)
  @client.post('/v1/invoices/payment/delete', body)
  true
end

#invoice_payment_builder(response) ⇒ Object



29
30
31
# File 'lib/trolley/gateways/InvoicePaymentGateway.rb', line 29

def invoice_payment_builder(response)
  Utils::ResponseMapper.build(response, InvoicePayment)
end

#invoice_payments_list_builder(response) ⇒ Object



33
34
35
# File 'lib/trolley/gateways/InvoicePaymentGateway.rb', line 33

def invoice_payments_list_builder(response)
  Utils::PaginatedArray.from_response(response, InvoicePayment)
end

#search(body) ⇒ Object



24
25
26
27
# File 'lib/trolley/gateways/InvoicePaymentGateway.rb', line 24

def search(body)
  response = @client.post('/v1/invoices/payment/search', body)
  invoice_payments_list_builder(response)
end

#update(body) ⇒ Object



14
15
16
17
# File 'lib/trolley/gateways/InvoicePaymentGateway.rb', line 14

def update(body)
  @client.post('/v1/invoices/payment/update', body)
  true
end