public function getPaymentLink(msOrder $order) { $successUrl = $cancelUrl = $this->modx->getOption('site_url'); $params = array('msorder' => $order->get('id')); $context = $order->get('context'); if ($id = $this->modx->getOption('ms2_payment_rbk_success_id', null, 0)) { $successUrl = $this->modx->makeUrl($id, $context, $params, 'full'); } if ($id = $this->modx->getOption('ms2_payment_rbk_cancel_id', null, 0)) { $cancelUrl = $this->modx->makeUrl($id, $context, $params, 'full'); } $params = array('eshopId' => $this->config['eshopid'], 'orderId' => $order->get('id'), 'serviceName' => $this->modx->lexicon('ms2_payment_rbk_service_name', array('num' => $order->get('id'))), 'recipientAmount' => $order->get('cost'), 'recipientCurrency' => $this->config['currency'], 'language' => $this->config['language'], 'successUrl' => $successUrl, 'failUrl' => $cancelUrl); $profile = $order->getOne('UserProfile'); if (isset($profile)) { $params['user_email'] = $profile->get('email'); } $orderProperties = $order->get('properties'); if (isset($orderProperties['payments']['rbk']['preference'])) { $params['preference'] = $orderProperties['payments']['rbk']['preference']; } elseif (!empty($this->config['preference'])) { $params['preference'] = $this->config['preference']; } $params['hash'] = $this->hash($params, 'request'); $link = $this->config['checkoutUrl']; $link .= (strpos($link, '?') === false ? '?' : '&') . http_build_query($params); return $link; }
public function getPaymentLink(msOrder $order) { $address = $order->getOne('Address'); $request = array('from' => $this->config['shopId'], 'to' => $address->get('phone'), 'summ' => $order->get('cost'), 'com' => $this->config['comment'], 'lifetime' => $this->config['lifetime'], 'check_agt' => $this->config['check_agt'], 'txn_id' => $order->get('id'), 'currency' => $this->config['currency'], 'successUrl' => $this->config['paymentUrl'] . '?action=success', 'failUrl' => $this->config['paymentUrl'] . '?action=failure'); $link = $this->config['checkoutUrl'] . '?' . http_build_query($request); return $link; }
public function getPaymentLink(msOrder $order) { $id = $order->get('id'); $sum = number_format($order->get('cost'), 2, '.', ''); $request = array('LMI_PAYMENT_NO' => $id, 'LMI_PAYMENT_AMOUNT' => $sum, 'CLIENT_MAIL' => $order->getOne('UserProfile')->get('email'), 'LMI_PAYMENT_DESC' => 'Payment #' . $id, 'LMI_PAYEE_PURSE' => $this->config['shopId'], 'ZP_CMS' => 'MODXMS2', 'ZP_DEVELOPER' => 'ZP97337015'); if (!empty($this->config['shopSign'])) { $request['ZP_SIGN'] = md5($this->config['shopId'] . $id . $sum . $this->config['shopSign']); } $link = $this->config['checkoutUrl'] . '?' . http_build_query($request); return $link; }
/** @inheritdoc} */ public function receive(msOrder $order, $params = array()) { if ($user = $order->getOne('CustomerProfile')) { $user->set('account', $user->get('account') - $order->get('cost')); if ($user->save()) { $order->set('type', 1); $order->save(); /** @var miniShop2 $miniShop2 */ $miniShop2 = $this->modx->getService('miniShop2'); $miniShop2->changeOrderStatus($order->get('id'), 2); return true; } } return false; }
/** * Generate payment link * * @param msOrder $order * @return string */ public function getPaymentLink(msOrder $order) { $successUrl = $failureUrl = $this->modx->getOption('site_url'); $params = array('msorder' => $order->get('id')); $context = $order->get('context'); if ($id = $this->modx->getOption('ms2_payment_platron_success_id', null, 0)) { $successUrl = $this->modx->makeUrl($id, $context, $params, 'full', array('xhtml_urls' => false)); } if ($id = $this->modx->getOption('ms2_payment_platron_cancel_id', null, 0)) { $failureUrl = $this->modx->makeUrl($id, $context, $params, 'full', array('xhtml_urls' => false)); } $params = array('pg_merchant_id' => $this->config['merchant_id'], 'pg_order_id' => $order->get('id'), 'pg_amount' => $order->get('cost'), 'pg_currency' => $this->config['currency'], 'pg_result_url' => $this->config['result_url'], 'pg_request_methos' => 'POST', 'pg_success_url' => $successUrl, 'pg_failure_url' => $failureUrl, 'pg_payment_system' => $this->config['payment_system'], 'pg_lifetime' => $this->config['lifetime'], 'pg_description' => $this->modx->lexicon('ms2_payment_platron_order_description', array('num' => $order->get('id'))), 'pg_language' => $this->config['language'], 'pg_salt' => uniqid(mt_rand(), true)); $submitFields = array_map('trim', explode(',', $this->config['submit_user_fields'])); if (sizeof($submitFields)) { $profile = $order->getOne('UserProfile'); if (isset($profile)) { $fieldMap = array('user_email' => 'email', 'user_contact_email' => 'email', 'user_phone' => 'phone'); foreach ($fieldMap as $platronField => $modxField) { if (in_array($platronField, $submitFields)) { $v = $profile->get($modxField); if (!empty($v)) { $params['pg_' . $platronField] = $v; } } } } } $orderProperties = $order->get('properties'); if (isset($orderProperties['payments']['platron']['payment_system'])) { $params['pg_payment_system'] = $orderProperties['payments']['platron']['payment_system']; } elseif (!empty($this->config['payment_system'])) { $params['pg_payment_system'] = $this->config['payment_system']; } $params['pg_sig'] = $this->signature($params, 'payment.php'); $link = $this->config['checkout_url']; $link .= (strpos($link, '?') === false ? '?' : '&') . http_build_query($params); return $link; }