PluginProbe
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More / 2.2.0
StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More v2.2.0
2.3.0 2.2.0 2.1.1 2.1.0 2.0.0 1.10.0 1.9.1 1.9.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 All 59 releases
storeengine / includes / database / create-payouts.php

create-payouts.php in StoreEngine — Complete eCommerce Solution with Memberships, Licensing, Affiliates & More 2.2.0, at includes/database/create-payouts.php

39 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace StoreEngine\Database;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 /**
9 * Unified payouts ledger — used by every addon that pays a person
10 * (affiliates, vendors, future supplier reimbursements, instructors, …).
11 * The `payee_type` discriminator + `payee_id` column lets each addon
12 * read/write its own slice without needing its own table.
13 */
14 class CreatePayouts {
15
16 public static function up( $prefix, $charset_collate ) {
17 $table_name = $prefix . 'storeengine_payouts';
18 $sql = "CREATE TABLE IF NOT EXISTS {$table_name} (
19 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
20 `payee_type` VARCHAR(40) NOT NULL,
21 `payee_id` BIGINT(20) UNSIGNED NOT NULL,
22 `amount` DECIMAL(12,2) NOT NULL DEFAULT 0,
23 `payment_method` VARCHAR(40) DEFAULT NULL,
24 `reference` VARCHAR(255) NOT NULL DEFAULT '',
25 `status` VARCHAR(20) NOT NULL DEFAULT 'pending',
26 `notes` TEXT NULL,
27 `meta_json` LONGTEXT NULL,
28 `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
29 `paid_at` DATETIME NULL,
30 PRIMARY KEY (`id`),
31 KEY `payee` (`payee_type`, `payee_id`),
32 KEY `status` (`status`),
33 KEY `created_at` (`created_at`)
34 ) $charset_collate;";
35
36 dbDelta( $sql );
37 }
38 }
39