Sha256: f7c8bb0480881f4c6e4656ad3b1c5987b87231ac8644268571d461ff75f12b35

Contents?: true

Size: 996 Bytes

Versions: 12

Compression:

Stored size: 996 Bytes

Contents

# frozen_string_literal: true

require 'securerandom'

module SolidusPaypalCommercePlatform
  class Wizard
    def name
      I18n.t('start_paying_with_paypal')
    end

    def partial_name
      '/solidus_paypal_commerce_platform/admin/payment_methods/paypal_wizard'
    end

    def button_url
      parameters = {
        product: "addipmt",
        partnerId: SolidusPaypalCommercePlatform.config.partner_id,
        partnerClientId: SolidusPaypalCommercePlatform.config.partner_client_id,
        features: "PAYMENT,REFUND",
        partnerLogoUrl: logo,
        integrationType: "FO",
        displayMode: "minibrowser",
        sellerNonce: nonce,
      }

      URI("https://#{SolidusPaypalCommercePlatform.config.env_domain}/bizsignup/partner/entry?#{parameters.to_query}")
    end

    def nonce
      @nonce ||= SecureRandom.alphanumeric(128)
    end

    private

    def logo
      ActionController::Base.helpers.image_path(::Spree::Config[:admin_interface_logo])
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
solidus_paypal_commerce_platform-1.0.3 app/models/solidus_paypal_commerce_platform/wizard.rb
solidus_paypal_commerce_platform-1.0.2 app/models/solidus_paypal_commerce_platform/wizard.rb
solidus_paypal_commerce_platform-0.7.1 app/models/solidus_paypal_commerce_platform/wizard.rb
solidus_paypal_commerce_platform-1.0.1 app/models/solidus_paypal_commerce_platform/wizard.rb
solidus_paypal_commerce_platform-1.0.0 app/models/solidus_paypal_commerce_platform/wizard.rb
solidus_paypal_commerce_platform-0.7.0 app/models/solidus_paypal_commerce_platform/wizard.rb
solidus_paypal_commerce_platform-1.0.0.beta3 app/models/solidus_paypal_commerce_platform/wizard.rb
solidus_paypal_commerce_platform-1.0.0.beta2 app/models/solidus_paypal_commerce_platform/wizard.rb
solidus_paypal_commerce_platform-1.0.0.beta1 app/models/solidus_paypal_commerce_platform/wizard.rb
solidus_paypal_commerce_platform-0.6.0 app/models/solidus_paypal_commerce_platform/wizard.rb
solidus_paypal_commerce_platform-0.5.0 app/models/solidus_paypal_commerce_platform/wizard.rb
solidus_paypal_commerce_platform-0.4.0 app/models/solidus_paypal_commerce_platform/wizard.rb