This repository has been archived by the owner on Apr 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Did some major refactoring to pull out license logic into "Engine" fi…
…les. This allows you to easily write your own serial number logic. Simply create your own subclass of class.engine.php and set your application to use that new class. The file class.enginemd5.php is a simple, working example. Also, this new refactoring removes the old AquaticPrime ap.inc.php include file and moves all of that logic into the new AquaticPrime Engine file: class.engineaquaticprime.php
- Loading branch information
Tyler Hall
committed
May 3, 2011
1 parent
a8d6041
commit 5275a04
Showing
9 changed files
with
348 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?PHP | ||
abstract class Engine | ||
{ | ||
public $order; | ||
public $application; | ||
|
||
// Should do whatever steps are required to generate a license and store | ||
// into the database - typically by updating the $order property. | ||
abstract public function generateLicense(); | ||
|
||
// Should force a download of the user's license file or do nothing if | ||
// the license is not downloadable i.e., it's simply a serial number. | ||
abstract public function downloadLicense(); | ||
|
||
public function emailLicense() | ||
{ | ||
Mail_Postmark::compose() | ||
->addTo($this->order->payer_email) | ||
->subject($this->application->email_subject) | ||
->messagePlain($this->application->getBody($this->order)) | ||
->send(); | ||
} | ||
|
||
public function upgradeLicense() | ||
{ | ||
$upgrade_app = new Application($this->application->upgrade_app_id); | ||
if($upgrade_app->ok()) | ||
{ | ||
$o = new Order(); | ||
$o->app_id = $upgrade_app->id; | ||
$o->dt = dater(); | ||
$o->first_name = $this->order->first_name; | ||
$o->last_name = $this->order->last_name; | ||
$o->payer_email = $this->order->payer_email; | ||
$o->notes = "Upgrade via Shine"; | ||
$o->type = 'Upgrade'; | ||
$o->insert(); | ||
$o->generateLicense(); | ||
return $o; | ||
} | ||
|
||
return null; | ||
} | ||
} |
Oops, something went wrong.