Sha256: 0b7ae90cfb02e033f108fb92e4376bca03692eeec3fccf7d1631df7399e69dfa

Contents?: true

Size: 1.7 KB

Versions: 1

Compression:

Stored size: 1.7 KB

Contents

module Spree
  class BillingIntegration::Skrill::QuickCheckout < BillingIntegration
    preference :merchant_id, :string
    preference :language, :string, :default => 'EN'
    preference :currency, :string, :default => 'EUR'
    preference :payment_options, :string, :default => 'ACC'
    preference :pay_to_email, :string ,   :default => 'your@merchant.email_here' 

    def provider_class
      ActiveMerchant::Billing::Skrill
    end

    def redirect_url(order, opts = {})
      opts.merge! self.preferences

      set_global_options(opts)

      opts[:detail1_text] = order.number
      opts[:detail1_description] = "Order:"

      opts[:pay_from_email] = order.email
      opts[:firstname] = order.bill_address.firstname
      opts[:lastname] = order.bill_address.lastname
      opts[:address] = order.bill_address.address1
      opts[:address2] = order.bill_address.address2
      opts[:phone_number] = order.bill_address.phone.gsub(/\D/,'') if order.bill_address.phone
      opts[:city] = order.bill_address.city
      opts[:postal_code] = order.bill_address.zipcode
      opts[:state] = order.bill_address.state.nil? ? order.bill_address.state_name.to_s : order.bill_address.state.abbr
      opts[:country] = order.bill_address.country.name
      opts[:pay_to_email] = self.preferred_pay_to_email
      opts[:hide_login] = 1
      opts[:merchant_fields] = 'platform,order_id,payment_method_id'
      opts[:platform] = 'Spree'
      opts[:order_id] = order.number

      skrill = self.provider
      skrill.payment_url(opts)
    end

    private
      def set_global_options(opts)
        opts[:recipient_description] = Spree::Config[:site_name]
        opts[:payment_methods] = self.preferred_payment_options
      end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_gateway-2.1.1 app/models/spree/billing_integration/skrill/quick_checkout.rb