Created
May 15, 2012 03:38
-
-
Save jedateach/2698891 to your computer and use it in GitHub Desktop.
Payment Prototype
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
<?php | |
if(Director::isLive()){ | |
PaymentProcessor::set_live(); | |
}else{ | |
PaymentProcessor::set_test(); | |
} |
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
<?php | |
class Payment extends DataObject{ | |
} | |
interface PaymentProcessor{ | |
function setup(); //prepare for | |
} | |
interface MerchantProcessor{ | |
function process(); | |
} | |
interface GatewayProcessor{ | |
function redirect(); | |
} | |
class PaymentController extends Controller{ | |
//handle success | |
function success($request){ | |
} | |
//handle payment failed | |
function failure($request){ | |
} | |
//handle user cancelling | |
function cancel($request){ | |
} | |
//handle instant payment notification | |
function instantnotification($request){ | |
} | |
} |
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
<?php | |
class PaymentPage_Controller extends Page_Controller{ | |
function index(){ | |
$processor = | |
} | |
} |
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
<?php | |
class PayPalPayment extends Payment{ | |
static $db = array( | |
'OtherField' => 'Varchar' | |
); | |
} | |
class PayPalProcessor implements PaymentProcessor{ | |
//field mapping | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment