Class: DkPaymentGateway::IntraTransaction

Inherits:
Object
  • Object
show all
Defined in:
lib/dk_payment_gateway/intra_transaction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ IntraTransaction

Returns a new instance of IntraTransaction.



7
8
9
# File 'lib/dk_payment_gateway/intra_transaction.rb', line 7

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/dk_payment_gateway/intra_transaction.rb', line 5

def client
  @client
end

Instance Method Details

#account_inquiry(params) ⇒ Hash

Intra (DK - DK) Beneficiary Account Inquiry Validates beneficiary account details before initiating a fund transfer

Parameters:

  • params (Hash)

    Account inquiry parameters

Options Hash (params):

  • :request_id (String)

    Unique identifier for the inquiry request

  • :amount (Numeric)

    Transaction amount

  • :currency (String)

    Currency code (e.g., “BTN”)

  • :bene_bank_code (String)

    Beneficiary bank code (1060 for intra)

  • :bene_account_number (String)

    Beneficiary account number

  • :source_account_name (String)

    Source account holder name (optional)

  • :source_account_number (String)

    Source account number

Returns:

  • (Hash)

    Response containing inquiry_id and account_name



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/dk_payment_gateway/intra_transaction.rb', line 24

def (params)
  validate_inquiry_params!(params)

  request_body = build_inquiry_body(params)
  signature_headers = generate_signature_headers(request_body)

  response = client.post(
    '/v1/beneficiary/account_inquiry',
    body: request_body.to_json,
    headers: signature_headers
  )

  validate_response!(response, 'Account Inquiry')
  response['response_data']
end

#fund_transfer(params) ⇒ Hash

Intra (DK - DK) Fund Transfer Initiates a fund transfer after successful account inquiry

Parameters:

  • params (Hash)

    Fund transfer parameters

Options Hash (params):

  • :request_id (String)

    Unique identifier for the request

  • :inquiry_id (String)

    Inquiry ID from account_inquiry

  • :source_app (String)

    Source application identifier

  • :transaction_amount (Numeric)

    Amount to transfer

  • :currency (String)

    Currency code (e.g., “BTN”)

  • :transaction_datetime (String)

    Transaction timestamp (ISO 8601)

  • :bene_bank_code (String)

    Beneficiary bank code

  • :bene_account_number (String)

    Beneficiary account number

  • :bene_cust_name (String)

    Beneficiary customer name

  • :source_account_name (String)

    Source account holder name (optional)

  • :source_account_number (String)

    Source account number

  • :payment_type (String)

    Payment type (should be “INTRA” for DK-DK)

  • :narration (String)

    Transaction description/purpose

Returns:

  • (Hash)

    Response containing inquiry_id and txn_status_id



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/dk_payment_gateway/intra_transaction.rb', line 59

def fund_transfer(params)
  validate_transfer_params!(params)

  request_body = build_transfer_body(params)
  signature_headers = generate_signature_headers(request_body)

  response = client.post(
    '/v1/initiate/transaction',
    body: request_body.to_json,
    headers: signature_headers
  )

  validate_response!(response, 'Fund Transfer')
  response['response_data']
end