Class: Spree::Api::V3::Store::Customer::PaymentSetupSessionsController
- Inherits:
-
ResourceController
- Object
- ActionController::API
- BaseController
- ResourceController
- ResourceController
- Spree::Api::V3::Store::Customer::PaymentSetupSessionsController
- Defined in:
- app/controllers/spree/api/v3/store/customer/payment_setup_sessions_controller.rb
Constant Summary
Constants inherited from BaseController
BaseController::RATE_LIMIT_RESPONSE
Constants included from Idempotent
Idempotent::IDEMPOTENCY_HEADER, Idempotent::IDEMPOTENCY_TTL, Idempotent::MAX_KEY_LENGTH, Idempotent::MUTATING_METHODS
Constants included from ErrorHandler
Constants included from JwtAuthentication
JwtAuthentication::JWT_AUDIENCE_ADMIN, JwtAuthentication::JWT_AUDIENCE_STORE, JwtAuthentication::JWT_ISSUER, JwtAuthentication::USER_TYPE_ADMIN, JwtAuthentication::USER_TYPE_CUSTOMER
Instance Method Summary collapse
-
#complete ⇒ Object
PATCH /api/v3/store/customer/payment_setup_sessions/:id/complete.
-
#create ⇒ Object
POST /api/v3/store/customer/payment_setup_sessions.
-
#show ⇒ Object
GET /api/v3/store/customer/payment_setup_sessions/:id.
Methods inherited from ResourceController
Methods included from ApiKeyAuthentication
#authenticate_api_key!, #authenticate_secret_key!
Methods included from JwtAuthentication
#authenticate_user, #require_authentication!
Instance Method Details
#complete ⇒ Object
PATCH /api/v3/store/customer/payment_setup_sessions/:id/complete
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/spree/api/v3/store/customer/payment_setup_sessions_controller.rb', line 34 def complete @payment_setup_session.payment_method.complete_payment_setup_session( setup_session: @payment_setup_session, params: complete_params ) if @payment_setup_session.errors.empty? render json: serialize_resource(@payment_setup_session.reload) else render_errors(@payment_setup_session.errors) end end |
#create ⇒ Object
POST /api/v3/store/customer/payment_setup_sessions
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/spree/api/v3/store/customer/payment_setup_sessions_controller.rb', line 13 def create payment_method = current_store.payment_methods.find_by_prefix_id!(permitted_params[:payment_method_id]) @payment_setup_session = payment_method.create_payment_setup_session( customer: current_user, external_data: permitted_params[:external_data] || {} ) if @payment_setup_session.persisted? render json: serialize_resource(@payment_setup_session), status: :created else render_errors(@payment_setup_session.errors) end end |
#show ⇒ Object
GET /api/v3/store/customer/payment_setup_sessions/:id
29 30 31 |
# File 'app/controllers/spree/api/v3/store/customer/payment_setup_sessions_controller.rb', line 29 def show render json: serialize_resource(@payment_setup_session) end |