Sha256: 5bd4cd27e39f64c23e74944f0a3dd65ee27a8412392f2656514321f3b9216e11

Contents?: true

Size: 1.73 KB

Versions: 46

Compression:

Stored size: 1.73 KB

Contents

class Gillbus
  module BuyBooking
    Gillbus.register self, :buy_booking

    class Request < BaseRequest
      def path; '/online2/buyBooking' end

      # paymentMethod (не обязательный)
      # Способ оплаты заказа.
      attr_accessor :payment_method

      # 1 – наличный;
      METHOD_CASH = 1
      # 2 – кредитной карточкой;
      METHOD_CARD = 2
      # 3 – безналичный;
      METHOD_NOCASH = 3
      # 4 – сервисный;
      METHOD_SERVICE = 4
      # 5 – эквайринг.
      METHOD_ACQUIRING = 5
      # По умолчанию 3.

      # ticketCount
      # Кол-во выкупаемых билетов. 1..k
      attr_accessor :ticket_count

      # Номера билетов с порядковым номером
      attr_accessor :ticket_numbers

      attr_accessor :order_ids

      def params
        numbers = ticket_numbers.map.with_index do |num, i|
          [:"ticketNumber#{i}", num]
        end.to_h

        orders = order_ids.map.with_index do |val, i|
          [:"orderId#{i}", val]
        end.to_h

        compact(
          paymentMethod: payment_method,
          ticketCount: ticket_count,
          **numbers,
          **orders,
        )
      end
    end

    class Response < BaseResponse
      class TicketConfirmation
        extend Fields

        field :number, :int
        # String. пока не выяснится, в какой таймзоне это значение и зачем
        field :date
        field :order_id
        field :confirmation, :yesno_bool
        field :position_numbers, [:int], key: 'POSITION_NUMBER'
      end

      field :ticket, TicketConfirmation
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
gillbus-0.23.0 lib/gillbus/buy_booking.rb
gillbus-0.22.9 lib/gillbus/buy_booking.rb
gillbus-0.22.8 lib/gillbus/buy_booking.rb
gillbus-0.22.7 lib/gillbus/buy_booking.rb
gillbus-0.22.6 lib/gillbus/buy_booking.rb
gillbus-0.22.5 lib/gillbus/buy_booking.rb
gillbus-0.22.4 lib/gillbus/buy_booking.rb
gillbus-0.22.3 lib/gillbus/buy_booking.rb
gillbus-0.22.2 lib/gillbus/buy_booking.rb
gillbus-0.22.1 lib/gillbus/buy_booking.rb
gillbus-0.22.0 lib/gillbus/buy_booking.rb
gillbus-0.21.0 lib/gillbus/buy_booking.rb
gillbus-0.20.9 lib/gillbus/buy_booking.rb
gillbus-0.20.8 lib/gillbus/buy_booking.rb
gillbus-0.20.7 lib/gillbus/buy_booking.rb
gillbus-0.20.6 lib/gillbus/buy_booking.rb
gillbus-0.20.5 lib/gillbus/buy_booking.rb
gillbus-0.20.4 lib/gillbus/buy_booking.rb
gillbus-0.20.3 lib/gillbus/buy_booking.rb
gillbus-0.20.2 lib/gillbus/buy_booking.rb