Sha256: 8144c198b38d82f85e2cda249629d7509fa23b3999ae3cec6a7261e65858bdfa

Contents?: true

Size: 933 Bytes

Versions: 4

Compression:

Stored size: 933 Bytes

Contents

module Ebanx
  module Command
    class PayoutCreate < Command
      def initialize(params)
        @params         = params
        @request_method = :post
        @request_action = 'payout/create'
        @response_type  = :json
      end

      def validate
        validate_presence :external_reference
        validate_presence :country
        validate_presence :amount
        validate_presence :currency_code
        validate_presence :payee
        validate_presence :payee, :name
        validate_presence :payee, :email
        validate_with_callback [:payee, :document], -> (value, object) {(object[:country] == 'mx' || !value.nil?) or raise ArgumentError.new("Missing argument [:payee, :document]")}
        validate_with_callback [:payee, :document_type], -> (value, object) {(object[:country] == 'mx' || !value.nil?) or raise ArgumentError.new("Missing argument [:payee, :document_type]")}
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ebanx-1.3.5 lib/ebanx/command/payout_create.rb
ebanx-1.3.4 lib/ebanx/command/payout_create.rb
ebanx-1.3.3 lib/ebanx/command/payout_create.rb
ebanx-1.3.2 lib/ebanx/command/payout_create.rb