fluentcart-developer 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +2 -0
- package/CLAUDE.md +22 -0
- package/CONTRIBUTING.md +73 -0
- package/LICENSE +21 -0
- package/README.md +127 -0
- package/SKILL.md +127 -0
- package/bin/index.js +281 -0
- package/copy-skills.js +43 -0
- package/package.json +38 -0
- package/skills/fluentcart-developer/SKILL.md +172 -0
- package/skills/fluentcart-developer/examples/README.md +25 -0
- package/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/fluent-cart/checkout.php +32 -0
- package/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/functions.php +40 -0
- package/skills/fluentcart-developer/examples/sample-custom-addon/fluentcart-custom-addon.php +114 -0
- package/skills/fluentcart-developer/examples/sample-custom-payment-gateway/fluentcart-custom-gateway-example.php +149 -0
- package/skills/fluentcart-developer/examples/sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php +38 -0
- package/skills/fluentcart-developer/examples/sample-shipping-carrier/fluentcart-custom-shipping-carrier.php +62 -0
- package/skills/fluentcart-developer/references/action-hooks-admin-templates.md +787 -0
- package/skills/fluentcart-developer/references/action-hooks-cart-checkout.md +1355 -0
- package/skills/fluentcart-developer/references/action-hooks-customers-users.md +266 -0
- package/skills/fluentcart-developer/references/action-hooks-licenses.md +855 -0
- package/skills/fluentcart-developer/references/action-hooks-orders.md +631 -0
- package/skills/fluentcart-developer/references/action-hooks-payments-integrations.md +963 -0
- package/skills/fluentcart-developer/references/action-hooks-products-coupons.md +585 -0
- package/skills/fluentcart-developer/references/action-hooks-subscriptions.md +661 -0
- package/skills/fluentcart-developer/references/database-models-query-builder.md +194 -0
- package/skills/fluentcart-developer/references/database-models-reference.md +604 -0
- package/skills/fluentcart-developer/references/database-schema-reference.md +940 -0
- package/skills/fluentcart-developer/references/engineering-notes.md +154 -0
- package/skills/fluentcart-developer/references/fee-system-guide.md +449 -0
- package/skills/fluentcart-developer/references/filter-hooks-cart-checkout.md +1202 -0
- package/skills/fluentcart-developer/references/filter-hooks-customers-subscriptions.md +902 -0
- package/skills/fluentcart-developer/references/filter-hooks-integrations-advanced.md +1598 -0
- package/skills/fluentcart-developer/references/filter-hooks-orders-payments.md +1319 -0
- package/skills/fluentcart-developer/references/filter-hooks-products-pricing.md +628 -0
- package/skills/fluentcart-developer/references/filter-hooks-settings-configuration.md +1177 -0
- package/skills/fluentcart-developer/references/fluentcart-developer-guide.md +154 -0
- package/skills/fluentcart-developer/references/ghost-product-selling.md +458 -0
- package/skills/fluentcart-developer/references/modules-and-extensions-reference.md +224 -0
- package/skills/fluentcart-developer/references/paddle-gateway-case-study.md +1925 -0
- package/skills/fluentcart-developer/references/payment-gateway-integration.md +761 -0
- package/skills/fluentcart-developer/references/rest-api-checkout.md +286 -0
- package/skills/fluentcart-developer/references/rest-api-coupons.md +794 -0
- package/skills/fluentcart-developer/references/rest-api-customer-profile.md +190 -0
- package/skills/fluentcart-developer/references/rest-api-customers.md +1121 -0
- package/skills/fluentcart-developer/references/rest-api-dashboard-utilities.md +219 -0
- package/skills/fluentcart-developer/references/rest-api-email-notifications.md +619 -0
- package/skills/fluentcart-developer/references/rest-api-files.md +290 -0
- package/skills/fluentcart-developer/references/rest-api-integrations.md +324 -0
- package/skills/fluentcart-developer/references/rest-api-labels-attributes.md +321 -0
- package/skills/fluentcart-developer/references/rest-api-licensing.md +171 -0
- package/skills/fluentcart-developer/references/rest-api-order-bumps.md +200 -0
- package/skills/fluentcart-developer/references/rest-api-orders.md +1241 -0
- package/skills/fluentcart-developer/references/rest-api-overview.md +131 -0
- package/skills/fluentcart-developer/references/rest-api-products.md +2563 -0
- package/skills/fluentcart-developer/references/rest-api-public-shop.md +172 -0
- package/skills/fluentcart-developer/references/rest-api-reference.md +552 -0
- package/skills/fluentcart-developer/references/rest-api-reports.md +377 -0
- package/skills/fluentcart-developer/references/rest-api-roles-permissions.md +147 -0
- package/skills/fluentcart-developer/references/rest-api-settings.md +528 -0
- package/skills/fluentcart-developer/references/rest-api-shipping.md +800 -0
- package/skills/fluentcart-developer/references/rest-api-subscriptions.md +606 -0
- package/skills/fluentcart-developer/references/rest-api-tax.md +356 -0
- package/skills/fluentcart-developer/references/subscription-customization.md +197 -0
- package/skills/fluentcart-developer/scripts/cli.js +1 -0
- package/skills.sh.json +13 -0
package/copy-skills.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
|
|
5
|
+
function copyDir(src, dest) {
|
|
6
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
7
|
+
let entries = fs.readdirSync(src, { withFileTypes: true });
|
|
8
|
+
|
|
9
|
+
for (let entry of entries) {
|
|
10
|
+
let srcPath = path.join(src, entry.name);
|
|
11
|
+
let destPath = path.join(dest, entry.name);
|
|
12
|
+
|
|
13
|
+
if (entry.isDirectory()) {
|
|
14
|
+
copyDir(srcPath, destPath);
|
|
15
|
+
} else {
|
|
16
|
+
fs.copyFileSync(srcPath, destPath);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const packageRoot = __dirname;
|
|
22
|
+
const targetSkillDir = path.join(packageRoot, 'skills', 'fluentcart-developer');
|
|
23
|
+
const srcSkillMd = path.join(targetSkillDir, 'SKILL.md');
|
|
24
|
+
const srcReferences = path.join(targetSkillDir, 'references');
|
|
25
|
+
const srcExamples = path.join(targetSkillDir, 'examples');
|
|
26
|
+
|
|
27
|
+
const geminiGlobalSkillDir = path.join(os.homedir(), '.gemini', 'config', 'skills', 'fluentcart-developer');
|
|
28
|
+
|
|
29
|
+
console.log('Syncing skill files to global Gemini skills directory...');
|
|
30
|
+
try {
|
|
31
|
+
// Sync from skills/skills/fluentcart-developer to global Gemini skill dir
|
|
32
|
+
if (fs.existsSync(targetSkillDir)) {
|
|
33
|
+
fs.mkdirSync(geminiGlobalSkillDir, { recursive: true });
|
|
34
|
+
if (fs.existsSync(srcSkillMd)) fs.copyFileSync(srcSkillMd, path.join(geminiGlobalSkillDir, 'SKILL.md'));
|
|
35
|
+
if (fs.existsSync(srcReferences)) copyDir(srcReferences, path.join(geminiGlobalSkillDir, 'references'));
|
|
36
|
+
if (fs.existsSync(srcExamples)) copyDir(srcExamples, path.join(geminiGlobalSkillDir, 'examples'));
|
|
37
|
+
console.log('✓ Synced to global Gemini skills directory');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
console.log('✓ Build sync completed successfully!');
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.error('Error during build sync:', err.message);
|
|
43
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fluentcart-developer",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "CLI tool and developer knowledge base for FluentCart theme, plugin, shipping, and payment gateway development",
|
|
5
|
+
"main": "bin/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"fluentcart-developer": "bin/index.js",
|
|
8
|
+
"fluentcart-ai-skill": "bin/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "node copy-skills.js",
|
|
12
|
+
"prepublishOnly": "npm run build"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/atifjubaer/skills.git"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/atifjubaer/skills#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/atifjubaer/skills/issues"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"fluentcart-developer",
|
|
24
|
+
"fluentcart",
|
|
25
|
+
"wordpress",
|
|
26
|
+
"ai-skills",
|
|
27
|
+
"skills",
|
|
28
|
+
"antigravity",
|
|
29
|
+
"cursor",
|
|
30
|
+
"claude-code",
|
|
31
|
+
"windsurf",
|
|
32
|
+
"cline",
|
|
33
|
+
"zed",
|
|
34
|
+
"copilot"
|
|
35
|
+
],
|
|
36
|
+
"author": "Fastrsoft",
|
|
37
|
+
"license": "MIT"
|
|
38
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: FluentCart Developer
|
|
3
|
+
description: Comprehensive developer knowledge base for FluentCart e-commerce plugin development. Covers theme compatibility, template system, classic & block themes, action & filter hooks, Facebook Meta Pixel & GA4 tracking, Elementor, Gutenberg & Bricks integration, custom payment gateways, dynamic shipping carriers, database models, REST API, fee surcharges, ghost products, subscriptions, and WP-CLI.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# FluentCart Developer Skill
|
|
7
|
+
|
|
8
|
+
Complete technical reference, architectural manual, and AI guidance system for developing extensions, themes, custom payment gateways, shipping carriers, fee surcharges, REST API integrations, and hook listeners for **FluentCart**.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 🤖 AI Agent Execution Protocol & Routing Guidelines
|
|
13
|
+
|
|
14
|
+
When assisting a developer with FluentCart tasks, follow this step-by-step workflow:
|
|
15
|
+
|
|
16
|
+
### Step 1: Identify Task Scope & Domain
|
|
17
|
+
Determine which area of FluentCart the user's request touches:
|
|
18
|
+
- **Order Lifecycle & Payments:** Creating orders, handling refunds, checkout hooks, payment gateway integration.
|
|
19
|
+
- **Subscriptions & Recurring Revenue:** Subscription status transitions, renewals, grace periods, billing cycles.
|
|
20
|
+
- **Software Licensing (Pro):** License key generation, site activations/deactivations, update API.
|
|
21
|
+
- **Cart & Checkout:** Cart items, validation, custom items, custom fee surcharges, checkout form schema.
|
|
22
|
+
- **Database & Architecture:** Querying FluentCart tables (`wp_fct_*`), Eloquent models, relationships.
|
|
23
|
+
- **REST API:** Administrative endpoints, customer portal endpoints, external API consumption.
|
|
24
|
+
|
|
25
|
+
### Step 2: Read Target Reference File(s)
|
|
26
|
+
Do not guess hook names, parameter signatures, or schema columns. Open and inspect the dedicated reference file under `references/`:
|
|
27
|
+
|
|
28
|
+
#### Action Hooks (8 Modular Files)
|
|
29
|
+
- [action-hooks-orders.md](references/action-hooks-orders.md) — Order creation, paid/completion events, refunds, status transitions, shipping fulfillment.
|
|
30
|
+
- [action-hooks-subscriptions.md](references/action-hooks-subscriptions.md) — Subscription lifecycle, status changes, renewal processing, reminder notifications.
|
|
31
|
+
- [action-hooks-licenses.md](references/action-hooks-licenses.md) — Software license updates, site activations/deactivations, license keys (Pro).
|
|
32
|
+
- [action-hooks-cart-checkout.md](references/action-hooks-cart-checkout.md) — Shopping flow from cart item additions to checkout page and thank-you receipt rendering.
|
|
33
|
+
- [action-hooks-customers-users.md](references/action-hooks-customers-users.md) — Customer lifecycle, user registration, customer portal tab/section rendering.
|
|
34
|
+
- [action-hooks-products-coupons.md](references/action-hooks-products-coupons.md) — Product creation, duplication, single product and archive page hooks, coupon creation.
|
|
35
|
+
- [action-hooks-payments-integrations.md](references/action-hooks-payments-integrations.md) — Payment gateway webhooks (Stripe, PayPal, Mollie, Paddle), integration feeds, dev logging.
|
|
36
|
+
- [action-hooks-admin-templates.md](references/action-hooks-admin-templates.md) — Application boot (`fluentcart_loaded`), admin UI menus, block/email editor, shortcode views, REST policy checks.
|
|
37
|
+
|
|
38
|
+
#### Filter Hooks (6 Modular Files)
|
|
39
|
+
- [filter-hooks-settings-configuration.md](references/filter-hooks-settings-configuration.md) — Store settings defaults, currency options, translations, email notifications, admin menu items.
|
|
40
|
+
- [filter-hooks-orders-payments.md](references/filter-hooks-orders-payments.md) — Order/payment/shipping statuses, Stripe/PayPal/Mollie/Paddle gateway parameters, tax titles, invoice numbers.
|
|
41
|
+
- [filter-hooks-products-pricing.md](references/filter-hooks-products-pricing.md) — Product query builder (`shop_query`), variation display, button texts, stock availability, coupon validation.
|
|
42
|
+
- [filter-hooks-cart-checkout.md](references/filter-hooks-cart-checkout.md) — Cart item validation, fee items, estimated totals, checkout address fields, EU VAT/business rules.
|
|
43
|
+
- [filter-hooks-customers-subscriptions.md](references/filter-hooks-customers-subscriptions.md) — Customer portal tabs/endpoints, subscription statuses, grace periods, billing cycles, reminder schedules.
|
|
44
|
+
- [filter-hooks-integrations-advanced.md](references/filter-hooks-integrations-advanced.md) — Integration feeds, S3/local file storage, template paths, dashboard widgets, list filter queries, e-invoicing.
|
|
45
|
+
|
|
46
|
+
#### Core Architecture & System References
|
|
47
|
+
- [fluentcart-developer-guide.md](references/fluentcart-developer-guide.md) — Comprehensive developer guide, core concepts, codebase directory layout, and version comparison.
|
|
48
|
+
- [database-schema-reference.md](references/database-schema-reference.md) — Complete database schema for all `wp_fct_*` tables.
|
|
49
|
+
- [database-models-reference.md](references/database-models-reference.md) — FluentCart Eloquent Models, relationships, and scopes across Core and Pro modules.
|
|
50
|
+
- [database-models-query-builder.md](references/database-models-query-builder.md) — FluentCart ORM Query Builder usage, aggregates, CRUD operations, and comprehensive model map.
|
|
51
|
+
- [rest-api-reference.md](references/rest-api-reference.md) — Full REST API endpoints index, authentication, request/response formats.
|
|
52
|
+
- [rest-api-overview.md](references/rest-api-overview.md) — REST API getting started, authentication standards, module catalog, permission system (32 permissions across 4 roles), and error handling.
|
|
53
|
+
- [rest-api-orders.md](references/rest-api-orders.md) — Orders REST API (22 endpoints): CRUD, calculate shipping, bulk actions, refunds, customer reassignment, dispute handling, transactions.
|
|
54
|
+
- [rest-api-products.md](references/rest-api-products.md) — Products REST API (59 endpoints): CRUD, pricing, search/lookup, bulk operations, duplicate, bundle info, upgrade paths, inventory, downloadables, variations, integrations.
|
|
55
|
+
- [rest-api-customers.md](references/rest-api-customers.md) — Customers REST API (18 endpoints): CRUD, additional info (labels), bulk actions, order history, LTV recalculation, address management, WP user association.
|
|
56
|
+
- [rest-api-coupons.md](references/rest-api-coupons.md) — Coupons REST API (12 endpoints): CRUD, paginated listing, apply/cancel/reapply, product eligibility, checkout settings, Coupon model & DB table reference.
|
|
57
|
+
- [rest-api-subscriptions.md](references/rest-api-subscriptions.md) — Subscriptions REST API (17 endpoints): Admin lifecycle (cancel, remote fetch, early payment links), Customer Portal self-service (payment updates, gateway switching, auto-renew cancellation), status constants, and hooks.
|
|
58
|
+
- [rest-api-tax.md](references/rest-api-tax.md) — Tax REST API (26 endpoints): Tax filing, tax classes, country rates, shipping/product category overrides, global tax settings, and EU VAT / OSS cross-border compliance.
|
|
59
|
+
- [rest-api-shipping.md](references/rest-api-shipping.md) — Shipping REST API (15 endpoints, `store/sensitive` permission): Shipping zones (region reset side effects, reordering), shipping methods (`flat_rate`, `free_shipping`, `local_pickup`, state scoping), shipping classes (`fixed` & `percentage` costs, `per_item` flags), and data models.
|
|
60
|
+
- [rest-api-settings.md](references/rest-api-settings.md) — Settings REST API (30 endpoints, `StoreSettingsPolicy` & `is_super_admin`): Gateway setup (Stripe, PayPal connect, reordering, designs, addons), PayPal OAuth & webhooks, store configuration (`FluentMetaRequest`), module toggles, permissions, confirmation shortcodes, storage drivers (S3, Bunny, Local), and checkout fields.
|
|
61
|
+
- [rest-api-email-notifications.md](references/rest-api-email-notifications.md) — Email Notifications REST API (11 endpoints, `store/sensitive` permission): Email templates catalog (order, subscription, scheduler), single template editor shortcodes, template HTML previews (custom & default PHP), global email sender configuration, and automated scheduling reminders.
|
|
62
|
+
- [rest-api-reports.md](references/rest-api-reports.md) — Reports API (45 endpoints, `ReportPolicy` & `reports/view` permission): Standard report parameters, YoY revenue overview, sales growth, quick stats, revenue/orders by grouping dimensions, day/hour heatmap, top products/variants, refund analytics, software license metrics, subscription MRR & cohort retention matrices, Action Scheduler snapshot generation, and UTM source attribution.
|
|
63
|
+
- [rest-api-integrations.md](references/rest-api-integrations.md) — Integrations API (17 endpoints, `IntegrationPolicy` & `ProductPolicy`): Addon listings & WP.org auto-installer, global provider credentials, global integration feeds, list merge field mapping, dynamic options & chained inputs, product-level integration feeds (`conditional_variation_ids`), and status toggles.
|
|
64
|
+
- [rest-api-files.md](references/rest-api-files.md) — Files API (5 endpoints, `StoreSensitivePolicy` & `AdminPolicy`): Downloadable file CRUD across storage drivers (Local, S3, Bunny, R2), timestamp collision prevention (`name__fluent-cart__.timestamp.ext`), blocked extension filters (`fluent_cart/local_file_blocked_extensions`), storage bucket lists, and WP Media Library editor image uploads (`media_handle_upload`).
|
|
65
|
+
- [rest-api-labels-attributes.md](references/rest-api-labels-attributes.md) — Labels & Attributes API (13 endpoints, `LabelPolicy` & `ProductPolicy`): Polymorphic order/customer labels (`LabelRequest`, `update-label-selections`), variation attribute groups (`AttrGroupRequest`, deletion guards), and attribute terms (`AttrTermRequest`, serial ordering).
|
|
66
|
+
- [rest-api-dashboard-utilities.md](references/rest-api-dashboard-utilities.md) — Dashboard & Utilities API (20 endpoints): Onboarding checklist wizard, 30-day dashboard stats widgets, page generator (`CreatePageRequest`), admin SPA init (`/app/init`), activity log (`/activity`), order notes, print HTML templates (invoices & slips), dynamic widgets, country address locales, and advanced filter options.
|
|
67
|
+
- [rest-api-public-shop.md](references/rest-api-public-shop.md) — Public Shop API (3 endpoints, `PublicPolicy` unauthenticated): Public catalog product browsing with taxonomy/price filters (cents pricing in `detail`), server-rendered HTML grid views for Gutenberg blocks & shortcodes (`ProductListRenderer`, transient block caching), and live search autocomplete (`SearchBarRenderer`).
|
|
68
|
+
- [rest-api-checkout.md](references/rest-api-checkout.md) — Checkout API (7 endpoints, `PublicPolicy`): Order placement (`place-order`, rate limit 5 req/60s), gateway UI configuration (`get-order-info`), cart summary calculation with shipping (`get-checkout-summary-view`), shipping availability (`get-available-shipping-methods` & list view), country locale rules (`get-country-info`), and customer login (`/user/login` with `X-WP-Nonce`).
|
|
69
|
+
- [rest-api-customer-profile.md](references/rest-api-customer-profile.md) — Customer Profile API (18 endpoints, `CustomerFrontendPolicy` authenticated): Portal dashboard overview, profile details & password updates, checkout address selector (`fct_cart_hash`), portal address management (guards against deleting primary/last address), order history & UUID details, plan upgrade paths & prorations, transaction invoice billing address editing (`vat_tax_id`), and signed digital file downloads.
|
|
70
|
+
- [rest-api-licensing.md](references/rest-api-licensing.md) — Licensing API (22 endpoints, `LicensePolicy` & Pro required): Admin software license CRUD, key regeneration, validity extensions (`lifetime` or `YYYY-MM-DD`), per-product variation validity rules (disabled for bundles), customer portal self-service activations, site Pro plugin licensing, and non-REST public software update API (`/?fluent-cart={action}`) with 48-hour signed package download tokens & staging auto-detection.
|
|
71
|
+
- [rest-api-roles-permissions.md](references/rest-api-roles-permissions.md) — Roles & Permissions API (7 endpoints, `AdminPolicy` & Pro required): List managers, user search (excluding WP admins), role definitions (`super_admin`, `manager`, `worker`, `accountant`), role assignment sync (`fluent_cart_admin`), role deletion, and capability matrix filters (`fluent_cart/permission/all_roles`).
|
|
72
|
+
- [rest-api-order-bumps.md](references/rest-api-order-bumps.md) — Order Bumps API (5 endpoints, `OrderBumpPolicy` & `store/sensitive` & Pro required): Checkout order bump promotion CRUD (`fct_order_promotions` table), `product_variant` eager loading, discount configuration (`percentage` vs `fixed` in cents), priority ordering, and cart condition rules.
|
|
73
|
+
- [modules-and-extensions-reference.md](references/modules-and-extensions-reference.md) — Building payment gateways, shipping carriers, fee surcharges, ghost products.
|
|
74
|
+
- [engineering-notes.md](references/engineering-notes.md) — Architecture decisions, performance work, and production lessons from FluentCart's core engineering team.
|
|
75
|
+
|
|
76
|
+
#### Tutorials & Implementation Guides
|
|
77
|
+
- [fee-system-guide.md](references/fee-system-guide.md) — Fee system (surcharges & additional charges), dynamic fees via filter, persistent fees via Cart methods, complete tiered fee addon example.
|
|
78
|
+
- [ghost-product-selling.md](references/ghost-product-selling.md) — Ghost product selling, custom cart items, validation hooks, quantity changes, checkout validation, admin order updates, sample datasets.
|
|
79
|
+
- [payment-gateway-integration.md](references/payment-gateway-integration.md) — Payment Methods module architecture, custom gateway development (gateway class, settings, API, webhooks), registration, processing flow, testing.
|
|
80
|
+
- [paddle-gateway-case-study.md](references/paddle-gateway-case-study.md) — Paddle payment gateway case study, settings field schema, real-world gateway implementation example.
|
|
81
|
+
#### Runnable Code Examples & Project Boilerplates (`examples/`)
|
|
82
|
+
- [examples/README.md](examples/README.md) — Inventory and developer guide for ready-to-use sample plugins and templates.
|
|
83
|
+
- [sample-custom-addon/fluentcart-custom-addon.php](examples/sample-custom-addon/fluentcart-custom-addon.php) — Complete starter plugin with hook handlers, custom order meta, system logging, fee filters, and custom REST API endpoint.
|
|
84
|
+
- [sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php](examples/sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php) — Dynamic conditional fee surcharges (cents calculations, percentage payment surcharges).
|
|
85
|
+
- [sample-custom-payment-gateway/fluentcart-custom-gateway-example.php](examples/sample-custom-payment-gateway/fluentcart-custom-gateway-example.php) — Complete custom payment gateway implementation extending `AbstractPaymentGateway` and `BaseGatewaySettings`.
|
|
86
|
+
- [sample-shipping-carrier/fluentcart-custom-shipping-carrier.php](examples/sample-shipping-carrier/fluentcart-custom-shipping-carrier.php) — Dynamic shipping carrier calculation filter callback example.
|
|
87
|
+
- [fluentcart-starter-child-theme/](examples/fluentcart-starter-child-theme/) — Starter child theme with `add_theme_support('fluent_cart')` and template override structure.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 📜 Core Technical Rules & Conventions
|
|
92
|
+
|
|
93
|
+
### 1. Monetary Values & Currency Storage
|
|
94
|
+
- **ALWAYS store and calculate monetary values as integers in CENTS** (e.g. `$10.00` = `1000`, `$19.99` = `1999`).
|
|
95
|
+
- Convert decimal inputs to cents before saving: `\FluentCart\App\Helpers\Helper::toCent($decimalAmount)`.
|
|
96
|
+
- Format cents into decimal string for display: `\FluentCart\App\Helpers\Helper::toDecimal($amountInCents)`.
|
|
97
|
+
|
|
98
|
+
### 2. Code Commenting Standards
|
|
99
|
+
- **ALWAYS add meaningful single-line explanatory comments to PHP code snippets** (above/inside hook callbacks and helper calls) so developers can easily understand the logic.
|
|
100
|
+
|
|
101
|
+
### 3. Asynchronous Post-Payment Tasks
|
|
102
|
+
- **NEVER** perform blocking API calls (CRMs, webhooks, external emails) synchronously inside payment execution loops.
|
|
103
|
+
- Use `fluent_cart/order_paid_done` or Action Scheduler for asynchronous background processing.
|
|
104
|
+
|
|
105
|
+
### 4. Database Access
|
|
106
|
+
- Use FluentCart Eloquent Models (`\FluentCart\App\Models\*`) rather than raw `$wpdb` queries whenever possible.
|
|
107
|
+
|
|
108
|
+
### 5. IoC Container & Global Helpers
|
|
109
|
+
- Access container services: `\FluentCart\App\App::make('cart')` or `\FluentCart\App\App::getInstance()`.
|
|
110
|
+
- Store configuration: `\FluentCart\App\Helpers\Helper::getStoreSettings()`.
|
|
111
|
+
- Default store currency: `\FluentCart\App\Helpers\Helper::getCurrency()`.
|
|
112
|
+
- System logging: `fluent_cart_add_log($title, $content, $type)` (`'info'`, `'error'`, `'warning'`).
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## 🛠 Extension Code Templates
|
|
117
|
+
|
|
118
|
+
### 1. Extension Plugin Boilerplate
|
|
119
|
+
```php
|
|
120
|
+
<?php
|
|
121
|
+
/**
|
|
122
|
+
* Plugin Name: Custom FluentCart Addon
|
|
123
|
+
* Description: Custom extension for FluentCart.
|
|
124
|
+
* Version: 1.0.0
|
|
125
|
+
* Author: Developer
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
if (!defined('ABSPATH')) {
|
|
129
|
+
exit;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Guard execution until WordPress plugins are loaded and FluentCart is active
|
|
133
|
+
add_action('plugins_loaded', function () {
|
|
134
|
+
if (!defined('FLUENT_CART')) {
|
|
135
|
+
return; // FluentCart is not active
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Initialize custom hook listeners and extension logic
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 2. Surcharge / Extra Fee Filter Pattern
|
|
143
|
+
```php
|
|
144
|
+
// Add custom handling fee to cart estimated total
|
|
145
|
+
add_filter('fluent_cart/fee_items', function ($fees, $cart) {
|
|
146
|
+
// Append $5.00 handling fee (500 cents)
|
|
147
|
+
$fees[] = [
|
|
148
|
+
'id' => 'handling_fee',
|
|
149
|
+
'title' => __('Special Handling Fee', 'my-extension'),
|
|
150
|
+
'amount' => 500, // Amount in cents
|
|
151
|
+
'taxable' => false,
|
|
152
|
+
];
|
|
153
|
+
return $fees;
|
|
154
|
+
}, 10, 2);
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 3. Order Paid Event Listener Pattern
|
|
158
|
+
```php
|
|
159
|
+
// Listen for completed order payments to trigger post-payment processing
|
|
160
|
+
add_action('fluent_cart/order_paid_done', function ($data) {
|
|
161
|
+
// Extract order model and customer model instances from payload
|
|
162
|
+
$order = $data['order'];
|
|
163
|
+
$customer = $data['customer'];
|
|
164
|
+
|
|
165
|
+
// Log order completion event to FluentCart logs
|
|
166
|
+
fluent_cart_add_log(
|
|
167
|
+
'Order Completed',
|
|
168
|
+
'Processed order #' . $order->id . ' for customer ' . $customer->email,
|
|
169
|
+
'info'
|
|
170
|
+
);
|
|
171
|
+
}, 10, 1);
|
|
172
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# FluentCart Developer Examples & Boilerplates
|
|
2
|
+
|
|
3
|
+
This directory contains production-ready code examples, runnable plugins, and project templates for extending FluentCart.
|
|
4
|
+
|
|
5
|
+
## Available Examples
|
|
6
|
+
|
|
7
|
+
### 1. Custom Starter Addon Plugin (`sample-custom-addon/fluentcart-custom-addon.php`)
|
|
8
|
+
- Standalone WordPress plugin boilerplate for FluentCart.
|
|
9
|
+
- Features: Plugin initialization guards, `order_paid_done` event listener, system logging, dynamic fee surcharges, and a custom REST API endpoint (`/wp-json/fc-custom/v1/order-status/{id}`).
|
|
10
|
+
|
|
11
|
+
### 2. Fee & Surcharge Plugin (`sample-fee-surcharge-plugin/fluentcart-fee-surcharge.php`)
|
|
12
|
+
- Dynamic cart fee calculations using the `fluent_cart/fee_items` filter.
|
|
13
|
+
- Features: Conditional fixed fees (cents), percentage-based payment surcharges, and taxable flag settings.
|
|
14
|
+
|
|
15
|
+
### 3. Custom Payment Gateway Plugin (`sample-custom-payment-gateway/fluentcart-custom-gateway-example.php`)
|
|
16
|
+
- Demonstrates custom payment gateway development extending `AbstractPaymentGateway` and `BaseGatewaySettings`.
|
|
17
|
+
- Features: Gateway registration, settings schema, payment execution, error responses, and refund handling.
|
|
18
|
+
|
|
19
|
+
### 4. Custom Shipping Carrier (`sample-shipping-carrier/fluentcart-custom-shipping-carrier.php`)
|
|
20
|
+
- Dynamic shipping calculation via the `fluent_cart/shipping/methods` filter hook.
|
|
21
|
+
- Features: Rate calculation, free shipping thresholds, and real-time carrier response arrays.
|
|
22
|
+
|
|
23
|
+
### 5. Starter Child Theme (`fluentcart-starter-child-theme/`)
|
|
24
|
+
- Declarative `add_theme_support('fluent_cart')` child theme template.
|
|
25
|
+
- Features: Overriding checkout templates in `fluent-cart/checkout.php` and custom checkout hooks in `functions.php`.
|
package/skills/fluentcart-developer/examples/fluentcart-starter-child-theme/fluent-cart/checkout.php
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* FluentCart Custom Checkout Template Override Example
|
|
4
|
+
*
|
|
5
|
+
* Place this file inside your theme directory at:
|
|
6
|
+
* [your-theme]/fluent-cart/checkout.php
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
if (!defined('ABSPATH')) {
|
|
10
|
+
exit; // Prevent direct execution
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Trigger pre-checkout wrapper action hook
|
|
14
|
+
do_action('fluent_cart/checkout/before_container');
|
|
15
|
+
?>
|
|
16
|
+
|
|
17
|
+
<!-- Custom Theme Wrapper Container -->
|
|
18
|
+
<div class="fc-theme-checkout-container fc-custom-checkout-wrapper">
|
|
19
|
+
<div class="fc-checkout-header">
|
|
20
|
+
<h1><?php esc_html_e('Complete Your Order', 'fluentcart'); ?></h1>
|
|
21
|
+
<p><?php esc_html_e('Please enter your billing and shipping details below.', 'fluentcart'); ?></p>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<!-- Render Core FluentCart Checkout Shortcode App Instance -->
|
|
25
|
+
<div class="fc-checkout-app-box">
|
|
26
|
+
<?php echo do_shortcode('[fluent_cart_checkout]'); ?>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<?php
|
|
31
|
+
// Trigger post-checkout wrapper action hook
|
|
32
|
+
do_action('fluent_cart/checkout/after_container');
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Child Theme Functions for FluentCart Compatibility
|
|
4
|
+
*
|
|
5
|
+
* Theme Name: FluentCart Starter Child Theme
|
|
6
|
+
* Author: Fastrsoft
|
|
7
|
+
* License: MIT
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
if (!defined('ABSPATH')) {
|
|
11
|
+
exit; // Exit if accessed directly
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// 1. Declare FluentCart Theme Support in Child Theme
|
|
15
|
+
add_action('after_setup_theme', function() {
|
|
16
|
+
// Enables template overriding and page detection in FluentCart
|
|
17
|
+
add_theme_support('fluent_cart');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// 2. Enqueue Custom Child Theme & FluentCart Styling Assets
|
|
21
|
+
add_action('wp_enqueue_scripts', function() {
|
|
22
|
+
// Enqueue parent theme stylesheet
|
|
23
|
+
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
|
|
24
|
+
|
|
25
|
+
// Enqueue custom FluentCart store overrides stylesheet
|
|
26
|
+
wp_enqueue_style(
|
|
27
|
+
'fluentcart-child-custom',
|
|
28
|
+
get_stylesheet_directory_uri() . '/fluent-cart-custom.css',
|
|
29
|
+
['parent-style'],
|
|
30
|
+
'1.0.0'
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// 3. Example Hook: Inject Custom Notice above Checkout Form
|
|
35
|
+
add_action('fluent_cart/checkout/before_form', function() {
|
|
36
|
+
// Output custom customer guarantee banner on checkout page
|
|
37
|
+
echo '<div class="fluentcart-custom-notice" style="background:#eef6ff; border:1px solid #b6d4fe; padding:12px; margin-bottom:20px; border-radius:6px;">';
|
|
38
|
+
echo '🔒 <strong>100% Secure Checkout Guarantee:</strong> Your data is protected by 256-bit SSL encryption.';
|
|
39
|
+
echo '</div>';
|
|
40
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Name: FluentCart Custom Extension Starter
|
|
4
|
+
* Plugin URI: https://example.com/fluentcart-extension
|
|
5
|
+
* Description: Starter boilerplate plugin for building custom FluentCart extensions, hooks, and REST endpoints.
|
|
6
|
+
* Version: 1.0.0
|
|
7
|
+
* Author: Developer Team
|
|
8
|
+
* Text Domain: fc-custom-extension
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
if (!defined('ABSPATH')) {
|
|
12
|
+
exit; // Exit if accessed directly
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Initialize extension after WordPress plugins loaded and FluentCart active
|
|
16
|
+
add_action('plugins_loaded', function () {
|
|
17
|
+
// Check if FluentCart core plugin is active
|
|
18
|
+
if (!defined('FLUENT_CART')) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Register post-payment event listener
|
|
23
|
+
add_action('fluent_cart/order_paid_done', 'fc_custom_handle_order_paid', 10, 1);
|
|
24
|
+
|
|
25
|
+
// Register custom dynamic fee surcharge
|
|
26
|
+
add_filter('fluent_cart/fee_items', 'fc_custom_add_cart_handling_fee', 10, 2);
|
|
27
|
+
|
|
28
|
+
// Register custom REST API route
|
|
29
|
+
add_action('rest_api_init', 'fc_custom_register_rest_routes');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Process order completion asynchronously
|
|
34
|
+
*
|
|
35
|
+
* @param array $data Contains 'order' and 'customer' models
|
|
36
|
+
*/
|
|
37
|
+
function fc_custom_handle_order_paid($data) {
|
|
38
|
+
// Extract Order model instance from payload
|
|
39
|
+
$order = $data['order'];
|
|
40
|
+
|
|
41
|
+
// Extract Customer model instance from payload
|
|
42
|
+
$customer = $data['customer'];
|
|
43
|
+
|
|
44
|
+
// Save custom processing flag into order metadata
|
|
45
|
+
$order->updateMeta('custom_processed_at', current_time('mysql'));
|
|
46
|
+
|
|
47
|
+
// Log order completion event in FluentCart system log
|
|
48
|
+
fluent_cart_add_log(
|
|
49
|
+
'Custom Addon Event',
|
|
50
|
+
'Successfully processed order #' . $order->id . ' for ' . $customer->email,
|
|
51
|
+
'info'
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Add custom handling fee ($5.00 = 500 cents) to checkout cart
|
|
57
|
+
*
|
|
58
|
+
* @param array $fees Existing cart fee items
|
|
59
|
+
* @param object $cart Active Cart instance
|
|
60
|
+
* @return array Updated fees array
|
|
61
|
+
*/
|
|
62
|
+
function fc_custom_add_cart_handling_fee($fees, $cart) {
|
|
63
|
+
// Append $5.00 handling fee (500 cents)
|
|
64
|
+
$fees[] = [
|
|
65
|
+
'id' => 'express_handling',
|
|
66
|
+
'title' => __('Express Order Processing Fee', 'fc-custom-extension'),
|
|
67
|
+
'amount' => 500, // Monetary values stored as integer cents ($5.00 = 500)
|
|
68
|
+
'taxable' => false,
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
return $fees;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Register custom REST API endpoint for third-party extensions
|
|
76
|
+
*/
|
|
77
|
+
function fc_custom_register_rest_routes() {
|
|
78
|
+
register_rest_route('fc-custom/v1', '/order-status/(?P<id>\d+)', [
|
|
79
|
+
'methods' => 'GET',
|
|
80
|
+
'callback' => 'fc_custom_get_order_status',
|
|
81
|
+
'permission_callback' => function () {
|
|
82
|
+
// Restrict endpoint to store managers
|
|
83
|
+
return current_user_can('fluent_cart_admin');
|
|
84
|
+
},
|
|
85
|
+
]);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* REST Endpoint Callback: Retrieve custom order status
|
|
90
|
+
*
|
|
91
|
+
* @param WP_REST_Request $request
|
|
92
|
+
* @return WP_REST_Response
|
|
93
|
+
*/
|
|
94
|
+
function fc_custom_get_order_status($request) {
|
|
95
|
+
// Extract order ID parameter from request
|
|
96
|
+
$orderId = $request->get_param('id');
|
|
97
|
+
|
|
98
|
+
// Retrieve order record using FluentCart Eloquent Model
|
|
99
|
+
$order = \FluentCart\App\Models\Order::find($orderId);
|
|
100
|
+
|
|
101
|
+
// Return 404 response if order not found
|
|
102
|
+
if (!$order) {
|
|
103
|
+
return new WP_REST_Response(['message' => 'Order not found'], 404);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Return structured order status response
|
|
107
|
+
return new WP_REST_Response([
|
|
108
|
+
'order_id' => $order->id,
|
|
109
|
+
'status' => $order->status,
|
|
110
|
+
'payment_status' => $order->payment_status,
|
|
111
|
+
'total_amount' => $order->total_amount, // Returned in cents
|
|
112
|
+
'processed_at' => $order->getMeta('custom_processed_at', 'N/A'),
|
|
113
|
+
], 200);
|
|
114
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Name: FluentCart Custom Payment Gateway Example
|
|
4
|
+
* Plugin URI: https://github.com/atifjubaer/skills
|
|
5
|
+
* Description: Production-ready starter template for creating a custom FluentCart payment gateway extension.
|
|
6
|
+
* Version: 1.0.0
|
|
7
|
+
* Author: Fastrsoft
|
|
8
|
+
* License: MIT
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
if (!defined('ABSPATH')) {
|
|
12
|
+
exit; // Exit if accessed directly
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Register custom payment gateway after FluentCart initializes
|
|
16
|
+
add_action('fluent_cart/loaded', function() {
|
|
17
|
+
if (!class_exists('\FluentCart\App\Modules\PaymentMethods\Core\AbstractPaymentGateway')) {
|
|
18
|
+
return; // Return early if FluentCart core payment gateway abstract class is missing
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Register our custom gateway slug and implementation class via filter
|
|
22
|
+
add_filter('fluent_cart/payment_gateways', function($gateways) {
|
|
23
|
+
$gateways['sample_gateway'] = \FluentCartCustomGatewayExample\SampleGateway::class;
|
|
24
|
+
return $gateways;
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
namespace FluentCartCustomGatewayExample;
|
|
29
|
+
|
|
30
|
+
use FluentCart\App\Modules\PaymentMethods\Core\AbstractPaymentGateway;
|
|
31
|
+
use FluentCart\App\Modules\PaymentMethods\Core\BaseGatewaySettings;
|
|
32
|
+
use FluentCart\App\Models\Order;
|
|
33
|
+
|
|
34
|
+
// Custom Gateway Implementation Class
|
|
35
|
+
class SampleGateway extends AbstractPaymentGateway
|
|
36
|
+
{
|
|
37
|
+
// Unique identifier slug for this payment gateway
|
|
38
|
+
public function getSlug(): string
|
|
39
|
+
{
|
|
40
|
+
return 'sample_gateway';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Display title of payment gateway in admin and checkout
|
|
44
|
+
public function getTitle(): string
|
|
45
|
+
{
|
|
46
|
+
return __('Sample Payment Gateway', 'fluentcart');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Icon URL or class for checkout payment method selector
|
|
50
|
+
public function getIcon(): string
|
|
51
|
+
{
|
|
52
|
+
return plugin_dir_url(__FILE__) . 'assets/icon.png';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Process customer charge during checkout submission
|
|
56
|
+
public function makePayment(array $data, Order $order): array
|
|
57
|
+
{
|
|
58
|
+
// Sanitize payment token or transaction input from customer
|
|
59
|
+
$paymentToken = sanitize_text_field($data['payment_token'] ?? '');
|
|
60
|
+
|
|
61
|
+
// Fetch configured API credentials from gateway settings
|
|
62
|
+
$apiKey = $this->getSetting('api_key');
|
|
63
|
+
$isSandbox = $this->getSetting('test_mode') === 'yes';
|
|
64
|
+
|
|
65
|
+
// Perform external API call to process payment transaction
|
|
66
|
+
// Example mock API response handling:
|
|
67
|
+
$success = !empty($paymentToken) || $isSandbox;
|
|
68
|
+
|
|
69
|
+
if ($success) {
|
|
70
|
+
// Generate mock transaction ID for demonstration
|
|
71
|
+
$transactionId = 'tx_sample_' . time() . '_' . rand(1000, 9999);
|
|
72
|
+
|
|
73
|
+
// Record transaction details in FluentCart order record
|
|
74
|
+
$this->addPaymentNote($order, sprintf(__('Payment processed via Sample Gateway. Transaction ID: %s', 'fluentcart'), $transactionId));
|
|
75
|
+
|
|
76
|
+
// Return success payload containing redirect URL or receipt details
|
|
77
|
+
return [
|
|
78
|
+
'status' => 'success',
|
|
79
|
+
'transaction_id' => $transactionId,
|
|
80
|
+
'redirect_url' => $this->getReturnUrl($order),
|
|
81
|
+
'message' => __('Payment successful!', 'fluentcart')
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Return error payload if payment authorization failed
|
|
86
|
+
return [
|
|
87
|
+
'status' => 'error',
|
|
88
|
+
'message' => __('Payment failed. Please check your card details and try again.', 'fluentcart')
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Handle partial or full refund execution from FluentCart admin
|
|
93
|
+
public function refund(Order $order, float $amount, string $reason = ''): array
|
|
94
|
+
{
|
|
95
|
+
// Get original transaction ID attached to order
|
|
96
|
+
$transactionId = $order->transaction_id;
|
|
97
|
+
|
|
98
|
+
// Perform API request to refund payment gateway provider
|
|
99
|
+
// Example mock refund success return:
|
|
100
|
+
$refundId = 'ref_sample_' . time();
|
|
101
|
+
|
|
102
|
+
// Log refund note in FluentCart order notes
|
|
103
|
+
$this->addPaymentNote($order, sprintf(__('Refund of %s processed. Refund ID: %s. Reason: %s', 'fluentcart'), $amount, $refundId, $reason));
|
|
104
|
+
|
|
105
|
+
return [
|
|
106
|
+
'status' => 'success',
|
|
107
|
+
'refund_id' => $refundId,
|
|
108
|
+
'amount' => $amount,
|
|
109
|
+
'message' => __('Refund issued successfully', 'fluentcart')
|
|
110
|
+
];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Return admin settings schema class instance
|
|
114
|
+
public function getSettingsClass(): string
|
|
115
|
+
{
|
|
116
|
+
return SampleGatewaySettings::class;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Admin Settings Configuration Class
|
|
121
|
+
class SampleGatewaySettings extends BaseGatewaySettings
|
|
122
|
+
{
|
|
123
|
+
// Render settings schema fields for FluentCart Payment Settings panel
|
|
124
|
+
public function getFields(): array
|
|
125
|
+
{
|
|
126
|
+
return [
|
|
127
|
+
'enabled' => [
|
|
128
|
+
'type' => 'checkbox',
|
|
129
|
+
'label' => __('Enable Sample Gateway', 'fluentcart'),
|
|
130
|
+
'default' => 'no'
|
|
131
|
+
],
|
|
132
|
+
'title' => [
|
|
133
|
+
'type' => 'text',
|
|
134
|
+
'label' => __('Method Title', 'fluentcart'),
|
|
135
|
+
'default' => __('Sample Gateway', 'fluentcart')
|
|
136
|
+
],
|
|
137
|
+
'test_mode' => [
|
|
138
|
+
'type' => 'checkbox',
|
|
139
|
+
'label' => __('Sandbox / Test Mode', 'fluentcart'),
|
|
140
|
+
'default' => 'yes'
|
|
141
|
+
],
|
|
142
|
+
'api_key' => [
|
|
143
|
+
'type' => 'password',
|
|
144
|
+
'label' => __('API Key', 'fluentcart'),
|
|
145
|
+
'description' => __('Enter your API key provided by the payment gateway dashboard.', 'fluentcart')
|
|
146
|
+
]
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
}
|