Exception: Spree::PaymentRedirectRequired

Inherits:
Exception
  • Object
show all
Defined in:
lib/spree/payment_redirect_required.rb

Overview

3DS認証リダイレクトが必要な場合に投げる例外 StandardErrorではなくExceptionから継承することで、 state_machineのrescue StandardErrorをバイパスする

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(redirect_url, payment: nil, gmo_pg_data: nil) ⇒ PaymentRedirectRequired

Returns a new instance of PaymentRedirectRequired.

Parameters:

  • redirect_url (String)

    3DS認証のリダイレクト先URL

  • payment (Spree::Payment) (defaults to: nil)

    対象の決済

  • gmo_pg_data (Hash) (defaults to: nil)

    コールバックでの再処理に必要な access_id / access_pass 等 この例外は process_payments! の with_lock トランザクション内で raise されるため、 そこで metadata を save してもロールバックで消えてしまう。トランザクション外 (CheckoutController の rescue)で永続化できるよう、必要情報を例外に積んで渡す。



16
17
18
19
20
21
# File 'lib/spree/payment_redirect_required.rb', line 16

def initialize(redirect_url, payment: nil, gmo_pg_data: nil)
  @redirect_url = redirect_url
  @payment = payment
  @gmo_pg_data = gmo_pg_data
  super("Payment redirect required: #{redirect_url}")
end

Instance Attribute Details

#gmo_pg_dataObject (readonly)

Returns the value of attribute gmo_pg_data.



8
9
10
# File 'lib/spree/payment_redirect_required.rb', line 8

def gmo_pg_data
  @gmo_pg_data
end

#paymentObject (readonly)

Returns the value of attribute payment.



8
9
10
# File 'lib/spree/payment_redirect_required.rb', line 8

def payment
  @payment
end

#redirect_urlObject (readonly)

Returns the value of attribute redirect_url.



8
9
10
# File 'lib/spree/payment_redirect_required.rb', line 8

def redirect_url
  @redirect_url
end