diff --git a/app/Plugins/MailchimpPlugin/Entities/Subscription.php b/app/Plugins/MailchimpPlugin/Entities/Subscription.php deleted file mode 100644 index 9eff0e40c..000000000 --- a/app/Plugins/MailchimpPlugin/Entities/Subscription.php +++ /dev/null @@ -1,34 +0,0 @@ - 'integer', - 'mailchimp_id' => 'string', - 'status_id' => 'enum[App\Plugins\MailchimpPlugin\Enums\SubscriptionStatus]', - 'created_at' => 'datetime', - 'updated_at' => '?datetime', - 'deleted_at' => '?datetime' - ]; - - protected $attributes = [ - 'customer_id' => null, // ospos_customers.person_id - 'mailchimp_id' => null, // MD5 hash of the lowercase version of the list member's email address - 'status_id' => null, // ospos_mailchimpplugin_subscription_status.status_id - 'created_at' => null, // Timestamp of when the subscription was created - 'updated_at' => null, // Timestamp of when the subscription was last updated - 'deleted_at' => null // Timestamp of when the subscription was deleted - ]; - - public function setMailchimpId(string $email) - { - $this->attributes['mailchimp_id'] = md5(strtolower($email)); - - return $this; - } -} diff --git a/app/Plugins/MailchimpPlugin/MailchimpPlugin.php b/app/Plugins/MailchimpPlugin/MailchimpPlugin.php index 8412c0581..34c75031c 100644 --- a/app/Plugins/MailchimpPlugin/MailchimpPlugin.php +++ b/app/Plugins/MailchimpPlugin/MailchimpPlugin.php @@ -4,8 +4,10 @@ namespace App\Plugins\MailchimpPlugin; use App\Libraries\Plugins\BasePlugin; use App\Plugins\MailchimpPlugin\Libraries\MailchimpLibrary; +use CodeIgniter\Database\RawSql; use CodeIgniter\Events\Events; use CodeIgniter\HTTP\ResponseInterface; +use Config\Database; use Config\Services; use stdClass; @@ -69,6 +71,7 @@ class MailchimpPlugin extends BasePlugin public function uninstall(): bool { log_message('info', 'Uninstalling Mailchimp plugin'); + return true; } diff --git a/app/Plugins/MailchimpPlugin/Models/SubscriptionModel.php b/app/Plugins/MailchimpPlugin/Models/SubscriptionModel.php deleted file mode 100644 index 491422a62..000000000 --- a/app/Plugins/MailchimpPlugin/Models/SubscriptionModel.php +++ /dev/null @@ -1,49 +0,0 @@ -save($customerData)) { - return $customerData[$this->primaryKey] ?? $this->getInsertID(); - } - } catch (ReflectionException $e) { - log_message('error', 'Subscription upsert failed: ' . $e->getMessage()); - } - return false; - } - - public function exists(?int $customerId): bool - { - if (!is_int($customerId) || $customerId < 1) { - return false; - } - - $builder = $this->db->table($this->table); - $builder->where('customer_id', $customerId); - - return ($builder->countAllResults() === 1); - } -} diff --git a/app/Plugins/MailchimpPlugin/Models/SubscriptionStatusModel.php b/app/Plugins/MailchimpPlugin/Models/SubscriptionStatusModel.php deleted file mode 100644 index 5bcbdfc04..000000000 --- a/app/Plugins/MailchimpPlugin/Models/SubscriptionStatusModel.php +++ /dev/null @@ -1,30 +0,0 @@ -where('status_name', $name)->first(); - return $row['status_id'] ?? null; - } - - public function getStatusNameById(int $id): ?string - { - $row = $this->find($id); - return $row['status_name'] ?? null; - } -}