Sha256: f1e45d9c8b844a4187c75ab506f614b3f08dec66a27969262c71836ef50cedc8

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

module PayuLatamHelper
  def setup_payu_latam_gateway
    Solidus::Gateway::PayuLatamGateway.create!(
      name: 'Payu Latam',
      preferred_merchant_id: '508029',
      preferred_account_id: '512323',
      preferred_api_login: 'pRRXKOl8ikMmt9u',
      preferred_api_key: '4Vj8eK4rloUd272L48hsrarnUA'
    )
  end

  def fill_credit_card(number, document)
    page.execute_script("$('#card_number').val('#{number}')")
    # Otherwise ccType field does not get updated correctly
    page.execute_script("$('#card_number').trigger('change')")
    fill_in 'Card Code', with: '123'
    page.execute_script("$('#card_expiry').val('09 / #{Time.now.year + 1}')")
    fill_in 'customer_document', with: document
  end

  def fill_address(country)
    fill_in 'First Name', with: 'APPROVED'
    fill_in 'Last Name', with: '.'
    fill_in 'Street Address', with: 'YT-1300'
    fill_in 'City', with: 'Mos Eisley'
    select 'United States of America', from: 'Country'
    select country.states.first.name, from: 'order_bill_address_attributes_state_id'
    fill_in 'Zip', with: '12010'
    fill_in 'Phone', with: '(555) 555-5555'
  end

  def stub_preferences(preferences)
    if Spree.solidus_gem_version >= Gem::Version.new('2.9')
      stub_spree_preferences(preferences)
    else
      Spree::Config.set(preferences)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_payu_latam-0.1.0 spec/support/payu_latam_helper.rb