Sha256: 409e8330f87b590ded076b709398e01c40250f0e538350d269374dd5203a02ff

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe SolidusBolt::Transactions::DetailService, :vcr, :bolt_configuration do
  subject(:api) { described_class.new(transaction_reference: reference, payment_method: payment_method) }

  let(:transaction) do
    SolidusBolt::Transactions::AuthorizeService.call(
      order: order, credit_card: credit_card_payload, create_bolt_account: false, payment_method: payment_method
    )
  end
  let(:credit_card_payload) do
    tokenize_credit_card(credit_card_number: '4111111111111004', cvv: '111').merge(
      expiration: (Time.current + 1.year).strftime('%Y-%m'),
      token_type: 'bolt'
    )
  end
  let(:order) { create(:order_with_line_items) }
  let(:reference) { transaction['transaction']['reference'] }
  let(:payment_method) { create(:bolt_payment_method) }

  describe '#call', vcr: true do
    it 'makes the API call' do
      response = api.call

      expect(response['reference']).to eq reference
      expect(response['status']).to eq 'authorized'
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
solidus_bolt-0.7.2 spec/services/solidus_bolt/transactions/detail_service_spec.rb
solidus_bolt-0.7.1 spec/services/solidus_bolt/transactions/detail_service_spec.rb
solidus_bolt-0.7.0 spec/services/solidus_bolt/transactions/detail_service_spec.rb
solidus_bolt-0.6.0 spec/services/solidus_bolt/transactions/detail_service_spec.rb
solidus_bolt-0.5.0 spec/services/solidus_bolt/transactions/detail_service_spec.rb
solidus_bolt-0.4.0 spec/services/solidus_bolt/transactions/detail_service_spec.rb
solidus_bolt-0.3.0 spec/services/solidus_bolt/transactions/detail_service_spec.rb
solidus_bolt-0.2.0 spec/services/solidus_bolt/transactions/detail_service_spec.rb
solidus_bolt-0.1.0 spec/services/solidus_bolt/transactions/detail_service_spec.rb
solidus_bolt-0.0.1 spec/services/solidus_bolt/transactions/detail_service_spec.rb