Class: Bakong::Khqr::IndividualInfo
- Inherits:
-
Object
- Object
- Bakong::Khqr::IndividualInfo
- Defined in:
- lib/bakong/khqr/individual_info.rb
Overview
Payload describing an individual KHQR recipient. Mirrors the upstream JS ‘IndividualInfo` class but uses Ruby keyword arguments instead of a positional + options-hash signature.
Direct Known Subclasses
Constant Summary collapse
- ATTRS =
%i[ bakong_account_id merchant_name merchant_city account_information acquiring_bank currency amount bill_number store_label terminal_label mobile_number purpose_of_transaction language_preference merchant_name_alternate_language merchant_city_alternate_language upi_merchant_account expiration_timestamp merchant_category_code ].freeze
Instance Method Summary collapse
-
#initialize(bakong_account_id:, merchant_name:, merchant_city:, **optional) ⇒ IndividualInfo
constructor
A new instance of IndividualInfo.
Constructor Details
#initialize(bakong_account_id:, merchant_name:, merchant_city:, **optional) ⇒ IndividualInfo
Returns a new instance of IndividualInfo.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/bakong/khqr/individual_info.rb', line 21 def initialize(bakong_account_id:, merchant_name:, merchant_city:, **optional) validate_string!(:bakong_account_id, bakong_account_id) validate_string!(:merchant_name, merchant_name) validate_string!(:merchant_city, merchant_city) @bakong_account_id = bakong_account_id @merchant_name = merchant_name @merchant_city = merchant_city cleaned = optional.reject { |_, v| v.nil? || v == "" } @account_information = cleaned[:account_information] @acquiring_bank = cleaned[:acquiring_bank] @currency = cleaned.fetch(:currency, CURRENCY[:khr]) @amount = cleaned[:amount] @bill_number = cleaned[:bill_number] @store_label = cleaned[:store_label] @terminal_label = cleaned[:terminal_label] @mobile_number = cleaned[:mobile_number] @purpose_of_transaction = cleaned[:purpose_of_transaction] @language_preference = cleaned[:language_preference] @merchant_name_alternate_language = cleaned[:merchant_name_alternate_language] @merchant_city_alternate_language = cleaned[:merchant_city_alternate_language] @upi_merchant_account = cleaned[:upi_merchant_account] @expiration_timestamp = cleaned[:expiration_timestamp] @merchant_category_code = cleaned[:merchant_category_code] end |