PHP Class OrderProcessor, silvershop-core

Placing, Emailing Reciepts, Status Updates, Printing, Payments - things you do with a completed order.
Mostrar archivo Open project: burnbright/silverstripe-shop Class Usage Examples

Protected Properties

Property Type Description
$error string
$notifier OrderEmailNotifier
$order Order

Public Methods

Method Description
__construct ( Order $order ) Assign the order to a local variable
canPlace ( Order $order ) Determine if an order can be placed.
completePayment ( ) Complete payment processing - send receipt - update order status accordingling - fire event hooks
config ( )
create ( Order $order ) Static way to create the order processor.
createPayment ( $gateway ) Create a new payment for an order
getError ( )
getOrder ( ) : Order
getReturnUrl ( ) : String URL to display success message to the user.
makePayment ( string $gateway, array $gatewaydata = [], string $successUrl = null, string $cancelUrl = null ) : SilverStripe\Omnipay\Service\ServiceResponse | null Create a payment model, and provide link to redirect to external gateway, or redirect to order link.
placeOrder ( ) : boolean Takes an order from being a cart to awaiting payment.

Protected Methods

Method Description
error ( $message )
getGatewayData ( array $customData ) : array Map shop data to omnipay fields

Method Details

__construct() public method

Assign the order to a local variable
public __construct ( Order $order )
$order Order

canPlace() public method

Determine if an order can be placed.
public canPlace ( Order $order )
$order Order

completePayment() public method

Complete payment processing - send receipt - update order status accordingling - fire event hooks
public completePayment ( )

config() public static method

public static config ( )

create() public static method

Makes creating a processor easier.
public static create ( Order $order )
$order Order

createPayment() public method

Create a new payment for an order
public createPayment ( $gateway )

error() protected method

protected error ( $message )

getError() public method

public getError ( )

getGatewayData() protected method

Map shop data to omnipay fields
protected getGatewayData ( array $customData ) : array
$customData array Usually user submitted data.
return array

getOrder() public method

public getOrder ( ) : Order
return Order

getReturnUrl() public method

Happens after any potential offsite gateway redirects.
public getReturnUrl ( ) : String
return String Relative URL

makePayment() public method

Create a payment model, and provide link to redirect to external gateway, or redirect to order link.
public makePayment ( string $gateway, array $gatewaydata = [], string $successUrl = null, string $cancelUrl = null ) : SilverStripe\Omnipay\Service\ServiceResponse | null
$gateway string the gateway to use
$gatewaydata array the data that should be passed to the gateway
$successUrl string (optional) return URL for successful payments. If left blank, the default return URL will be used @see getReturnUrl
$cancelUrl string (optional) return URL for cancelled/failed payments
return SilverStripe\Omnipay\Service\ServiceResponse | null

placeOrder() public method

Takes an order from being a cart to awaiting payment.
public placeOrder ( ) : boolean
return boolean - success/failure

Property Details

$error protected_oe property

protected string $error
return string

$notifier protected_oe property

protected OrderEmailNotifier $notifier
return OrderEmailNotifier

$order protected_oe property

protected Order $order
return Order