Sha256: f63f44d947e44b1a75a3718c71aeca7276281c699f5f5daa30107e0cd413c21e

Contents?: true

Size: 850 Bytes

Versions: 2

Compression:

Stored size: 850 Bytes

Contents

# frozen_string_literal: true

module Payture::Cheques
  module Methods
    class Create < Base
      private

      def url
        "#{config.base_url}/Create"
      end

      def params(cheque_id:, inn:, content:, group: nil)
        message = content.delete("Message") || content.delete(:Message)
        additional_messages = content.delete("AdditionalMessages") || content.delete(:AdditionalMessages)
        params = {
          Key: config.merchant_id,
          Password: config.password,
          Message: message,
          AdditionalMessages: additional_messages || [],
          Cheque: {
            Id: cheque_id,
            INN: inn,
            Content: content,
          },
        }
        params[:Group] = group if group
        params
      end

      def response_class
        Responses::Create
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
payture-cheques-0.1.5 lib/payture/cheques/methods/create.rb
payture-cheques-0.1.4 lib/payture/cheques/methods/create.rb