Sha256: 06cb6a41bb939c7b10ec61ea135e6eabdbf88ee82a4387b92b425c92c54bd531

Contents?: true

Size: 420 Bytes

Versions: 5

Compression:

Stored size: 420 Bytes

Contents

# frozen_string_literal: true

module Payture::Cheques
  module Responses
    class Create < Base
      ERROR_STATES = {
        'Conflict' => 'DUPLICATE_ID',
        'BadRequest' => 'BAD_REQUEST_FORMAT',
      }.freeze

      def success?
        body['Success'] == true && body['Status'] == 'Accepted'
      end

      def error_code
        body['ErrCode'] || ERROR_STATES[body['Status']]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
payture-cheques-0.1.5 lib/payture/cheques/responses/create.rb
payture-cheques-0.1.4 lib/payture/cheques/responses/create.rb
payture-cheques-0.1.3 lib/payture/cheques/responses/create.rb
payture-cheques-0.1.2 lib/payture/cheques/responses/create.rb
payture-cheques-0.1.0 lib/payture/cheques/responses/create.rb