Major changes
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
use \Slim\Http\Request as Request;
|
||||
use \Slim\Http\Response as Response;
|
||||
|
||||
// The hookmanager is the web-exposed class that allows you to manage a user within the billing system.
|
||||
// This system takes care of CRUD operations on customers. It doesn't keep track of order but it does suspend
|
||||
// you if you don't pay.
|
||||
@@ -7,17 +10,60 @@
|
||||
class Hookmanager
|
||||
{
|
||||
|
||||
public function EventSubscriptionCreated()
|
||||
private $Customer;
|
||||
|
||||
private $Renderview;
|
||||
|
||||
private $APITools;
|
||||
|
||||
private $Mailer;
|
||||
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->Customer = new Customer();
|
||||
$this->Renderview = new EmailRenderer();
|
||||
$this->APITools = new ApplicationAPI();
|
||||
|
||||
// Create mailer when needed
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function EventSubscriptionUpdated()
|
||||
// Return POST variable list in a structured array, DRY
|
||||
private function getStructuredVariableList(Request $request)
|
||||
{
|
||||
$PDATA = $request->getParsedBody();
|
||||
$dArr = [];
|
||||
|
||||
foreach($PDATA as $key => $param)
|
||||
{
|
||||
$dArr[$key => $param]; // Turn parsed body into an array.
|
||||
|
||||
}
|
||||
|
||||
return $dArr;
|
||||
}
|
||||
|
||||
|
||||
public function EventSubscriptionCreated(Request $request, Response $response)
|
||||
{
|
||||
// Create customer with data from Paddle
|
||||
// Send email with customer information
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function EventSubscriptionUpdated(Request $request, Response $response)
|
||||
{
|
||||
// Update user information if necessary
|
||||
}
|
||||
|
||||
public function EventSubscriptionCancelled()
|
||||
public function EventSubscriptionCancelled(Request $request, Response $response)
|
||||
{
|
||||
|
||||
// Suspend user's domain name as stated on DB
|
||||
@@ -25,7 +71,7 @@ class Hookmanager
|
||||
|
||||
}
|
||||
|
||||
public function EventSubscriptionPaymentSuccess()
|
||||
public function EventSubscriptionPaymentSuccess(Request $request, Response $response)
|
||||
{
|
||||
|
||||
// Renew user's subscription within billing system
|
||||
@@ -33,7 +79,7 @@ class Hookmanager
|
||||
|
||||
}
|
||||
// TODO: Lenient business logic
|
||||
public function EventSubscriptionPaymentFailed()
|
||||
public function EventSubscriptionPaymentFailed(Request $request, Response $response)
|
||||
{
|
||||
|
||||
// Add payment strike to user account
|
||||
@@ -44,7 +90,7 @@ class Hookmanager
|
||||
|
||||
}
|
||||
|
||||
public function EventSubscriptionPaymentRefunded()
|
||||
public function EventSubscriptionPaymentRefunded(Request $request, Response $response)
|
||||
{
|
||||
// Ban customer from billing system
|
||||
// Delete all customer data
|
||||
|
Reference in New Issue
Block a user