Class: Unit::Payment::CreateBatchReleaseRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/payment/create_batch_release_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_id, batch_account_id, amount, description, sender_name, sender_address, sender_account_number, tags = nil, idempotency_key = nil) ⇒ CreateBatchReleaseRequest

Returns a new instance of CreateBatchReleaseRequest.

Parameters:

  • account_id (String)
  • batch_account_id (String)
  • amount (Integer)
  • description (String)
  • sender_name (String)
  • sender_address (Address)
  • sender_account_number (String)
  • tags (Hash) (defaults to: nil)
    • optional

  • idempotency_key (String) (defaults to: nil)
    • optional



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/unit/models/payment/create_batch_release_request.rb', line 20

def initialize(, , amount, description, sender_name, sender_address, , tags = nil, idempotency_key = nil)
  @account_id = 
  @batch_account_id = 
  @amount = amount
  @description = description
  @sender_name = sender_name
  @sender_address = sender_address
  @sender_account_number = 
  @tags = tags
  @idempotency_key = idempotency_key
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



8
9
10
# File 'lib/unit/models/payment/create_batch_release_request.rb', line 8

def 
  @account_id
end

#amountObject (readonly)

Returns the value of attribute amount.



8
9
10
# File 'lib/unit/models/payment/create_batch_release_request.rb', line 8

def amount
  @amount
end

#batch_account_idObject (readonly)

Returns the value of attribute batch_account_id.



8
9
10
# File 'lib/unit/models/payment/create_batch_release_request.rb', line 8

def 
  @batch_account_id
end

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/unit/models/payment/create_batch_release_request.rb', line 8

def description
  @description
end

#idempotency_keyObject (readonly)

Returns the value of attribute idempotency_key.



8
9
10
# File 'lib/unit/models/payment/create_batch_release_request.rb', line 8

def idempotency_key
  @idempotency_key
end

#sender_account_numberObject (readonly)

Returns the value of attribute sender_account_number.



8
9
10
# File 'lib/unit/models/payment/create_batch_release_request.rb', line 8

def 
  @sender_account_number
end

#sender_addressObject (readonly)

Returns the value of attribute sender_address.



8
9
10
# File 'lib/unit/models/payment/create_batch_release_request.rb', line 8

def sender_address
  @sender_address
end

#sender_nameObject (readonly)

Returns the value of attribute sender_name.



8
9
10
# File 'lib/unit/models/payment/create_batch_release_request.rb', line 8

def sender_name
  @sender_name
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/payment/create_batch_release_request.rb', line 8

def tags
  @tags
end

Instance Method Details

#to_hashObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/unit/models/payment/create_batch_release_request.rb', line 32

def to_hash
  payload = {
    "type": "batchRelease",
    "attributes": {
      "amount": amount,
      "description": description,
      "senderName": sender_name,
      "senderAddress": sender_address&.represent,
      "senderAccountNumber": ,
      "tags": tags,
      "idempotencyKey": idempotency_key
    },
    "relationships": {
      "batchAccount": Unit::Types::Relationship.new("batchAccount", ).to_hash,
      "receiver": Unit::Types::Relationship.new("depositAccount", ).to_hash
    }
  }
  payload[:attributes].compact!
  payload
end