Skip to content

Instantly share code, notes, and snippets.

@jedateach
Created May 15, 2012 03:38
Show Gist options
  • Save jedateach/2698891 to your computer and use it in GitHub Desktop.
Save jedateach/2698891 to your computer and use it in GitHub Desktop.
Payment Prototype
<?php
if(Director::isLive()){
PaymentProcessor::set_live();
}else{
PaymentProcessor::set_test();
}
<?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){
}
}
<?php
class PaymentPage_Controller extends Page_Controller{
function index(){
$processor =
}
}
<?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