Class: Bakong::Khqr::MerchantCode::AdditionalData
- Inherits:
-
TagLengthString
- Object
- TagLengthString
- Bakong::Khqr::MerchantCode::AdditionalData
- Defined in:
- lib/bakong/khqr/merchant_code/additional_data.rb
Overview
Tag “62”. Optional sub-tags: bill_number, mobile_number, store_label, terminal_label, purpose_of_transaction. Pass them in a snake_case symbol hash.
Instance Attribute Summary collapse
-
#bill_number ⇒ Object
readonly
Returns the value of attribute bill_number.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#mobile_number ⇒ Object
readonly
Returns the value of attribute mobile_number.
-
#store_label ⇒ Object
readonly
Returns the value of attribute store_label.
-
#terminal_label ⇒ Object
readonly
Returns the value of attribute terminal_label.
Attributes inherited from TagLengthString
Instance Method Summary collapse
-
#initialize(tag, additional_data) ⇒ AdditionalData
constructor
A new instance of AdditionalData.
Methods inherited from TagLengthString
Constructor Details
#initialize(tag, additional_data) ⇒ AdditionalData
Returns a new instance of AdditionalData.
17 18 19 20 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/bakong/khqr/merchant_code/additional_data.rb', line 17 def initialize(tag, additional_data) additional_data ||= {} bill_number_input = additional_data[:bill_number] mobile_number_input = additional_data[:mobile_number] store_label_input = additional_data[:store_label] terminal_label_input = additional_data[:terminal_label] purpose_of_transaction = additional_data[:purpose_of_transaction] string = +"" bill_number = mobile_number = store_label = terminal_label = nil unless bill_number_input.nil? bill_number = BillNumber.new(EMV[:BILLNUMBER_TAG], bill_number_input) string << bill_number.to_s end unless mobile_number_input.nil? mobile_number = MobileNumber.new(EMV[:ADDITIONAL_DATA_FIELD_MOBILE_NUMBER], mobile_number_input) string << mobile_number.to_s end unless store_label_input.nil? store_label = StoreLabel.new(EMV[:STORELABEL_TAG], store_label_input) string << store_label.to_s end unless terminal_label_input.nil? terminal_label = TerminalLabel.new(EMV[:TERMINAL_TAG], terminal_label_input) string << terminal_label.to_s end unless purpose_of_transaction.nil? purpose = PurposeOfTransaction.new(EMV[:PURPOSE_OF_TRANSACTION], purpose_of_transaction) string << purpose.to_s end super(tag, string) @bill_number = bill_number @mobile_number = mobile_number @store_label = store_label @terminal_label = terminal_label @data = { bill_number: bill_number, mobile_number: mobile_number, store_label: store_label, terminal_label: terminal_label, purpose_of_transaction: purpose_of_transaction } end |
Instance Attribute Details
#bill_number ⇒ Object (readonly)
Returns the value of attribute bill_number.
15 16 17 |
# File 'lib/bakong/khqr/merchant_code/additional_data.rb', line 15 def bill_number @bill_number end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
15 16 17 |
# File 'lib/bakong/khqr/merchant_code/additional_data.rb', line 15 def data @data end |
#mobile_number ⇒ Object (readonly)
Returns the value of attribute mobile_number.
15 16 17 |
# File 'lib/bakong/khqr/merchant_code/additional_data.rb', line 15 def mobile_number @mobile_number end |
#store_label ⇒ Object (readonly)
Returns the value of attribute store_label.
15 16 17 |
# File 'lib/bakong/khqr/merchant_code/additional_data.rb', line 15 def store_label @store_label end |
#terminal_label ⇒ Object (readonly)
Returns the value of attribute terminal_label.
15 16 17 |
# File 'lib/bakong/khqr/merchant_code/additional_data.rb', line 15 def terminal_label @terminal_label end |