Class: Vpago::AcledaMiniApp::Session::Create
- Inherits:
-
Object
- Object
- Vpago::AcledaMiniApp::Session::Create
- Includes:
- Spree::ServiceModule::Base
- Defined in:
- app/services/vpago/acleda_mini_app/session/create.rb
Overview
Partner Session Initialization (ACLEDA Mini App Integration Spec, Step 01).
ACLEDA calls POST /miniapp/acleda with { phone, first_name, last_name }. We find or create the customer (tagged with the acleda_bank identity), mint a session JWT, and return a session-based miniAppUrl for ACLEDA to open in the WebView. The generic session_id OAuth grant validates the JWT when the WebView later authenticates.
Instance Method Summary collapse
Instance Method Details
#call(phone: nil, first_name: nil, last_name: nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/services/vpago/acleda_mini_app/session/create.rb', line 14 def call(phone: nil, first_name: nil, last_name: nil) return failure(nil, 'phone is required') if phone.blank? @phone = phone @first_name = first_name @last_name = last_name user = find_or_create_user return failure(user, 'user creation failed') if user.nil? || !user.persisted? success(mini_app_url: mini_app_url(user)) end |