PaymentsTable.php
65 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @copyright © TMS-Plugins. All rights reserved. |
| 4 | * @licence See LICENCE.md for license details. |
| 5 | */ |
| 6 | |
| 7 | namespace AmeliaBooking\Infrastructure\WP\InstallActions\DB\Payment; |
| 8 | |
| 9 | use AmeliaBooking\Domain\Common\Exceptions\InvalidArgumentException; |
| 10 | use AmeliaBooking\Infrastructure\WP\InstallActions\DB\AbstractDatabaseTable; |
| 11 | |
| 12 | /** |
| 13 | * Class PaymentsTable |
| 14 | * |
| 15 | * @package AmeliaBooking\Infrastructure\WP\InstallActions\DB\Payment |
| 16 | */ |
| 17 | class PaymentsTable extends AbstractDatabaseTable |
| 18 | { |
| 19 | |
| 20 | const TABLE = 'payments'; |
| 21 | |
| 22 | /** |
| 23 | * @return string |
| 24 | * @throws InvalidArgumentException |
| 25 | */ |
| 26 | public static function buildTable() |
| 27 | { |
| 28 | $table = self::getTableName(); |
| 29 | |
| 30 | return "CREATE TABLE {$table} ( |
| 31 | `id` int(11) NOT NULL AUTO_INCREMENT, |
| 32 | `customerBookingId` int(11) NULL, |
| 33 | `amount` DOUBLE NOT NULL default 0, |
| 34 | `dateTime` datetime NULL, |
| 35 | `status` ENUM('paid', 'pending', 'partiallyPaid', 'refunded') NOT NULL, |
| 36 | `gateway` ENUM('onSite', 'payPal', 'stripe', 'wc', 'mollie', 'razorpay', 'square') NOT NULL, |
| 37 | `gatewayTitle` varchar(255) NULL, |
| 38 | `data` text NULL, |
| 39 | `packageCustomerId` int(11) NULL, |
| 40 | `parentId` int(11) DEFAULT NULL, |
| 41 | `entity` ENUM('appointment', 'event', 'package') NULL, |
| 42 | `created` DATETIME NULL, |
| 43 | `actionsCompleted` TINYINT(1) NULL, |
| 44 | `triggeredActions` TINYINT(1) NULL, |
| 45 | `wcOrderId` bigint(20) NULL, |
| 46 | `wcOrderItemId` bigint(20) NULL, |
| 47 | `transactionId` varchar(255) NULL, |
| 48 | `transfers` text NULL, |
| 49 | `invoiceNumber` int(11) NULL, |
| 50 | PRIMARY KEY (`id`) |
| 51 | ) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci"; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * @return array |
| 56 | * @throws InvalidArgumentException |
| 57 | */ |
| 58 | public static function alterTable() |
| 59 | { |
| 60 | $table = self::getTableName(); |
| 61 | |
| 62 | return ["ALTER TABLE {$table} MODIFY customerBookingId INT(11) NULL"]; |
| 63 | } |
| 64 | } |
| 65 |