Class: ZaiPayment::Resources::BpayAccount
- Inherits:
-
Object
- Object
- ZaiPayment::Resources::BpayAccount
- Defined in:
- lib/zai_payment/resources/bpay_account.rb
Overview
BpayAccount resource for managing Zai BPay accounts
Constant Summary collapse
- FIELD_MAPPING =
Map of attribute keys to API field names
{ user_id: :user_id, account_name: :account_name, biller_code: :biller_code, bpay_crn: :bpay_crn }.freeze
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#create(**attributes) ⇒ Response
Create a new BPay account.
-
#initialize(client: nil) ⇒ BpayAccount
constructor
A new instance of BpayAccount.
-
#redact(bpay_account_id) ⇒ Response
Redact a BPay account.
-
#show(bpay_account_id) ⇒ Response
Get a specific BPay account by ID.
-
#show_user(bpay_account_id) ⇒ Response
Get the user associated with a BPay account.
Constructor Details
#initialize(client: nil) ⇒ BpayAccount
Returns a new instance of BpayAccount.
19 20 21 |
# File 'lib/zai_payment/resources/bpay_account.rb', line 19 def initialize(client: nil) @client = client || Client.new end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
9 10 11 |
# File 'lib/zai_payment/resources/bpay_account.rb', line 9 def client @client end |
Instance Method Details
#create(**attributes) ⇒ Response
Create a new BPay account
Create a BPay Account to be used as a Disbursement destination.
99 100 101 102 103 104 |
# File 'lib/zai_payment/resources/bpay_account.rb', line 99 def create(**attributes) validate_create_attributes!(attributes) body = build_bpay_account_body(attributes) client.post('/bpay_accounts', body: body) end |
#redact(bpay_account_id) ⇒ Response
Redact a BPay account
Redacts a BPay account using the given bpay_account_id. Redacted BPay accounts can no longer be used as a disbursement destination.
52 53 54 55 |
# File 'lib/zai_payment/resources/bpay_account.rb', line 52 def redact(bpay_account_id) validate_id!(bpay_account_id, 'bpay_account_id') client.delete("/bpay_accounts/#{bpay_account_id}") end |
#show(bpay_account_id) ⇒ Response
Get a specific BPay account by ID
34 35 36 37 |
# File 'lib/zai_payment/resources/bpay_account.rb', line 34 def show(bpay_account_id) validate_id!(bpay_account_id, 'bpay_account_id') client.get("/bpay_accounts/#{bpay_account_id}") end |
#show_user(bpay_account_id) ⇒ Response
Get the user associated with a BPay account
Show the User the BPay Account is associated with using a given bpay_account_id.
70 71 72 73 |
# File 'lib/zai_payment/resources/bpay_account.rb', line 70 def show_user(bpay_account_id) validate_id!(bpay_account_id, 'bpay_account_id') client.get("/bpay_accounts/#{bpay_account_id}/users") end |