Example #1
0
 /**
  * Authorize
  *
  * @param	\IPS\nexus\Transaction					$transaction	Transaction
  * @param	array|\IPS\nexus\Customer\CreditCard	$values			Values from form OR a stored card object if this gateway supports them
  * @param	\IPS\nexus\Fraud\MaxMind\Request|NULL	$maxMind		*If* MaxMind is enabled, the request object will be passed here so gateway can additional data before request is made	
  * @return	\IPS\DateTime|NULL		Auth is valid until or NULL to indicate auth is good forever
  * @throws	\LogicException			Message will be displayed to user
  */
 public function auth(\IPS\nexus\Transaction $transaction, $values, \IPS\nexus\Fraud\MaxMind\Request $maxMind = NULL)
 {
     $transaction->save();
     $data = array('amount' => $transaction->amount->amount / 10, 'msg' => urlencode($transaction->invoice->title), 'orderId' => $transaction->id, 'callbackUrl' => (string) \IPS\Settings::i()->base_url . 'applications/nexus/interface/gateways/jahanpay.php');
     $res = $this->api($data);
     if (!empty($res)) {
         \IPS\Output::i()->redirect(\IPS\Http\Url::external('http://www.jahanpay.com/pay_invoice/' . $res));
     }
     throw new \RuntimeException();
 }
Example #2
0
 /**
  * Authorize
  *
  * @param	\IPS\nexus\Transaction					$transaction	Transaction
  * @param	array|\IPS\nexus\Customer\CreditCard	$values			Values from form OR a stored card object if this gateway supports them
  * @param	\IPS\nexus\Fraud\MaxMind\Request|NULL	$maxMind		*If* MaxMind is enabled, the request object will be passed here so gateway can additional data before request is made	
  * @return	\IPS\DateTime|NULL		Auth is valid until or NULL to indicate auth is good forever
  * @throws	\LogicException			Message will be displayed to user
  */
 public function auth(\IPS\nexus\Transaction $transaction, $values, \IPS\nexus\Fraud\MaxMind\Request $maxMind = NULL)
 {
     $transaction->save();
     $data = array('amount' => $transaction->amount->amount, 'redirect' => urlencode((string) \IPS\Settings::i()->base_url . 'applications/nexus/interface/gateways/payline.php?nexusTransactionId=' . $transaction->id));
     $result = $this->api($data);
     if ($result > 0) {
         \IPS\Output::i()->redirect(\IPS\Http\Url::external("http://payline.ir/payment/gateway-{$result}"));
     }
     throw new \RuntimeException();
 }
Example #3
0
 /**
  * Authorize
  *
  * @param	\IPS\nexus\Transaction					$transaction	Transaction
  * @param	array|\IPS\nexus\Customer\CreditCard	$values			Values from form OR a stored card object if this gateway supports them
  * @param	\IPS\nexus\Fraud\MaxMind\Request|NULL	$maxMind		*If* MaxMind is enabled, the request object will be passed here so gateway can additional data before request is made	
  * @return	\IPS\DateTime|NULL		Auth is valid until or NULL to indicate auth is good forever
  * @throws	\LogicException			Message will be displayed to user
  */
 public function auth(\IPS\nexus\Transaction $transaction, $values, \IPS\nexus\Fraud\MaxMind\Request $maxMind = NULL)
 {
     $transaction->save();
     $data = array('Amount' => $transaction->amount->amount / 10, 'Description' => $transaction->invoice->title, 'Email' => $transaction->member->email, 'Mobile' => $transaction->member->cm_phone, 'CallbackURL' => (string) \IPS\Settings::i()->base_url . 'applications/nexus/interface/gateways/zarinpal.php?nexusTransactionId=' . $transaction->id);
     $res = $this->api($data);
     if ($res['Status'] == 100) {
         $settings = json_decode($this->settings, TRUE);
         \IPS\Output::i()->redirect(\IPS\Http\Url::external('https://www.zarinpal.com/pg/StartPay/' . $res['Authority'] . '' . ($settings['zarin_gate'] ? '/ZarinGate' : '')));
     }
     throw new \RuntimeException();
 }
 /**
  * Authorize
  *
  * @param    \IPS\nexus\Transaction $transaction Transaction
  * @param    array|\IPS\nexus\Customer\CreditCard $values Values from form OR a stored card object if this gateway supports them
  * @param    \IPS\nexus\Fraud\MaxMind\Request|NULL $maxMind *If* MaxMind is enabled, the request object will be passed here so gateway can additional data before request is made
  * @return    \IPS\DateTime|NULL        Auth is valid until or NULL to indicate auth is good forever
  * @throws    \LogicException            Message will be displayed to user
  */
 public function auth(\IPS\nexus\Transaction $transaction, $values, \IPS\nexus\Fraud\MaxMind\Request $maxMind = NULL)
 {
     // Change order status to Waiting
     // Notice: When change status to PENDING, the site appears some errors about the template
     //         Call to undefined method IPS\Theme\class_nexus_admin_transactions::pend()
     $transaction->status = \IPS\nexus\Transaction::STATUS_WAITING;
     $extra = $transaction->extra;
     $extra['history'][] = array('s' => \IPS\nexus\Transaction::STATUS_WAITING);
     $transaction->extra = $extra;
     $transaction->save();
     // In case: When a guest checks out they will be prompted to create an account,
     //          The account will not be created until payment has been authorised
     // So, we create a new account to get member_id before create the widget
     // After checkout, the customer needs re-login to check order status
     $this->registerMember($transaction->invoice);
     $settings = $this->getSettings();
     self::initPaymentwall($settings['project_key'], $settings['secret_key']);
     $widget = new \Paymentwall_Widget($transaction->invoice->member->member_id ? $transaction->invoice->member->member_id : $_SERVER['REMOTE_ADDR'], $settings['widget_code'], array(new \Paymentwall_Product($transaction->invoice->id, (string) $transaction->amount->amount, $transaction->currency, 'Invoice #' . $transaction->invoice->id, \Paymentwall_Product::TYPE_FIXED)), array_merge(array('test_mode' => (int) $settings['test_mode'], 'success_url' => trim($settings['success_url']) != '' ? trim($settings['success_url']) : (string) \IPS\Http\Url::internal('app=nexus&module=clients&controller=invoices&id=' . $transaction->invoice->id, 'front', 'clientsinvoice', array(), \IPS\Settings::i()->nexus_https), 'id' => $transaction->id, 'integration_module' => 'ipboard', 'email' => $transaction->invoice->member->email), $this->prepareUserProfileData($transaction)));
     echo $widget->getHtmlCode(array('width' => '100%', 'height' => '600px'));
     die;
 }