Sha256: 443da737979921a671df5d8ebbcd21c8b5702f0d1cf18042f65b96e7d7a4ca95
Contents?: true
Size: 1.09 KB
Versions: 32
Compression:
Stored size: 1.09 KB
Contents
module DiscoApp class ChargesController < ApplicationController include DiscoApp::AuthenticatedController skip_before_action :verify_status, only: [:create, :activate] # Display a "pre-charge" page, giving the opportunity to explain why a charge needs to be made. def new end # Create a new charge for the currently logged in shop, then redirect to the charge's confirmation URL. def create if (shopify_charge = DiscoApp::ChargesService.create(@shop)).nil? redirect_to action: :new and return end redirect_to shopify_charge.confirmation_url end # Attempt to activate a charge after a user has accepted or declined it. Redirect to the main application's root URL # immediately afterwards - if the charge wasn't accepted, the flow will start again. def activate if (shopify_charge = DiscoApp::ChargesService.get_accepted_charge(@shop, params[:charge_id])).nil? redirect_to action: :new and return end DiscoApp::ChargesService.activate(@shop, shopify_charge) redirect_to main_app.root_url end end end
Version data entries
32 entries across 32 versions & 1 rubygems