7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/generators/solidus_paypal_commerce_platform/install/templates/app/controllers/solidus_paypal_commerce_platform/wizard_controller.rb', line 7
def create
authorize! :create, ::Spree::PaymentMethod
@payment_method = ::Spree::PaymentMethod.new(payment_method_params)
if @payment_method.save
edit_url = spree.edit_admin_payment_method_url(@payment_method)
render(
json: { redirectUrl: edit_url },
status: :created,
location: edit_url,
notice: "The PayPal Commerce Platform payment method has been successfully created"
)
else
render json: @payment_method.errors, status: :unprocessable_entity
end
end
|