Class: PFS::API::TransfersService

Inherits:
Service
  • Object
show all
Defined in:
lib/pfs/api/transfers_service.rb

Instance Attribute Summary

Attributes inherited from Service

#client

Instance Method Summary collapse

Methods inherited from Service

#initialize

Constructor Details

This class inherits a constructor from PFS::API::Service

Instance Method Details

#create(account_id, currency, amount, destination, destination_id, country, first_name, last_name, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pfs/api/transfers_service.rb', line 6

def create(, currency, amount, destination, destination_id, country, first_name, last_name, options = {})
  data = {
    currency: currency,
    paymentamount: amount,
    accountidentifier: destination,
    bankidentifier: destination_id,
    countrycode: country,
    firstname: first_name,
    lastname: last_name,
  }
  data[:isinstant] = true if options[:instant]
  data[:reference] = options[:reference] if options[:reference]
  data[:unstructuredreference] = options[:unstructured_reference] if options[:unstructured_reference]
  data[:userdefinedfields] = options[:user_defined_fields] if options[:user_defined_fields]
  response = client.post("/BankPayment/#{}/OneOffPayment", data, options)
  Resources::Transfers::Transfer.new(response, response.body[:data])
end

#internal(from_account_id, to_account_id, amount, currency, fee_code, description, terminal_id) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/pfs/api/transfers_service.rb', line 24

def internal(, , amount, currency, fee_code, description, terminal_id)
  data = {
    id: ,
    toId: ,
    amount: amount,
    currencyCode: currency,
    description: description,
    feeCode: fee_code,
    terminalId: terminal_id,
  }

  response = client.post("/Account/CardholderToCardholderTransfer", data)
  Resources::Transfers::InternalTransfer.new(response, response.body[:data])
end