Class: Bambora::Bank::PaymentProfileResource

Inherits:
Object
  • Object
show all
Defined in:
lib/bambora/bank/payment_profile_resource.rb

Overview

For making requests to the /scripts/payment_profile.asp endpoint

Constant Summary collapse

DEFAULT_VERSION =
1.0
DEFAULT_RESPONSE_FORMAT =
'QS'
CREATE_OPERATION_TYPE =
'N'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, api_key:, version: DEFAULT_VERSION) ⇒ PaymentProfileResource

Instantiate an interface to make requests against Bambora’s Profiles API.

Examples:


client = Bambora::Rest::WWWFormClient(base_url: '...', merchant_id: '...')
profiles = Bambora::Bank::PaymentProfileResource(client: client, api_key: '...')

# Start making requests ...

Parameters:

  • client (Bambora::Rest::WWWFormClient)

    An instance of Bambora::Rest::WWWFormClient, used to make network requests.

  • api_key (String)

    An API key for this endpoint. This is also known as the “Pass Code”

  • version (String) (defaults to: DEFAULT_VERSION)

    The Service Version you are requesting from the server.



30
31
32
33
34
35
# File 'lib/bambora/bank/payment_profile_resource.rb', line 30

def initialize(client:, api_key:, version: DEFAULT_VERSION)
  @client = client
  @api_key = api_key
  @version = version
  @sub_path = '/scripts/payment_profile.asp'
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



14
15
16
# File 'lib/bambora/bank/payment_profile_resource.rb', line 14

def api_key
  @api_key
end

#clientObject (readonly)

Returns the value of attribute client.



14
15
16
# File 'lib/bambora/bank/payment_profile_resource.rb', line 14

def client
  @client
end

#sub_pathObject (readonly)

Returns the value of attribute sub_path.



14
15
16
# File 'lib/bambora/bank/payment_profile_resource.rb', line 14

def sub_path
  @sub_path
end

#versionObject (readonly)

Returns the value of attribute version.



14
15
16
# File 'lib/bambora/bank/payment_profile_resource.rb', line 14

def version
  @version
end

Instance Method Details

#create(profile_data) ⇒ Object

Create a Bank Payment Profile

payment_profile_resource.create(data)

@params profile_data [Hash] with values as noted in the example.

Examples:

data = {
  customer_code: '1234',
  bank_account_type: 'CA',
  bank_account_holder: 'All-Maudra Mayrin',
  institution_number: '123',
  branch_number: '12345',
  account_number: '123456789',
  name: 'Hup Podling',
  email_address: 'Brea Princess of Vapra',
  phone_number: '1231231234',
  address_1: 'The Castle',
  city: "Ha'rar",
  postal_code: 'H0H 0H0',
  province: 'Vapra',
  country: 'Thra',
}


61
62
63
# File 'lib/bambora/bank/payment_profile_resource.rb', line 61

def create(profile_data)
  client.post(path: sub_path, body: payment_profile_body(profile_data))
end