示例#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();
 }
示例#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();
 }
示例#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();
 }
示例#4
0
 /**
  * Process Pingback
  *
  * @return    void
  */
 protected function manage()
 {
     try {
         $transaction = \IPS\nexus\Transaction::load(\IPS\Request::i()->id);
     } catch (\OutOfRangeException $e) {
         die('Transaction invalid!');
     }
     try {
         $response = $transaction->method->handlerPingback($transaction);
         die($response);
     } catch (\Exception $e) {
         die($e->getMessage());
     }
 }
 public function handlerPingback(\IPS\nexus\Transaction $transaction)
 {
     $settings = $this->getSettings();
     self::initPaymentwall($settings['project_key'], $settings['secret_key']);
     $pingback = new \Paymentwall_Pingback($_GET, $this->getRealClientIP());
     if ($pingback->validate()) {
         $invoice = $transaction->get_invoice();
         if ($pingback->isDeliverable()) {
             // Call Delivery Confirmation API
             if ($settings['delivery']) {
                 // Delivery Confirmation
                 $delivery = new \Paymentwall_GenerericApiObject('delivery');
                 $response = $delivery->post($this->prepareDeleveryData($transaction, $settings['test_mode']), $pingback->getReferenceId());
             }
             $transaction->approve();
         } else {
             if ($pingback->isCancelable()) {
                 if ($invoice->status == \IPS\nexus\Invoice::STATUS_PAID) {
                     $transaction->refund();
                     // Update invoice status
                     $invoice->markUnpaid(\IPS\nexus\Invoice::STATUS_CANCELED);
                 }
             }
         }
         return self::DEFAULT_PINGBACK_RESPONSE;
         // Paymentwall expects response to be OK, otherwise the pingback will be resent
     } else {
         return $pingback->getErrorSummary();
     }
 }
示例#6
0
<?php

/**
 * @brief		Payline Gateway
 * @author		<a href='http://skinod.com.com'>Skinod</a>
 * @copyright	(c) 2015 Skinod.com
 */
require_once '../../../../init.php';
\IPS\Session\Front::i();
try {
    $transaction = \IPS\nexus\Transaction::load(\IPS\Request::i()->nexusTransactionId);
    if ($transaction->status !== \IPS\nexus\Transaction::STATUS_PENDING) {
        throw new \OutofRangeException();
    }
} catch (\OutOfRangeException $e) {
    \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=nexus&module=payments&controller=checkout&do=transaction&id=&t=" . \IPS\Request::i()->nexusTransactionId, 'front', 'nexus_checkout', \IPS\Settings::i()->nexus_https));
}
try {
    $result = $transaction->method->api(array('trans_id' => \IPS\Request::i()->trans_id, 'id_get' => \IPS\Request::i()->id_get), TRUE);
    if ($result === 1) {
        $transaction->gw_id = \IPS\Request::i()->trans_id . '_' . \IPS\Request::i()->id_get;
        $transaction->save();
        $transaction->checkFraudRulesAndCapture(NULL);
        $transaction->sendNotification();
        \IPS\Session::i()->setMember($transaction->invoice->member);
        // This is in case the checkout was a guest, meaning checkFraudRulesAndCapture() may have just created an account. There is no security issue as we have just verified they were just bounced back from Payline
        \IPS\Output::i()->redirect($transaction->url());
    }
    throw new \OutofRangeException();
} catch (\Exception $e) {
    \IPS\Output::i()->redirect($transaction->invoice->checkoutUrl()->setQueryString(array('_step' => 'checkout_pay', 'err' => $transaction->member->language()->get('gateway_err'))));
示例#7
0
<?php

/**
 * @brief		Jahanpay Gateway
 * @author		<a href='http://skinod.com.com'>Skinod</a>
 * @copyright	(c) 2015 Skinod.com
 */
require_once '../../../../init.php';
\IPS\Session\Front::i();
try {
    $transaction = \IPS\nexus\Transaction::load(\IPS\Request::i()->order_id);
    if ($transaction->status !== \IPS\nexus\Transaction::STATUS_PENDING) {
        throw new \OutofRangeException();
    }
} catch (\OutOfRangeException $e) {
    \IPS\Output::i()->redirect(\IPS\Http\Url::internal("app=nexus&module=payments&controller=checkout&do=transaction&id=&t=" . \IPS\Request::i()->order_id, 'front', 'nexus_checkout', \IPS\Settings::i()->nexus_https));
}
try {
    $res = $transaction->method->api(array('amount' => $transaction->amount->amount / 10, 'au' => \IPS\Request::i()->au), TRUE);
    if (!empty($res) and $res == 1) {
        $transaction->gw_id = \IPS\Request::i()->au;
        $transaction->save();
        $transaction->checkFraudRulesAndCapture(NULL);
        $transaction->sendNotification();
        \IPS\Session::i()->setMember($transaction->invoice->member);
        // This is in case the checkout was a guest, meaning checkFraudRulesAndCapture() may have just created an account. There is no security issue as we have just verified they were just bounced back from Jahanpay
        \IPS\Output::i()->redirect($transaction->url());
    }
    throw new \OutofRangeException();
} catch (\Exception $e) {
    \IPS\Output::i()->redirect($transaction->invoice->checkoutUrl()->setQueryString(array('_step' => 'checkout_pay', 'err' => $transaction->member->language()->get('gateway_err'))));