本文整理汇总了PHP中Payment::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::factory方法的具体用法?PHP Payment::factory怎么用?PHP Payment::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment::factory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute()
{
$payment = Request::get('payment');
$method = Payment::factory($payment, 'connection');
if (!$method) {
echo 'error';
}
$model = new connectionUserBalanceModel();
$result = $method->callback($model);
if ($method->callback($model)) {
$model->where(array('id' => (int) $result))->update(array('param' => $_POST));
$model->success((int) $result);
return 'success';
} else {
return 'error';
}
}
示例2: stepPurse
private function stepPurse($step)
{
$order = new Order();
if (!in_array($step, $order->getStepList())) {
$this->sendPurseData(array('error' => '[`Title undefined step purse`]'));
}
switch ($step) {
case 'price':
$price = $order->getPrice(Request::post('payment'));
$this->sendPurseData(array('prices' => $price));
break;
case 'confirmation':
$data = $order->create(Request::post('payment'), Request::post('price'));
$method = Payment::factory(Request::post('payment'), 'connection');
if (!$method) {
$this->sendPurseData(array('error' => '[`Title undefined payment method`]'));
}
$this->sendPurseData(array('result' => $method->payment($data)));
break;
}
}
示例3: getAllPayments
/**
* Return an array of all existing objects of this type in the database
*/
public static function getAllPayments()
{
$sql = 'select `classname` from cart_payment where status=1';
$results = Database::singleton()->query_fetch_all($sql);
foreach ($results as &$result) {
$result = Payment::factory($result['classname']);
}
return $results;
}
示例4: initSessionVariables
public static function initSessionVariables()
{
//This function initializes the values stored in the session IF THEY DON'T ALREADY EXIST
//For example, the shipping object, payment, etc
if (!isset($_SESSION['authenticated_user'])) {
$_SESSION['authenticated_user'] = new User();
}
if (!isset($_SESSION['cart_basket'])) {
$_SESSION['cart_basket'] = array();
}
if (!isset($_SESSION['cart_checkout']['shipping'])) {
$_SESSION['cart_checkout']['shipping'] = Shipping::factory('EAndA');
//Always set the shipping to EAndA
}
if (!isset($_SESSION['cart_checkout']['payment'])) {
$_SESSION['cart_checkout']['payment'] = Payment::factory('Paypal');
}
if (!isset($_SESSION['cart_checkout']['address']['shipping_address'])) {
$_SESSION['cart_checkout']['address']['shipping_address'] = new Address();
}
if (!isset($_SESSION['cart_checkout']['address']['billing_address'])) {
$_SESSION['cart_checkout']['address']['billing_address'] = new Address();
}
if (!isset($_SESSION['cart_checkout']['order'])) {
$_SESSION['cart_checkout']['order'] = new CartOrder();
}
if (!isset($_SESSION['cart_checkout']['orderFailureReason'])) {
$_SESSION['cart_checkout']['orderFailureReason'] = "";
}
}