本文整理汇总了PHP中Payment::getPaymentSystemSettings方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::getPaymentSystemSettings方法的具体用法?PHP Payment::getPaymentSystemSettings怎么用?PHP Payment::getPaymentSystemSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment::getPaymentSystemSettings方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processCheckout
/**
* @param Payment $payment
* @param CHttpRequest $request
* @return bool
*/
public function processCheckout(Payment $payment, CHttpRequest $request)
{
$amount = $request->getParam('OutSum');
$orderId = (int) $request->getParam('InvId');
$crc = strtoupper($request->getParam('SignatureValue'));
$order = Order::model()->findByPk($orderId);
if (null === $order) {
Yii::log(Yii::t('RobokassaModule.robokassa', 'Order with id = {id} not found!', ['{id}' => $orderId]), CLogger::LEVEL_ERROR, self::LOG_CATEGORY);
return false;
}
if ($order->isPaid()) {
Yii::log(Yii::t('RobokassaModule.robokassa', 'Order with id = {id} already payed!', ['{id}' => $orderId]), CLogger::LEVEL_ERROR, self::LOG_CATEGORY);
return false;
}
$settings = $payment->getPaymentSystemSettings();
$myCrc = strtoupper(md5("{$amount}:{$orderId}:" . $settings['password2']));
if ($myCrc !== $crc) {
Yii::log(Yii::t('RobokassaModule.robokassa', 'Error pay order with id = {id}! Bad crc!', ['{id}' => $orderId]), CLogger::LEVEL_ERROR, self::LOG_CATEGORY);
return false;
}
if ($amount != Yii::app()->money->convert($order->total_price, $payment->currency_id)) {
Yii::log(Yii::t('RobokassaModule.robokassa', 'Error pay order with id = {id}! Incorrect price!', ['{id}' => $orderId]), CLogger::LEVEL_ERROR, self::LOG_CATEGORY);
return false;
}
if ($order->pay($payment)) {
Yii::log(Yii::t('RobokassaModule.robokassa', 'Success pay order with id = {id}!', ['{id}' => $orderId]), CLogger::LEVEL_INFO, self::LOG_CATEGORY);
return true;
} else {
Yii::log(Yii::t('RobokassaModule.robokassa', 'Error pay order with id = {id}! Error change status!', ['{id}' => $orderId]), CLogger::LEVEL_ERROR, self::LOG_CATEGORY);
return false;
}
}
示例2: processCheckout
/**
* @param Payment $payment
* @param CHttpRequest $request
*/
public function processCheckout(Payment $payment, CHttpRequest $request)
{
$settings = $payment->getPaymentSystemSettings();
$params = ['action' => $request->getParam('action'), 'orderSumAmount' => $request->getParam('orderSumAmount'), 'orderSumCurrencyPaycash' => $request->getParam('orderSumCurrencyPaycash'), 'orderSumBankPaycash' => $request->getParam('orderSumBankPaycash'), 'shopId' => $settings['shopid'], 'invoiceId' => $request->getParam('invoiceId'), 'customerNumber' => $request->getParam('customerNumber'), 'password' => $settings['password']];
/* @var $order Order */
$order = Order::model()->findByPk($request->getParam('orderNumber'));
if ($order === null) {
$message = Yii::t('YandexMoneyModule.ymoney', 'The order doesn\'t exist.');
Yii::log($message, CLogger::LEVEL_ERROR);
$this->showResponse($params, $message, 200);
}
if ($order->isPaid()) {
$message = Yii::t('YandexMoneyModule.ymoney', 'The order #{n} is already payed.', $order->getPrimaryKey());
Yii::log($message, CLogger::LEVEL_ERROR);
$this->showResponse($params, $message, 200);
}
if ($this->getOrderCheckSum($params) !== $request->getParam('md5')) {
$message = Yii::t('YandexMoneyModule.ymoney', 'Wrong checksum');
Yii::log($message, CLogger::LEVEL_ERROR);
$this->showResponse($params, $message, 200);
}
if ((double) $order->getTotalPriceWithDelivery() !== (double) $params['orderSumAmount']) {
$message = Yii::t('YandexMoneyModule.ymoney', 'Wrong payment amount');
Yii::log($message, CLogger::LEVEL_ERROR);
$this->showResponse($params, $message, 200);
}
if ($params['action'] === 'checkOrder') {
$this->showResponse($params);
}
if ($params['action'] === 'paymentAviso' && $order->pay($payment)) {
Yii::log(Yii::t('YandexMoneyModule.ymoney', 'The order #{n} has been payed successfully.', $order->getPrimaryKey()), CLogger::LEVEL_INFO);
$this->showResponse($params);
}
}
示例3: __construct
public function __construct(Payment $payment)
{
$settings = $payment->getPaymentSystemSettings();
$this->key = $settings['key'];
$this->mode = $settings['paymode'];
}