Sha256: 5bed399c49e9fb625deb60b1f199fcdd82fb7a56f1f6529a71e3bf961c4626e1
Contents?: true
Size: 827 Bytes
Versions: 4
Compression:
Stored size: 827 Bytes
Contents
module Spree module Api module V2 module Storefront class IntentsController < ::Spree::Api::V2::BaseController include Spree::Api::V2::Storefront::OrderConcern def handle_response if params['response']['error'] invalidate_payment render_error_payload(params['response']['error']['message']) else render_serialized_payload { { message: I18n.t('spree.payment_successfully_authorized') } } end end private def invalidate_payment payment = spree_current_order.payments.find_by!(response_code: params['response']['error']['payment_intent']['id']) payment.update(state: 'failed', intent_client_key: nil) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems