Class: Zaala::API::Basket
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Zaala::API::Basket
- Defined in:
- lib/zaala/api/types.rb
Overview
The Basket class contains all financial amounts and information about its products.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_message(h) ⇒ Object
363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/zaala/api/types.rb', line 363 def self.(h) Basket.new({ amount: h[:amount], currency: h[:amountCurrency], detail_records: h[:detailRecords].map { |r| DetailRecord.(r) }, gross_amount: h[:grossAmount], other_payment_means_amount: h[:otherPaymentMeansAmount], customer_order_number: h[:customerOrderNumber], order_number: h[:orderNumber], }) end |
Instance Method Details
#to_message ⇒ Object
375 376 377 378 379 380 381 382 383 384 385 386 |
# File 'lib/zaala/api/types.rb', line 375 def m = { amount: amount, amountCurrency: currency, detailRecords: detail_records.map(&:to_message) } m[:grossAmount] = gross_amount unless gross_amount.nil? m[:otherPaymentMeansAmount] = other_payment_means_amount unless other_payment_means_amount.nil? m[:customerOrderNumber] = customer_order_number unless customer_order_number.nil? m[:orderNumber] = order_number unless order_number.nil? m end |