Sha256: 6874c046e14efaa6da3e838c80e0ef698b6e1a66db3012ce65926e7e429a837c

Contents?: true

Size: 1.46 KB

Versions: 17

Compression:

Stored size: 1.46 KB

Contents

require "spec_helper"

RSpec.describe Mundipagg::Refund do
  describe "#payload" do
    let(:refund) do
      described_class.new transaction_key: "TRANSACTION-KEY",
        order_key: "ORDER-KEY"
    end

    it do
      expect(refund.payload(100)).to eq({
        manage_credit_card_transaction_collection: {
          manage_credit_card_transaction_request: {
            amount_in_cents: 100,
            transaction_key: "TRANSACTION-KEY"
          }
        },

        manage_order_operation_enum: "Void",
        order_key: "ORDER-KEY"
      })
    end
  end
end

RSpec.describe Mundipagg::Refund::Response do
  let(:body) do
    {
      manage_order_response: {
        manage_order_result: {
          error_report: {
            error_item_collection: {
              error_item: {
                description: "Out of Money",
                error_code: "E666"
              }
            }
          }
        }
      }
    }
  end
  let(:response) { described_class.new body }

  describe "#payload" do
    it do
      expect(response.payload).to eq({
        error_report: {
          error_item_collection: {
            error_item: {
              description: "Out of Money",
              error_code: "E666"
            }
          }
        }
      })
    end
  end

  describe "#error" do
    it { expect(response.error).to be_a(Mundipagg::Error) }
    it { expect(response.error.code).to eq("E666") }
    it { expect(response.error.message).to eq("Out of Money") }
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
better-mundipagg-0.2.11 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.2.10 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.2.9 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.2.8 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.2.7 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.2.6 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.2.5 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.2.4 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.2.3 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.2.2 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.2.1 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.2.0 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.1.5 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.1.3 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.1.2 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.1.1 spec/lib/mundipagg/refund_spec.rb
better-mundipagg-0.1.0 spec/lib/mundipagg/refund_spec.rb