diff --git a/source/defs/Hookmanager/Hookmanager.php b/source/defs/Hookmanager/Hookmanager.php index 2c6f425..2c7f87a 100644 --- a/source/defs/Hookmanager/Hookmanager.php +++ b/source/defs/Hookmanager/Hookmanager.php @@ -28,9 +28,12 @@ class Hookmanager "subscription_payment_succeeded", "subscription_payment_failed", "subscription_payment_refunded", - "payment_refunded", + "payment_refunded" - ] + ]; + + + private $AppBaseURL; @@ -90,9 +93,9 @@ class Hookmanager $sVal = $value; } } - - // TODO: Redirect request to approriate route. - // Use translator helper method to translate developer name to readable route name for redirect + + // Uses the response and redirect objects and the intent from the current request to redirect it + return $this->redirectAlert($request, $response, $sVal); } @@ -102,6 +105,57 @@ class Hookmanager } + // The response and request method is passed by the redirecting method + public function redirectAlert(Request $Request, Response $response, $intent) + { + + switch ($intent) + { + + case "subscription_created": + + return $response->withRedirect(, 307) + + break; + + case "subscription_updated": + + break; + + case "subscription_cancelled": + + + break; + + case "subscription_payment_successful": + + + break; + + case "subscription_payment_failed": + + + break; + + case "subscription_payment_refunded": + + + break; + + case "payment_refunded": + + + break; + + default: + + + // default code here + + } + + } + public function EventSubscriptionCreated(Request $request, Response $response, $args) {