Sha256: 86f3caf8fccca0c15ac5e6893d5de8bb66554cc304660d59a840e3453b9df716

Contents?: true

Size: 880 Bytes

Versions: 10

Compression:

Stored size: 880 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe SolidusBolt::Handlers::CreditHandler do
  subject(:credit) { described_class.call(params) }

  let(:transaction_id) { 'AAAA-BBBB-CCCC' }
  let(:payment) { create(:bolt_payment, response_code: 'V2YW-NYNR-2MYM') }
  let(:params) do
    {
      data: {
        reference: transaction_id,
        source_transaction: { reference: payment.response_code },
        requested_refund_amount: { amount: 100 }
      }
    }
  end

  before do
    allow(SolidusBolt::Payments::CreditSyncService).to receive(:call).with(
      payment: payment, amount: 100, transaction_id: transaction_id
    )
    credit
  end

  it 'calls the payment credit service' do
    expect(SolidusBolt::Payments::CreditSyncService).to have_received(:call).with(
      payment: payment, amount: 100, transaction_id: transaction_id
    )
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
solidus_bolt-0.7.2 spec/webhooks/solidus_bolt/handlers/credit_handler_spec.rb
solidus_bolt-0.7.1 spec/webhooks/solidus_bolt/handlers/credit_handler_spec.rb
solidus_bolt-0.7.0 spec/webhooks/solidus_bolt/handlers/credit_handler_spec.rb
solidus_bolt-0.6.0 spec/webhooks/solidus_bolt/handlers/credit_handler_spec.rb
solidus_bolt-0.5.0 spec/webhooks/solidus_bolt/handlers/credit_handler_spec.rb
solidus_bolt-0.4.0 spec/webhooks/solidus_bolt/handlers/credit_handler_spec.rb
solidus_bolt-0.3.0 spec/webhooks/solidus_bolt/handlers/credit_handler_spec.rb
solidus_bolt-0.2.0 spec/webhooks/solidus_bolt/handlers/credit_handler_spec.rb
solidus_bolt-0.1.0 spec/webhooks/solidus_bolt/handlers/credit_handler_spec.rb
solidus_bolt-0.0.1 spec/webhooks/solidus_bolt/handlers/credit_handler_spec.rb