Example #1
0
 public function initModels()
 {
     parent::initModels();
     $this->shipStateModel = new State();
     $this->shipStateModel->fillFromStateCode($this->shippingAddressModel->state_id);
     $this->profileModel = new Profile();
     $this->profileModel->fillFromDbPk($this->campaignModel->profile_id);
     $this->attemptReturnModel = new AttemptReturn();
 }
Example #2
0
 public function extraValidFields($fieldsArray)
 {
     $errors = array();
     if (strlen($fieldsArray['cc_number']) < 12 || strlen($fieldsArray['cc_number']) > 19 || !PaymentSystem::getCardType($fieldsArray['cc_number'])) {
         $errors['cc_number'] = 'incorrect_cc_number';
     }
     if (strlen($fieldsArray['cc_cvv']) < 3 || strlen($fieldsArray['cc_cvv']) > 4) {
         $errors['cc_cvv'] = 'incorrect_cvv_code';
     }
     return $errors;
 }
Example #3
0
 public function getReturnAttempt($systemCode = null)
 {
     if (!$systemCode) {
         if (isset($_GET['REF']) && $_GET['RETURNMAC']) {
             $systemCode = PaymentSystem::SYSTEM_GLOBAL_COLLECT;
         } elseif (isset($_GET['txnid']) && isset($_GET['refno']) && isset($_GET['digest']) && isset($_GET['status'])) {
             $systemCode = PaymentSystem::SYSTEM_DRAGONPAY;
         }
     }
     $ps = $this->_ps = PaymentSystem::getPaymentSystem($systemCode);
     return $ps->getReturnAttempt();
 }
Example #4
0
 public function init()
 {
     $this->name = 'offline';
     return parent::init();
 }
Example #5
0
 public function init()
 {
     $this->name = 'balance';
     return parent::init();
 }
 private static function transactionLimits($currencyId, $paymentSystemName, $type = 0)
 {
     $paySystem = new PaymentSystem();
     $paySystem->findBy(array('name' => $paymentSystemName));
     $curPaySystem = new CurrencyPaymentSystem();
     $result = $curPaySystem->findBy(array('cur_id' => $currencyId, 'system_id' => $paySystem->getId()));
     if (!$result) {
         $system_fee = 0.0;
         $fee = 0.0;
         $min = 0.0;
         $max = null;
     } else {
         if ($type == 1) {
             $system_fee = $curPaySystem->getSystemFee();
             $fee = $curPaySystem->getOutputFee();
             $min = $curPaySystem->getOutputMin();
             $max = $curPaySystem->getOutputMax();
         } else {
             $system_fee = $curPaySystem->getSystemFee();
             $fee = $curPaySystem->getInputFee();
             $min = $curPaySystem->getInputMin();
             $max = $curPaySystem->getInputMax();
         }
     }
     return array('system_fee' => $system_fee, 'fee' => $fee, 'min' => $min, 'max' => $max);
 }
Example #7
0
 public function getrequest_id($ps = 'pn')
 {
     return PaymentSystem::paymentPrefix($ps) . $this->attempt_id;
 }
Example #8
0
<?php

@(include_once '../settings/autoload.php');
$msql = SafeMySQL::getInstance();
$text = '';
$attemptIDs = array('119456');
if (isset($_POST['refund'])) {
    foreach ($attemptIDs as $attemptID) {
        $sql = "SELECT g.system_code, p.method_id, a.order_id\n                FROM attempts as a\n                JOIN gateways as g USING(`gateway_id`)\n                JOIN orders as o USING(`order_id`)\n                JOIN payments as p USING(`payment_id`)\n                WHERE a.attempt_id=?i\n                ";
        $result = $msql->getRow($sql, $attemptID);
        if ($result) {
            $modelOrder = Order::model()->with('gateway')->findByPk($result['order_id']);
            $modelAttempt = Attempt::model()->findByPk($attemptID);
            $ps = PaymentSystem::getPaymentSystem($result['system_code'], $result['method_id']);
            $ps->setModel($modelOrder);
            $ps->setModel($modelAttempt);
            $ps->setModel($modelOrder->gateway);
            $ps->paymetnResponse = new PaymentAPIResponse();
            $response = $ps->refund();
            $text .= 'Attempt ID: ' . $attemptID . ' OrderID: ' . $modelOrder->order_id . '<br>';
            $text .= 'Status: ' . $response->status . '<br>';
            $text .= 'Errors: ' . $response->errors2string . '<br>';
            $text .= '<hr>';
        }
    }
}
?>

<!DOCTYPE html>
<html lang="en-US" class=" "><head>
    <meta charset="UTF-8">
Example #9
0
$authorizationUrl = $provider->getAuthorizationUrl();
// Get the state generated for you and store it to the session.
$_SESSION['oauth2state'] = urlencode($provider->getState());
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $ipAddresses = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
    $ip = trim(end($ipAddresses));
} else {
    $ip = $_SERVER['REMOTE_ADDR'];
}
$locator = new GeoLocator();
$country = $locator->locate($ip);
/* 
	Pulls list of payment system options available for this country via Payment Systems API
*/
try {
    $paymentSystems = new PaymentSystem();
    $list = $paymentSystems->getPaymentSystemsFor($country);
} catch (Exception $e) {
    exit($e->getMessage());
}
?>


<html>
	<head>
		<meta charset="utf-8">
	    <title>Paymentwall Demo Page</title>
		<link rel="stylesheet" type="text/css" href="assets/style/index.css">
	    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
		<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
	    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
Example #10
0
 private function buildPayment()
 {
     // check payment variables.  default to cc_debit
     if (!isset($this->post['ps'])) {
         $this->post['ps'] = null;
     }
     // removing PS and letting the profile functions figure out the payment system
     //$this->post['ps'] = (strlen($this->post['ps'])) ? $this->post['ps'] : 'pn';
     $this->post['payment_method'] = strlen($this->post['payment_method']) ? $this->post['payment_method'] : 'cc_debit';
     if (!isset($this->payment)) {
         $this->payment = new Payment();
     }
     if (!$this->payment->getPkValue()) {
         $this->payment->created = $this->payment->updated = 'NOW():sql';
         //date("Y-m-d H:i:s");
         $this->payment->customer_id = $this->customer->customer_id;
         // Check for 'DRY RUN GATEWAY'
         if ($this->campaign->profile_id) {
             // grab accepted payment methods based on payment system
             $profileMethods = new ProfileMethods('ProfileMethod');
             $profileMethods->loadId($this->campaign->profile_id, $this->post['ps']);
             if (!$profileMethods->isMethodValid($this->post['payment_method'], $this->post['ps'])) {
                 //is there only available option? if so, assign id to the value
                 if (count($profileMethods->records) == 1) {
                     $this->post['payment_method'] = $profileMethods->records[0]->method_ref;
                 } else {
                     // multiple ids available. abort
                     $this->apiError('invalid payment supplied');
                 }
             }
             // set payment method id
             $this->payment->method_id = $profileMethods->getMethodId($this->post['payment_method'], $this->post['ps']);
         } else {
             // DRY RUN GATEWAY - let's setup some values
             $mid = Method::getMethodsIdByRef($this->post['payment_method']);
             $this->payment->method_id = $mid ? $mid : 1;
         }
         $this->payment->fillFromMethodArray($this->post);
         if (!$this->payment->validateByMethodFields()) {
             $errors = $this->payment->errors;
             $validationErrors = $errors['validation_errors'];
             fb($this->payment->getErrors());
             $this->apiError('Invalid Payment Information - ');
         }
         // Is this a cc_debit order?  If so, are there any specific CC methods setup for this campaign? DISABLE FOR CRM Orders
         // for example, if the CC is a mastercard and we have a mastercard only gateway, then default to it
         if ($this->campaign->profile_id && $this->payment->method_id == 1 && $this->wsType != 'x1') {
             // check for other CC methods
             $ccMethodId = ProfileGateways::getMethodByCC($this->campaign->profile_id, 'cc_' . PaymentSystem::getCardTypeSimple($this->payment->cc_number), $this->post['ps']);
             if ($ccMethodId) {
                 $this->payment->method_id = $ccMethodId;
             }
             unset($ccMethodId);
         }
         // is this a new customer?  if not, are there any other payment records for this customer that might be the same?
         $payments = new Payments('Payment');
         $payments->loadPaymentsByCustomer($this->customer->customer_id);
         // existing payment ID flag/PK
         $pid = 0;
         // check to see if the sent over info is duplicate
         if (count($payments->records)) {
             $pid = $payments->paymentExists($this->payment);
         }
         if (!$pid) {
             // save new payment record
             if (!$this->payment->save()) {
                 $this->apiError('invalid payment record');
             }
         } else {
             $this->payment->fillFromDbPk($pid);
         }
         unset($payments);
     }
 }
Example #11
0
 function getpaymentAction()
 {
     $this->checkLogin();
     AF::setJsonHeaders('json');
     $payment_id = AF::get($_POST, 'payment_id', false);
     if (!$payment_id) {
         Message::echoJsonError(__('incorrect_payment_id'));
     }
     $model = new Payment();
     if (!$model->fillFromDbPk($payment_id)) {
         Message::echoJsonError(__('incorrect_campaign_id'));
     }
     $result['cc_number'] = $model->cc_number_formatted;
     $result['cc_type'] = isset($model->num2) && strlen($model->num2) == 6 ? strtoupper(Bin::getCardType($this->num2)) : PaymentSystem::getCardType($model->cc_number);
     $result['exp_date'] = strlen($model->exp_date) == 3 ? '0' . $model->exp_date : $model->exp_date;
     $result['fields_expmonth'] = substr($result['exp_date'], 0, 2);
     $result['fields_expyear'] = '20' . substr($result['exp_date'], 2, 2);
     $result['cc_cvv'] = 'xxx';
     Message::echoJsonSuccess(array('message' => array('data' => $result)));
 }