From a8f089e3b2f1f6c2095903796f4325875d7bd06b Mon Sep 17 00:00:00 2001 From: Miguel Nogueira Date: Fri, 25 Jan 2019 14:17:48 +0000 Subject: [PATCH] Miscellaneous additions (previously untracked) --- public/index.php | 52 ++++++++++++++++++- .../Auth/Authentication.php | 0 .../{defs => controllers}/Emailer/PHPMail.php | 2 +- .../Hookmanager/Hookmanager.php | 0 .../{defs => controllers}/Package/Package.php | 2 +- .../RenderEngine/Render.php | 0 .../Virtualmin/Virtualmin.php | 0 7 files changed, 52 insertions(+), 4 deletions(-) rename source/{defs => controllers}/Auth/Authentication.php (100%) rename source/{defs => controllers}/Emailer/PHPMail.php (96%) rename source/{defs => controllers}/Hookmanager/Hookmanager.php (100%) rename source/{defs => controllers}/Package/Package.php (98%) rename source/{defs => controllers}/RenderEngine/Render.php (100%) rename source/{defs => controllers}/Virtualmin/Virtualmin.php (100%) diff --git a/public/index.php b/public/index.php index 870a345..d708161 100644 --- a/public/index.php +++ b/public/index.php @@ -10,18 +10,66 @@ $App = new \Slim\App([ ]); +//TODO: rearrange endpoints +// detects the intent on the app's post load $App->post ( - "/api/paddle/{authkey}/detectIntent", + "/api/woocommerce/{authkey}/detectIntent", Hookmanager::class, ':detectPayloadIntent' ); +// hooks into the EventSubscriptionCreated class, so that stuff can be done with it. +// the request is redirected by the detectIntent endpoint. $App->post ( - "/api/paddle/{authkey}/hook", + "/api/woocommerce/{authkey}/hooks/SubscriptionCreatead", Hookmanager::class, ':EventSubscriptionCreatead' ); + +$App->post + ( + + "/api/woocommerce/{authkey}/hooks/SubscriptionCancelled", + Hookmanager::class, ':EventSubscriptionCancelled' + + ); + +$App->post + ( + "/api/woocommerce/{authkey}/hooks/SubscriptionUpdated", + Hookmanager::class, ':EventSubscriptionUpdated' + + ); + +$App->post + ( + "/api/woocommerce/{authkey}/hooks/SubscriptionPaymentSuccess", + Hookmanager::class, ':EventSubscriptionPaymentSuccess' + ); + +$App->post + ( + "/api/woocommerce/{authkey}/hooks/SubscriptionPaymentFailed", + Hookmanager::class, ':EventSubscriptionPaymentFailed' + ); + +$App->post + ( + + "/api/woocommerce/{authkey}/hooks/SubscriptionPaymentRefunded", + Hookmanager::class, ':EventSubscriptionPaymentRefunded' + + ); + +// TODO: deploy route +$App->post + ( + + "/api/wocommerce/{authkey}/requests/customer/{customerID}", + Hookmanager::class, ':GetCustomerByID' + + ); $App->run(); \ No newline at end of file diff --git a/source/defs/Auth/Authentication.php b/source/controllers/Auth/Authentication.php similarity index 100% rename from source/defs/Auth/Authentication.php rename to source/controllers/Auth/Authentication.php diff --git a/source/defs/Emailer/PHPMail.php b/source/controllers/Emailer/PHPMail.php similarity index 96% rename from source/defs/Emailer/PHPMail.php rename to source/controllers/Emailer/PHPMail.php index 2e78202..28d325b 100644 --- a/source/defs/Emailer/PHPMail.php +++ b/source/controllers/Emailer/PHPMail.php @@ -62,7 +62,7 @@ class Emailer \ByJG\Mail\MailerFactory::registerMailer('smtp', \ByJG\Mail\Wrapper\PHPMailerWrapper::class); $this->Mailer = \ByJG\Mail\MailerFactory::create($connStr); - $this->Mailer->setFrom("noreply@spacejewel.ga", "Spacejewel Billing System"); + $this->Mailer->setFrom("noreply@spacejewel-hosting.com", "Spacejewel Billing System"); $this->Mailer->addTo($this->CustomerEmail); } diff --git a/source/defs/Hookmanager/Hookmanager.php b/source/controllers/Hookmanager/Hookmanager.php similarity index 100% rename from source/defs/Hookmanager/Hookmanager.php rename to source/controllers/Hookmanager/Hookmanager.php diff --git a/source/defs/Package/Package.php b/source/controllers/Package/Package.php similarity index 98% rename from source/defs/Package/Package.php rename to source/controllers/Package/Package.php index 00f93cd..bfe0d13 100644 --- a/source/defs/Package/Package.php +++ b/source/controllers/Package/Package.php @@ -54,7 +54,7 @@ class Package extends Application "mail", "ssl", "spam", - "virus" + "virus", "limits-from-plan" ]; diff --git a/source/defs/RenderEngine/Render.php b/source/controllers/RenderEngine/Render.php similarity index 100% rename from source/defs/RenderEngine/Render.php rename to source/controllers/RenderEngine/Render.php diff --git a/source/defs/Virtualmin/Virtualmin.php b/source/controllers/Virtualmin/Virtualmin.php similarity index 100% rename from source/defs/Virtualmin/Virtualmin.php rename to source/controllers/Virtualmin/Virtualmin.php