Class: Bakong::OpenApi::Resources::Transactions
- Defined in:
- lib/bakong/open_api/resources/transactions.rb
Overview
Bakong transaction lookups. Five single-record endpoints + two batch endpoints. Single-record lookups return the transaction Hash on success, ‘nil` when the API reports errorCode 1 (not found), and raise on any other failure. Batch endpoints return the full array of per-item results so the caller can introspect statuses.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#check_by_external_ref(external_ref:) ⇒ Object
Single transaction by external reference / merchant ID (1-35 chars).
-
#check_by_hash(hash:) ⇒ Object
Single transaction by 64-char full hash.
-
#check_by_hash_list(hashes:) ⇒ Hash
Batch lookup by up to 50 full hashes.
-
#check_by_instruction_ref(instruction_ref:) ⇒ Object
Single transaction by instruction reference (1-35 chars).
-
#check_by_md5(md5:) ⇒ Object
Single transaction by MD5 of the KHQR string.
-
#check_by_md5_list(md5s:) ⇒ Hash
Batch lookup by up to 50 MD5 hashes.
-
#check_by_short_hash(hash:, amount:, currency:) ⇒ Object
Single transaction by 8-char short hash.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Bakong::OpenApi::Resources::Base
Instance Method Details
#check_by_external_ref(external_ref:) ⇒ Object
Single transaction by external reference / merchant ID (1-35 chars).
45 46 47 48 49 50 51 |
# File 'lib/bakong/open_api/resources/transactions.rb', line 45 def check_by_external_ref(external_ref:) submit( "/v1/check_transaction_by_external_ref", { external_ref: external_ref }, treat_response_code_1_as: :not_found ) end |
#check_by_hash(hash:) ⇒ Object
Single transaction by 64-char full hash.
20 21 22 |
# File 'lib/bakong/open_api/resources/transactions.rb', line 20 def check_by_hash(hash:) submit("/v1/check_transaction_by_hash", { hash: hash }, treat_response_code_1_as: :not_found) end |
#check_by_hash_list(hashes:) ⇒ Hash
Batch lookup by up to 50 full hashes. Returns the full envelope so callers can iterate per-row statuses (SUCCESS / NOT_FOUND / FAILED).
67 68 69 70 71 |
# File 'lib/bakong/open_api/resources/transactions.rb', line 67 def check_by_hash_list(hashes:) validate_batch_size!(hashes, "hashes") envelope = connection.post("/v1/check_transaction_by_hash_list", body: hashes) Helpers::CaseHelper.to_snake(envelope) end |
#check_by_instruction_ref(instruction_ref:) ⇒ Object
Single transaction by instruction reference (1-35 chars).
36 37 38 39 40 41 42 |
# File 'lib/bakong/open_api/resources/transactions.rb', line 36 def check_by_instruction_ref(instruction_ref:) submit( "/v1/check_transaction_by_instruction_ref", { instruction_ref: instruction_ref }, treat_response_code_1_as: :not_found ) end |
#check_by_md5(md5:) ⇒ Object
Single transaction by MD5 of the KHQR string.
15 16 17 |
# File 'lib/bakong/open_api/resources/transactions.rb', line 15 def check_by_md5(md5:) submit("/v1/check_transaction_by_md5", { md5: md5 }, treat_response_code_1_as: :not_found) end |
#check_by_md5_list(md5s:) ⇒ Hash
Batch lookup by up to 50 MD5 hashes. Returns the full envelope so callers can iterate per-row statuses (SUCCESS / NOT_FOUND / STATIC_QR).
57 58 59 60 61 |
# File 'lib/bakong/open_api/resources/transactions.rb', line 57 def check_by_md5_list(md5s:) validate_batch_size!(md5s, "md5s") envelope = connection.post("/v1/check_transaction_by_md5_list", body: md5s) Helpers::CaseHelper.to_snake(envelope) end |
#check_by_short_hash(hash:, amount:, currency:) ⇒ Object
Single transaction by 8-char short hash. Requires amount + currency to disambiguate.
27 28 29 30 31 32 33 |
# File 'lib/bakong/open_api/resources/transactions.rb', line 27 def check_by_short_hash(hash:, amount:, currency:) submit( "/v1/check_transaction_by_short_hash", { hash: hash, amount: amount, currency: currency }, treat_response_code_1_as: :not_found ) end |