feat: Implement OAuth license activation flow
- Add LicenseConnect.tsx focused OAuth confirmation page in customer SPA - Add /licenses/oauth/validate and /licenses/oauth/confirm API endpoints - Update App.tsx to render license-connect outside BaseLayout (no header/footer) - Add license_activation_method field to product settings in Admin SPA - Create LICENSING_MODULE.md with comprehensive OAuth flow documentation - Update API_ROUTES.md with license module endpoints
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace WooNooW\Frontend;
|
||||
|
||||
use WP_REST_Request;
|
||||
@@ -79,7 +80,8 @@ class CartController
|
||||
'methods' => 'POST',
|
||||
'callback' => [__CLASS__, 'update_cart'],
|
||||
'permission_callback' => function () {
|
||||
return true; },
|
||||
return true;
|
||||
},
|
||||
'args' => [
|
||||
'cart_item_key' => [
|
||||
'required' => true,
|
||||
@@ -97,7 +99,8 @@ class CartController
|
||||
'methods' => 'POST',
|
||||
'callback' => [__CLASS__, 'remove_from_cart'],
|
||||
'permission_callback' => function () {
|
||||
return true; },
|
||||
return true;
|
||||
},
|
||||
'args' => [
|
||||
'cart_item_key' => [
|
||||
'required' => true,
|
||||
@@ -111,7 +114,8 @@ class CartController
|
||||
'methods' => 'POST',
|
||||
'callback' => [__CLASS__, 'apply_coupon'],
|
||||
'permission_callback' => function () {
|
||||
return true; },
|
||||
return true;
|
||||
},
|
||||
'args' => [
|
||||
'coupon_code' => [
|
||||
'required' => true,
|
||||
@@ -125,7 +129,8 @@ class CartController
|
||||
'methods' => 'POST',
|
||||
'callback' => [__CLASS__, 'clear_cart'],
|
||||
'permission_callback' => function () {
|
||||
return true; },
|
||||
return true;
|
||||
},
|
||||
]);
|
||||
|
||||
// Remove coupon
|
||||
@@ -133,7 +138,8 @@ class CartController
|
||||
'methods' => 'POST',
|
||||
'callback' => [__CLASS__, 'remove_coupon'],
|
||||
'permission_callback' => function () {
|
||||
return true; },
|
||||
return true;
|
||||
},
|
||||
'args' => [
|
||||
'coupon_code' => [
|
||||
'required' => true,
|
||||
@@ -227,6 +233,12 @@ class CartController
|
||||
|
||||
if (!empty($value)) {
|
||||
$variation_attributes[$meta_key] = $value;
|
||||
} else {
|
||||
// Value is empty ("Any" variation) - check if frontend sent value in 'variation' param
|
||||
$frontend_variation = $request->get_param('variation');
|
||||
if (is_array($frontend_variation) && isset($frontend_variation[$meta_key]) && !empty($frontend_variation[$meta_key])) {
|
||||
$variation_attributes[$meta_key] = sanitize_text_field($frontend_variation[$meta_key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user