Skip to content

Commit

Permalink
Add IntentsController#create_payment action
Browse files Browse the repository at this point in the history
This action needs to be extracted in order to be called when creating
a Solidus Payment by the cart page checkout process.
  • Loading branch information
spaghetticode committed Apr 21, 2020
1 parent 9e0f6e7 commit 2d4f6af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/controllers/solidus_stripe/intents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ def confirm
generate_payment_response
end

def create_payment
SolidusStripe::CreateIntentsPaymentService.new(params[:stripe_payment_intent_id], stripe, self).call
render json: { success: true }
end

private

def stripe
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# payment intents routes:
post '/stripe/confirm_intents', to: '/solidus_stripe/intents#confirm'
post '/stripe/create_payment', to: '/solidus_stripe/intents#create_payment'

# payment request routes:
post '/stripe/shipping_rates', to: '/solidus_stripe/payment_request#shipping_rates'
Expand Down

0 comments on commit 2d4f6af

Please sign in to comment.