Sha256: d763effb65c1f44a3536c9d56665a58d66cd0e6c6b80c1058245e3e66dc03b43
Contents?: true
Size: 1.87 KB
Versions: 4
Compression:
Stored size: 1.87 KB
Contents
# frozen_string_literal: true require 'deface' require 'solidus_core' require 'solidus_paypal_commerce_platform' require 'solidus_webhooks' require 'solidus_support' module SolidusPaypalCommercePlatform class Engine < Rails::Engine include SolidusSupport::EngineExtensions isolate_namespace SolidusPaypalCommercePlatform engine_name 'solidus_paypal_commerce_platform' initializer "solidus_paypal_commerce_platform.add_payment_method", after: "spree.register.payment_methods" do |app| app.config.to_prepare do app.config.spree.payment_methods << SolidusPaypalCommercePlatform::PaymentMethod unless SolidusPaypalCommercePlatform::PaymentMethod.allowed_admin_form_preference_types.include?(:paypal_select) SolidusPaypalCommercePlatform::PaymentMethod.allowed_admin_form_preference_types << :paypal_select end old_source_attributes = ::Spree::PermittedAttributes.source_attributes new_source_attributes = [:paypal_order_id, :authorization_id, :paypal_email, :paypal_funding_source] ::Spree::PermittedAttributes.source_attributes.concat(new_source_attributes - old_source_attributes) end end initializer "solidus_paypal_commerce_platform.add_wizard", after: "spree.register.payment_methods" do |app| # Adding the class set below - if this is ported to core, we can remove this line. Spree::Core::Environment.add_class_set("payment_setup_wizards") app.config.spree.payment_setup_wizards << "SolidusPaypalCommercePlatform::Wizard" end initializer "solidus_paypal_commerce_platform.webhooks" do SolidusWebhooks.config.register_webhook_handler :solidus_paypal_commerce_platform, ->(payload) { SolidusPaypalCommercePlatform::WebhooksJob.perform_now(payload) } end # use rspec for tests config.generators do |g| g.test_framework :rspec end end end
Version data entries
4 entries across 4 versions & 1 rubygems