Class: Spree::Api::V2::Storefront::PinCodeOtpCheckersController

Inherits:
ResourceController
  • Object
show all
Defined in:
app/controllers/spree/api/v2/storefront/pin_code_otp_checkers_controller.rb

Instance Method Summary collapse

Instance Method Details

#updateObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/spree/api/v2/storefront/pin_code_otp_checkers_controller.rb', line 6

def update
  options = otp_attrs
  options[:type] = 'SpreeCmCommissioner::PinCodeOtp'
  options[:long_life_pin_code] = true

  context = SpreeCmCommissioner::PinCodeChecker.call(options)
  if context.success?
    render_serialized_payload { { status: 'ok' } }
  else
    render_error_payload(context.message, 400)
  end
end