Exemplo n.º 1
0
 /**
  * @param \Ilis\Bundle\PaymentBundle\Entity\Transaction\CreditCard $transaction
  */
 public function capture(CreditCardTransaction $transaction)
 {
     if (!is_numeric($transaction->getAmount()) || $transaction->getAmount() <= 0) {
         throw new Exception("Invalid amount");
     }
     // TODO: Check if the transaction has set the proper payment method
     $request = new WsRequest();
     $request->setOrder($transaction->getId());
     $amount = (double) number_format($transaction->getAmount(), 2, '.', '') * 100;
     $request->setAmount($amount);
     $request->setOrder($transaction->getIdentifier());
     $request->setMerchantCode($this->merchant->getCode());
     $request->setTerminal($this->merchant->getTerminal());
     $request->setCurrency($this->merchant->getCurrency());
     $request->setPan($transaction->creditCard);
     $request->setCvv2($transaction->cvv);
     $request->setExpiryDate(sprintf("%s%s", $transaction->expiryDateYear, $transaction->expiryDateMonth));
     $request->setTransactionType(WsTransaction::TYPE_AUTH);
     $this->merchant->signRequest($request);
     $response = $this->client->makeRequest($request);
     $operation = $response->getOperation();
     $authCode = $operation ? trim((string) $operation->Ds_AuthorisationCode) : null;
     if ($response->isValid() && !empty($authCode)) {
         $transaction->setStatus(Transaction::STATUS_SUCCESS);
         $transaction->setAuthCode((string) $response->getOperation()->Ds_AuthorisationCode);
     } else {
         $transaction->setStatus(Transaction::STATUS_ERROR);
         $transaction->setStatusCode((string) $response->getCode());
     }
     $transaction->setRawData($response->asXml());
 }
Exemplo n.º 2
0
 public static function compare(Merchant $a, Merchant $b)
 {
     if ($a->getApiKey() != $b->getApiKey()) {
         return false;
     }
     if ($a->getEndpoint() != $b->getEndpoint()) {
         return false;
     }
     return true;
 }
Exemplo n.º 3
0
 public function _process_return()
 {
     $action = $this->CI->input->get('action', TRUE);
     if ($action === FALSE) {
         return new Merchant_response('failed', 'invalid_response');
     }
     if ($action === 'success') {
         return new Merchant_response('return', '', $_POST['txn_id']);
     }
     if ($action === 'cancel') {
         return new Merchant_response('failed', 'payment_cancelled');
     }
     if ($action === 'ipn') {
         // generate the post string from _POST
         $post_string = 'cmd=_notify-validate&' . http_build_query($_POST);
         $response = Merchant::curl_helper($this->settings['test_mode'] ? self::PROCESS_URL_TEST : self::PROCESS_URL, $post_string);
         if (!empty($response['error'])) {
             return new Merchant_response('failed', $response['error']);
         }
         $memo = $this->CI->input->post('memo');
         if (strpos("VERIFIED", $response['data']) !== FALSE) {
             // Valid IPN transaction.
             return new Merchant_response('authorized', $memo, $_POST['txn_id'], (string) $_POST['mc_gross']);
         } else {
             // Invalid IPN transaction
             return new Merchant_response('declined', $memo);
         }
     }
 }
Exemplo n.º 4
0
 public function _process($params)
 {
     $data = array('VPSProtocol' => '2.23', 'TxType' => 'PAYMENT', 'Vendor' => $this->settings['vendor'], 'VendorTxCode' => $params['transaction_id'], 'Description' => $params['reference'], 'Amount' => sprintf('%01.2f', $params['amount']), 'Currency' => $params['currency_code'], 'CardHolder' => $params['card_name'], 'CardNumber' => $params['card_no'], 'CV2' => $params['csc'], 'CardType' => strtoupper($params['card_type']), 'ExpiryDate' => $params['exp_month'] . $params['exp_year'] % 100, 'AccountType' => 'E', 'ApplyAVSCV2' => 2);
     if ($data['CardType'] == 'MASTERCARD') {
         $data['CardType'] = 'MC';
     }
     if (!empty($params['card_issue'])) {
         $data['IssueNumber'] = $params['card_issue'];
     }
     if (!empty($params['start_month']) and !empty($params['start_year'])) {
         $data['StartDate'] = $params['start_month'] . $params['start_year'] % 100;
     }
     $response = Merchant::curl_helper($this->settings['test_mode'] ? self::PROCESS_URL_TEST : self::PROCESS_URL, $data);
     if (!empty($response['error'])) {
         return new Merchant_response('failed', $response['error']);
     }
     // convert weird ini-type format to a useful array
     $response_array = explode("\n", $response['data']);
     foreach ($response_array as $key => $value) {
         unset($response_array[$key]);
         $line = explode('=', $value, 2);
         $response_array[trim($line[0])] = isset($line[1]) ? trim($line[1]) : '';
     }
     if (empty($response_array['Status'])) {
         return new Merchant_response('failed', 'invalid_response');
     } elseif ($response_array['Status'] == 'OK') {
         return new Merchant_response('authorized', $response_array['StatusDetail'], $response_array['VPSTxId'], (double) $params['amount']);
     } else {
         return new Merchant_response('declined', $response_array['StatusDetail']);
     }
 }
Exemplo n.º 5
0
 public static function getMerchant()
 {
     if (!self::$merchant) {
         $class = get_called_class();
         $class = substr($class, strrpos($class, '\\') + 1);
         self::$merchant = Merchant::get($class, 'object_name');
     }
     return self::$merchant;
 }
 public function _process($params)
 {
     $fp_sequence = $params['reference'];
     $time = time();
     $fingerprint = AuthorizeNetSIM_Form::getFingerprint($this->settings['api_login_id'], $this->settings['transaction_key'], $params['amount'], $fp_sequence, $time);
     $data = array('x_amount' => $params['amount'], 'x_delim_data' => 'FALSE', 'x_fp_sequence' => $fp_sequence, 'x_fp_hash' => $fingerprint, 'x_fp_timestamp' => $time, 'x_relay_response' => 'TRUE', 'x_relay_url' => $params['return_url'], 'x_login' => $this->settings['api_login_id'], 'x_show_form' => 'PAYMENT_FORM');
     $sim = new AuthorizeNetSIM_Form($data);
     $post_url = $this->settings['test_mode'] ? self::PROCESS_URL_TEST : self::PROCESS_URL;
     Merchant::redirect_post($post_url, $sim->getHiddenFieldString());
 }
 function add()
 {
     //debug($_SERVER['DOCUMENT_ROOT']);
     include $_SERVER['DOCUMENT_ROOT'] . "/app/webroot/payment/Sfa/BillToAddress.php";
     include $_SERVER['DOCUMENT_ROOT'] . "/app/webroot/payment/Sfa/CardInfo.php";
     include $_SERVER['DOCUMENT_ROOT'] . "/app/webroot/payment/Sfa/Merchant.php";
     include $_SERVER['DOCUMENT_ROOT'] . "/app/webroot/payment/Sfa/MPIData.php";
     include $_SERVER['DOCUMENT_ROOT'] . "/app/webroot/payment/Sfa/ShipToAddress.php";
     include $_SERVER['DOCUMENT_ROOT'] . "/app/webroot/payment/Sfa/PGResponse.php";
     include $_SERVER['DOCUMENT_ROOT'] . "/app/webroot/payment/Sfa/PostLibPHP.php";
     include $_SERVER['DOCUMENT_ROOT'] . "/app/webroot/payment/Sfa/PGReserveData.php";
     $oMPI = new MPIData();
     $oCI = new CardInfo();
     $oPostLibphp = new PostLibPHP();
     $oMerchant = new Merchant();
     $oBTA = new BillToAddress();
     $oSTA = new ShipToAddress();
     $oPGResp = new PGResponse();
     $oPGReserveData = new PGReserveData();
     $oMerchant->setMerchantDetails("96039227", "96039227", "96039227", "10.10.10.238", rand() . "", "Ord1234", $_SERVER['HTTP_HOST'] . "/app/webroot/payment/SFAResponse.php", "POST", "INR", "INV123", "req.Sale", "100", "", "Ext1", "true", "Ext3", "Ext4", "New PHP");
     $oBTA->setAddressDetails("CID", "Tester", "Aline1", "Aline2", "Aline3", "Pune", "A.P", "48927489", "IND", "*****@*****.**");
     $oSTA->setAddressDetails("Add1", "Add2", "Add3", "City", "State", "443543", "IND", "*****@*****.**");
     #$oMPI->setMPIRequestDetails("1245","12.45","356","2","2 shirts","12","20011212","12","0","","image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*","Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)");
     //debug( $oPostLibphp);
     // debug( $oMerchant);
     // debug( $oMerchant);
     // debug( $oMerchant);
     $oPGResp = $oPostLibphp->postSSL($oBTA, $oSTA, $oMerchant, $oMPI, $oPGReserveData);
     if ($oPGResp->getRespCode() == '000') {
         $url = $oPGResp->getRedirectionUrl();
         #$url =~ s/http/https/;
         #print "Location: ".$url."\n\n";
         #header("Location: ".$url);
         redirect($url);
     } else {
         print "Error Occured.<br>";
         print "Error Code:" . $oPGResp->getRespCode() . "<br>";
         print "Error Message:" . $oPGResp->getRespMessage() . "<br>";
     }
 }
Exemplo n.º 8
0
 private function _verifyGatewayResponse($response)
 {
     if (isset($response['response']['merchant'])) {
         // return a populated instance of merchant
         return new Result\Successful([Merchant::factory($response['response']['merchant']), OAuthCredentials::factory($response['response']['credentials'])]);
     } else {
         if (isset($response['apiErrorResponse'])) {
             return new Result\Error($response['apiErrorResponse']);
         } else {
             throw new Exception\Unexpected("Expected merchant or apiErrorResponse");
         }
     }
 }
Exemplo n.º 9
0
 public function _process($params)
 {
     $request = array('amount' => (int) ($params['amount'] * 100), 'card' => $params['token'], 'currency' => strtolower($params['currency_code']), 'description' => $params['reference']);
     $response = Merchant::curl_helper(self::API_ENDPOINT . '/v1/charges', $request, $this->settings['api_key']);
     if (!empty($response['error'])) {
         return new Merchant_response('failed', $response['error']);
     }
     $data = json_decode($response['data']);
     if (isset($data->error)) {
         return new Merchant_response('declined', $data->error->message);
     } else {
         return new Merchant_response('authorized', '', $data->id, $data->amount / 100);
     }
 }
Exemplo n.º 10
0
 public function _process($params)
 {
     // post data to 2checkout
     $data = array('sid' => $this->settings['account_no'], 'cart_order_id' => $params['reference'], 'total' => $params['amount'], 'tco_currency' => $params['currency_code'], 'skip_landing' => 1, 'x_Receipt_Link_URL' => $params['return_url']);
     foreach (array('card_holder_name' => 'card_name', 'street_address' => 'address', 'street_address2' => 'address2', 'city' => 'city', 'state' => 'region', 'zip' => 'postcode', 'country' => 'country', 'phone' => 'phone', 'email' => 'email') as $key => $field) {
         if (isset($params[$field])) {
             $data[$key] = $params[$field];
         }
     }
     if ($this->settings['test_mode']) {
         $data['demo'] = 'Y';
     }
     Merchant::redirect_post(self::PROCESS_URL, $data);
 }
Exemplo n.º 11
0
 public function _process($params)
 {
     $card_name = explode(' ', $params['card_name'], 2);
     $data = array('USER' => $this->settings['username'], 'PWD' => $this->settings['password'], 'SIGNATURE' => $this->settings['signature'], 'VERSION' => '65.1', 'METHOD' => 'doDirectPayment', 'PAYMENTACTION' => 'Sale', 'AMT' => sprintf('%01.2f', $params['amount']), 'CURRENCYCODE' => $params['currency_code'], 'ACCT' => $params['card_no'], 'EXPDATE' => $params['exp_month'] . $params['exp_year'], 'CVV2' => $params['csc'], 'IPADDRESS' => $this->CI->input->ip_address(), 'FIRSTNAME' => $card_name[0], 'LASTNAME' => isset($card_name[1]) ? $card_name[1] : '');
     if (isset($params['card_type'])) {
         $data['CREDITCARDTYPE'] = ucfirst($params['card_type']);
         if ($data['CREDITCARDTYPE'] == 'Mastercard') {
             $data['CREDITCARDTYPE'] = 'MasterCard';
         }
     }
     if (isset($params['card_issue'])) {
         $data['ISSUENUMBER'] = $params['card_issue'];
     }
     if (isset($params['start_month']) and isset($params['start_year'])) {
         $data['STARTDATE'] = $params['start_month'] . $params['start_year'];
     }
     if (isset($params['address'])) {
         $data['STREET'] = $params['address'];
     }
     if (isset($params['city'])) {
         $data['CITY'] = $params['city'];
     }
     if (isset($params['region'])) {
         $data['STATE'] = $params['region'];
     }
     if (isset($params['postcode'])) {
         $data['ZIP'] = $params['postcode'];
     }
     if (isset($params['country'])) {
         $data['COUNTRYCODE'] = strtoupper($params['country']);
     }
     // send request to paypal
     $response = Merchant::curl_helper($this->settings['test_mode'] ? self::PROCESS_URL_TEST : self::PROCESS_URL, $data);
     if (!empty($response['error'])) {
         return new Merchant_response('failed', $response['error']);
     }
     $response_array = array();
     parse_str($response['data'], $response_array);
     if (empty($response_array['ACK'])) {
         return new Merchant_response('failed', 'invalid_response');
     } elseif ($response_array['ACK'] == 'Success' or $response_array['ACK'] == 'SuccessWithWarning') {
         return new Merchant_response('authorized', '', $response_array['TRANSACTIONID'], (double) $response_array['AMT']);
     } elseif ($response_array['ACK'] == 'Failure' or $response_array['ACK'] == 'FailureWithWarning') {
         return new Merchant_response('declined', $response_array['L_ERRORCODE0'] . ': ' . $response_array['L_LONGMESSAGE0']);
     } else {
         return new Merchant_response('failed', 'invalid_response');
     }
 }
 public function _process($params)
 {
     $date_expiry = $params['exp_month'];
     $date_expiry .= $params['exp_year'] % 100;
     $request = '<Txn>' . '<PostUsername>' . $this->settings['username'] . '</PostUsername>' . '<PostPassword>' . $this->settings['password'] . '</PostPassword>' . '<CardHolderName>' . htmlspecialchars($params['card_name']) . '</CardHolderName>' . '<CardNumber>' . $params['card_no'] . '</CardNumber>' . '<Amount>' . sprintf('%01.2f', $params['amount']) . '</Amount>' . '<DateExpiry>' . $date_expiry . '</DateExpiry>' . '<Cvc2>' . $params['csc'] . '</Cvc2>' . '<InputCurrency>' . $params['currency_code'] . '</InputCurrency>' . '<TxnType>Purchase</TxnType>' . '<TxnId>' . $params['transaction_id'] . '</TxnId>' . '<MerchantReference>' . $params['reference'] . '</MerchantReference>' . '<EnableAddBillCard>' . (int) $this->settings['enable_token_billing'] . '</EnableAddBillCard>' . '</Txn>';
     $response = Merchant::curl_helper(self::PROCESS_URL, $request);
     if (!empty($response['error'])) {
         return new Merchant_response('failed', $response['error']);
     }
     $xml = simplexml_load_string($response['data']);
     if (!isset($xml->Success)) {
         return new Merchant_response('failed', 'invalid_response');
     } elseif ($xml->Success == '1') {
         return new Merchant_response('authorized', (string) $xml->HelpText, (string) $xml->DpsTxnRef, (string) $xml->Transaction->Amount);
     } else {
         return new Merchant_response('declined', (string) $xml->HelpText, (string) $xml->DpsTxnRef);
     }
 }
 public function buildMerchants($xml)
 {
     $merchants = new Merchants();
     $merchants->setPageOffset((string) $xml->PageOffset);
     $merchants->setTotalCount((string) $xml->TotalCount);
     // merchant
     $merchantArray = array();
     foreach ($xml->Merchant as $merchant) {
         $tmpMerchant = new Merchant();
         $tmpMerchant->setId((string) $merchant->Id);
         $tmpMerchant->setName((string) $merchant->Name);
         $tmpMerchant->setWebsiteUrl((string) $merchant->WebsiteUrl);
         $tmpMerchant->setPhoneNumber((string) $merchant->PhoneNumber);
         $tmpMerchant->setCategory((string) $merchant->Category);
         $tmpLocation = new Location();
         $location = $merchant->Location;
         $tmpLocation->setName((string) $location->Name);
         $tmpLocation->setDistance((string) $location->Distance);
         $tmpLocation->setDistanceUnit((string) $location->DistanceUnit);
         $tmpAddress = new Address();
         $address = $location->Address;
         $tmpAddress->setLine1((string) $address->Line1);
         $tmpAddress->setLine2((string) $address->Line2);
         $tmpAddress->setCity((string) $address->City);
         $tmpAddress->setPostalCode((string) $address->PostCode);
         $tmpCountry = new Country();
         $tmpCountry->setName((string) $address->Country->Name);
         $tmpCountry->setCode((string) $address->Country->Code);
         $tmpCountrySubdivision = new CountrySubdivision();
         $tmpCountrySubdivision->setName((string) $address->CountrySubdivision->Name);
         $tmpCountrySubdivision->setCode((string) $address->CountrySubdivision->Code);
         $tmpAddress->setCountry($tmpCountry);
         $tmpAddress->setCountrySubdivision($tmpCountrySubdivision);
         $tmpPoint = new Point();
         $point = $location->Point;
         $tmpPoint->setLatitude((string) $point->Latitude);
         $tmpPoint->setLongitude((string) $point->Longitude);
         // ACCEPTANCE FRAMEWORK NEEDS LOOKED AT <RETURN XML AND DOC DOES NOT HAVE ALL VALUES>
         //$tmpAcceptance = new Acceptance();
         //$acceptance = $merchant->Acceptance;
         // FEATURES FRAMEWORK NEEDS LOOKED AT <RETURN XML AND DOC DOES NOT HAVE ALL VALUES>
         //$tmpFeatures = new Features();
         //$features =  $merchant->Features;
         $tmpLocation->setPoint($tmpPoint);
         $tmpLocation->setAddress($tmpAddress);
         $tmpMerchant->setLocation($tmpLocation);
         array_push($merchantArray, $tmpMerchant);
     }
     $merchants->setMerchant($merchantArray);
     return $merchants;
 }
 public function _process_return()
 {
     if (($payment_code = $this->CI->input->get_post('AccessPaymentCode')) === FALSE) {
         return new Merchant_response('failed', 'invalid_response');
     }
     $data = array('CustomerID' => $this->settings['customer_id'], 'UserName' => $this->settings['username'], 'AccessPaymentCode' => $_REQUEST['AccessPaymentCode']);
     $response = Merchant::curl_helper(self::PROCESS_RETURN_URL . '?' . http_build_query($data));
     if (!empty($response['error'])) {
         return new Merchant_response('failed', $response['error']);
     }
     $xml = simplexml_load_string($response['data']);
     if (!isset($xml->TrxnStatus)) {
         return new Merchant_response('failed', 'invalid_response');
     } elseif ($xml->TrxnStatus == 'True') {
         return new Merchant_response('authorized', '', (string) $xml->TrxnNumber, (double) $xml->ReturnAmount);
     } else {
         return new Merchant_response('declined', (string) $xml->TrxnResponseMessage, (string) $xml->TrxnNumber);
     }
 }
Exemplo n.º 15
0
 public function _process($params)
 {
     // eway thows HTML formatted error if customerid is missing
     if (empty($this->settings['customer_id'])) {
         return new Merchant_response('failed', 'Missing Customer ID!');
     }
     $request = '<ewaygateway>' . '<ewayCustomerID>' . $this->settings['customer_id'] . '</ewayCustomerID>' . '<ewayTotalAmount>' . sprintf('%01d', $params['amount'] * 100) . '</ewayTotalAmount>' . '<ewayCustomerInvoiceDescription>' . $params['reference'] . '</ewayCustomerInvoiceDescription>' . '<ewayCustomerInvoiceRef>' . $params['transaction_id'] . '</ewayCustomerInvoiceRef>' . '<ewayCardHoldersName>' . $params['card_name'] . '</ewayCardHoldersName>' . '<ewayCardNumber>' . $params['card_no'] . '</ewayCardNumber>' . '<ewayCardExpiryMonth>' . $params['exp_month'] . '</ewayCardExpiryMonth>' . '<ewayCardExpiryYear>' . $params['exp_year'] % 100 . '</ewayCardExpiryYear>' . '<ewayTrxnNumber>' . $params['transaction_id'] . '</ewayTrxnNumber>' . '<ewayCVN>' . $params['csc'] . '</ewayCVN>' . '<ewayCustomerFirstName></ewayCustomerFirstName>' . '<ewayCustomerLastName></ewayCustomerLastName>' . '<ewayCustomerEmail></ewayCustomerEmail>' . '<ewayCustomerAddress></ewayCustomerAddress>' . '<ewayCustomerPostcode></ewayCustomerPostcode>' . '<ewayOption1></ewayOption1>' . '<ewayOption2></ewayOption2>' . '<ewayOption3></ewayOption3>' . '</ewaygateway>';
     $response = Merchant::curl_helper($this->settings['test_mode'] ? self::PROCESS_URL_TEST : self::PROCESS_URL, $request);
     if (!empty($response['error'])) {
         return new Merchant_response('failed', $response['error']);
     }
     $xml = simplexml_load_string($response['data']);
     if (!isset($xml->ewayTrxnStatus)) {
         return new Merchant_response('failed', 'invalid_response');
     } elseif ($xml->ewayTrxnStatus == 'True') {
         return new Merchant_response('authorized', (string) $xml->ewayTrxnError, (string) $xml->ewayTrxnNumber, (double) $xml->ewayReturnAmount / 100);
     } else {
         return new Merchant_response('declined', (string) $xml->ewayTrxnError);
     }
 }
Exemplo n.º 16
0
 public function _process_return()
 {
     if ($this->CI->input->get('result', TRUE) === FALSE) {
         return new Merchant_response('failed', 'invalid_response');
     }
     // validate dps response
     $request = '<ProcessResponse>' . '<PxPayUserId>' . $this->settings['user_id'] . '</PxPayUserId>' . '<PxPayKey>' . $this->settings['key'] . '</PxPayKey>' . '<Response>' . $this->CI->input->get('result', TRUE) . '</Response>' . '</ProcessResponse>';
     $response = Merchant::curl_helper(self::PROCESS_URL, $request);
     if (!empty($response['error'])) {
         return new Merchant_response('failed', $response['error']);
     }
     $xml = simplexml_load_string($response['data']);
     if (!isset($xml->Success)) {
         return new Merchant_response('failed', 'invalid_response');
     } elseif ($xml->Success == '1') {
         return new Merchant_response('authorized', (string) $xml->ResponseText, (string) $xml->DpsTxnRef, (double) $xml->AmountSettlement);
     } else {
         return new Merchant_response('declined', (string) $xml->ResponseText, (string) $xml->DpsTxnRef);
     }
 }
Exemplo n.º 17
0
 public function _process($params)
 {
     $data = array('instId' => $this->settings['installation_id'], 'cartId' => $params['reference'], 'amount' => $params['amount'], 'currency' => $params['currency_code'], 'testMode' => $this->settings['test_mode'] ? 100 : 0, 'MC_callback' => $params['return_url']);
     if (!empty($params['card_name'])) {
         $data['name'] = $params['card_name'];
     }
     if (!empty($params['address'])) {
         $data['address1'] = $params['address'];
     }
     if (!empty($params['address2'])) {
         $data['address2'] = $params['address2'];
     }
     if (!empty($params['city'])) {
         $data['town'] = $params['city'];
     }
     if (!empty($params['region'])) {
         $data['region'] = $params['region'];
     }
     if (!empty($params['postcode'])) {
         $data['postcode'] = $params['postcode'];
     }
     if (!empty($params['country'])) {
         $data['country'] = $params['country'];
     }
     if (!empty($params['phone'])) {
         $data['tel'] = $params['phone'];
     }
     if (!empty($params['email'])) {
         $data['email'] = $params['email'];
     }
     if (!empty($this->settings['secret'])) {
         $data['signatureFields'] = 'instId:amount:currency:cartId';
         $signature_data = array($this->settings['secret'], $data['instId'], $data['amount'], $data['currency'], $data['cartId']);
         $data['signature'] = md5(implode(':', $signature_data));
     }
     $post_url = $this->settings['test_mode'] ? self::PROCESS_URL_TEST : self::PROCESS_URL;
     Merchant::redirect_post($post_url, $data);
 }
 public function _process($params)
 {
     $fp_sequence = $params['reference'];
     $time = time();
     $fingerprint = AuthorizeNetSIM_Form::getFingerprint($this->settings['api_login_id'], $this->settings['transaction_key'], $params['amount'], $fp_sequence, $time);
     $data = array('x_amount' => $params['amount'], 'x_delim_data' => 'FALSE', 'x_fp_sequence' => $fp_sequence, 'x_fp_hash' => $fingerprint, 'x_fp_timestamp' => $time, 'x_invoice_num' => $params['reference'], 'x_relay_response' => 'TRUE', 'x_relay_url' => $params['return_url'], 'x_login' => $this->settings['api_login_id'], 'x_show_form' => 'PAYMENT_FORM', 'x_customer_ip' => $this->CI->input->ip_address());
     // set extra billing details if we have them
     if (isset($params['card_name'])) {
         $names = explode(' ', $params['card_name'], 2);
         $data['x_first_name'] = $names[0];
         $data['x_last_name'] = isset($names[1]) ? $names[1] : '';
     }
     if (isset($params['address']) and isset($params['address2'])) {
         $params['address'] = trim($params['address'] . " \n" . $params['address2']);
     }
     foreach (array('x_company' => 'company', 'x_address' => 'address', 'x_city' => 'city', 'x_state' => 'region', 'x_zip' => 'postcode', 'x_country' => 'country', 'x_phone' => 'phone', 'x_email' => 'email') as $key => $field) {
         if (isset($params[$field])) {
             $data[$key] = $params[$field];
         }
     }
     $sim = new AuthorizeNetSIM_Form($data);
     $post_url = $this->settings['test_mode'] ? self::PROCESS_URL_TEST : self::PROCESS_URL;
     Merchant::redirect_post($post_url, $sim->getHiddenFieldString());
 }
<?php

include "Sfa/Merchant.php";
include "Sfa/PGResponse.php";
include "Sfa/PostLibPHP.php";
$oPostLibphp = new PostLibPHP();
$oMerchant = new Merchant();
$oPGResp = new PGResponse();
$oMerchant->setMerchantRelatedTxnDetails("00002116", "00002116", "00002116", "21345", "201208091494345", "000000130470", "130470", "", "", "INR", "req.Refund", "10", "", "Ext1", "Ext2", "Ext3", "Ext4", "Ext5");
$oPgResp = $oPostLibphp->postRelatedTxn($oMerchant);
print "Response Code:" . $oPgResp->getRespCode() . "<br>";
print "Response Message" . $oPgResp->getRespMessage() . "<br>";
print "Transaction ID" . $oPgResp->getTxnId() . "<br>";
print "Epg Transaction ID" . $oPgResp->getEpgTxnId() . "<br>";
print "Auth Id Code :" . $oPgResp->getAuthIdCode() . "<br>";
print "RRN :" . $oPgResp->getRRN() . "<br>";
Exemplo n.º 20
0
 /**
  * 微信小店组件
  * @return object
  */
 public function getMerchant()
 {
     if ($this->_merchant === null) {
         $this->_merchant = Yii::createObject(Merchant::className(), [$this]);
     }
     return $this->_merchant;
 }
Exemplo n.º 21
0
$pgRespCode = null;
$txnid = null;
$guid = null;
$exp1 = null;
$errMsg = null;
$errCode = null;
$mod1 = null;
$mid1 = null;
$amt = null;
$curr = null;
$npciResp = null;
$epgRefNum = null;
$crdNum = "6076000000000022";
$oPostLibPHP = new PostLibPHP();
$oPSD = new PaySecureDetails();
$oMerchant = new Merchant();
$oPgResponse = new PGResponse();
$oCI = new CardInfo();
$oReserveData = new PGReserveData();
$oMerchant->setMerchantDetails("00001203", "00001203", "00001203", "10.10.10.167", rand() . "", "", "", "", "INR", "INV123", "req.Sale", "10", "", "Ext1", "Ext2", "Ext3", "Ext4", "Ext5");
$oCI->setCardDetails("RUPAY", $crdNum, "234", "2018", "12", "Tester", "DEBIT");
if ($sendA == "N") {
    print ".....Inside TestAuth1.php....." . "<br>";
    $mod1 = $_POST['Modulus'];
    $txnid = $_POST['TxnID'];
    $guid = $_POST['GUID'];
    $exp1 = $_POST['Exponent'];
    $errMsg = $_POST['ErrMsg'];
    $errCode = $_POST['ErrCode'];
    $crdNum = $_POST['CardNum'];
    $epgRefNum = $_POST['EpgTxnID'];
$months = 0;
$total_months = 0;
$bankstatements = 0;
$bank_average = 0;
$nfs_average = 0;
$creditcard = 0;
$creditcard_t = '';
$creditcard_average = '';
$email = '';
$emails = '';
$tutorial = '';
//Objects
$filter = new Filter();
$lender = new Lender();
$business = new Business();
$merchant = new Merchant();
$emailobj = new Email();
if (isset($_GET['id_merchant'])) {
    $id_merchant = $_GET['id_merchant'];
    $merchant->Merchant($id_merchant);
    $filter->Filter($_GET['id_merchant']);
    $type_business = $filter->getBusiness();
    $foreclosure = $filter->getForeclosure();
    $landlord = $filter->getLandlord();
    $years = $filter->getYears();
    $months = $filter->getMonths();
    $total_months = $filter->getTotalMonths();
    $bankstatements = $filter->getBankStatements();
    $bank_average = $filter->getBankAverage();
    $nfs_average = $filter->getNSF();
    $creditcard = $filter->getCreditCard();
Exemplo n.º 23
0
 public function sign()
 {
     // dump($_POST);
     /*
     		  $version =  "1.0.0";  //  //版本号
     		  $charset =  "UTF-8";  // 字符编码
     		  $transType =  "001";  // 消费类型
     		  $transCode =  "0001";  // 交易代码
     		  $merchantId = "900000000009";  //商户号
     		  // $platMerchantId =  "";  // 平台商户号
     		  $backEndUrl = "http:ppp2p.mifengwo.me";  //通知url
     		  $frontEndUrl = "http:ppp2p.mifengwo.me";  //返回url
     		  // $sameOrderFlag =  "";  // 同一订单号重复提交标志
     		  // $orderTime =  "";  // 交易开始日期
     		  $mercOrderNo =  "1234567890";  //商户订单号、 流水号
     		  // $merchantTransDesc =  "";  //商户自定义交易说明
     		  // $language =  "";  //语言
     		  // $commodityList1 =  "";  //商品1
     		  // $commodityList2 =  "";  //商品2
     		  $orderAmount =  "1";  //交易金额
     		  $orderCurrency =  "CNY";  //交易币种
     		  // $distributeInfo =  "";  //分润信息
     		  // $customerMerchantId =  "";  //用户在商户的会员号
     		  // $customerPAFId =  "";  // 用户平安付账户名
     		  // $customerName =  "";  //用户姓名
     		  // $customerIdType =  "";  //用户证件类型
     		  // $customerIdNo =  "";  //用户证件号码
     		  // $specifiedPayType =  "";  //指定支付方式
     		  // $specifiedBankNumber =  "";  //指定银行编码
     		  // $transTimeout =  "";  // 交易超时时间
     		  // $antiPhishingTimeStamp =  "";  //防钓鱼时间戳
     		  // $customerIp =  "";  //用户Ip
     		  // $customerRefer =  "";  //用户网站
     		  // $token =  "";  //联合登陆散列码
     		  // $mercRetrunPara =  "";  //商户回传参数
     		  // $merReserved =  "";  //商户保留域
     		  // $merReserved2 =  "";  //商户保留域2
     		  // $businessScene =  "";  //业务场景
     		  $signMethod =  "SHA-256";  //签名方法
     		  $origMercOrderNo =  "";  //原商户订单号
     		  $origOrderTraceNo =  "";  //原始平安交易号
     		  $merchantKey = "9286ed7a54e94c5e96820896d02c412d";  //商户签约密钥
     		  $signature =  "";  // 签名信息
     
     
     
     
     		  //我们把请求参数一个个拼接
     			$data = '';  //
     			$data = $data.$version;
     			$data = $data.$charset;
     			$data = $data.$transType;
     			$data = $data.$transCode;
     			$data = $data.$merchantId;
     			// $data = $data.$platMerchantId;
     			$data = $data.$backEndUrl;
     			$data = $data.$frontEndUrl;
     			// $data = $data.$sameOrderFlag;
     			// $data = $data.$orderTime;
     			$data = $data.$mercOrderNo;
     			// $data = $data.$merchantTransDesc;
     			// $data = $data.$language;
     			// $data = $data.$commodityList1;
     			// $data = $data.$commodityList2;
     			$data = $data.$orderAmount;
     			$data = $data.$orderCurrency;
     			// $data = $data.$distributeInfo;
     			// $data = $data.$customerMerchantId;
     			// $data = $data.$customerPAFId;
     			// $data = $data.$customerName;
     			// $data = $data.$customerIdType;
     			// $data = $data.$customerIdNo;
     			// $data = $data.$specifiedPayType;
     			// $data = $data.$specifiedBankNumber;
     			// $data = $data.$transTimeout;
     			// $data = $data.$antiPhishingTimeStamp;
     			// $data = $data.$customerIp;
     			// $data = $data.$customerRefer;
     			// $data = $data.$token;
     			// $data = $data.$mercRetrunPara;
     			// $data = $data.$merReserved;
     			// $data = $data.$merReserved2;
     			// $data = $data.$businessScene;
     			$data = $data.$signMethod;
     			$data = $data.$origMercOrderNo;
     			$data = $data.$origOrderTraceNo;
     			// $data = $data.$merchantKey;
     			// $data = $data.$signature;
     */
     // dump($_POST);
     // $data = array(
     // 		  "version" => "1.0.0",
     // 		  "charset" => "UTF-8",
     // 		  "transType" => "001",
     // 		  "transCode" => "0001",
     // 		  "merchantId" => "900000000009",
     // 		  "backEndUrl" => "http://ppp2p.mifengwo.me",
     // 		  "frontEndUrl" => "http://ppp2p.mifengwo.me",
     // 		  "mercOrderNo" => "201504281110",
     // 		  "orderAmount" => "1",
     // 		  "orderCurrency" => "CNY",
     // 		  "signMethod" => "SHA-256",
     // 		  "merchantKey" => "9286ed7a54e94c5e96820896d02c412d"
     // 	);
     //加载平安付
     // Vendor('PaPay.conf');
     // Vendor('PaPay.http');
     // Vendor('PaPay.merchant');
     // // $sign=Merchant::sign($data);
     // $sign=Merchant::sign($_POST);
     // dump($sign);
     // dump($data['merchantKey']);
     // $postData = "version=".$data['version']&"charset=".$data['charset']&"transType=".$data['transType']&"merchantId=".$data['merchantId']&"backEndUrl=".$data['backEndUrl']&"frontEndUrl=".$data['frontEndUrl']&"mercOrderNo=".$data['mercOrderNo']&"orderAmount=".$data['orderAmount']&"orderCurrency=".$data['orderCurrency']&"signMethod=".$data['signMethod']&"merchantKey=".$data['merchantKey']&"signature=".$sign;
     // dump($postData);
     // $post_data =array(
     //                  "version = 1.0.0",
     // 		  "charset = UTF-8",
     // 		  "transType = 001",
     // 		  "transCode = 0001",
     // 		  "merchantId = 900000000009",
     // 		  "backEndUrl = http://ppp2p.mifengwo.me",
     // 		  "frontEndUrl = http://ppp2p.mifengwo.me",
     // 		  "mercOrderNo = 201504281110",
     // 		  "orderAmount = 1",
     // 		  "orderCurrency = CNY",
     // 		  "signMethod = SHA-256",
     // 		  "merchantKey = 9286ed7a54e94c5e96820896d02c412d"
     //          	);
     // $post_data = implode('&',$post_data);
     // $url='https://test-mapi.1qianbao.com:3443/revOrder';
     //    $ch = curl_init();
     //    curl_setopt($ch, CURLOPT_POST, 1);
     //    curl_setopt($ch, CURLOPT_URL,$url);
     //    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
     //    ob_start();
     //    curl_exec($ch);
     //    $result = ob_get_contents() ;
     //    ob_end_clean();
     // echo $result;
     // $data = array (
     // 		  "version" => "1.0.0",
     // 		  "charset" => "UTF-8",
     // 		  "transType" => "001",
     // 		  "transCode" => "0001",
     // 		  "merchantId" => "900000000009",
     // 		  "backEndUrl" => "http://ppp2p.mifengwo.me",
     // 		  "frontEndUrl" => "http://ppp2p.mifengwo.me",
     // 		  "mercOrderNo" => "201504281110",
     // 		  "orderAmount" => "1",
     // 		  "orderCurrency" => "CNY",
     // 		  "signMethod" => "SHA-256",
     // 		  "merchantKey" => "9286ed7a54e94c5e96820896d02c412d",
     // 		  "signature" => "05a636314cf91c329a48b369662405bf0c9be322d00366a568e946766d4d8e80"
     // 	);
     // $ch = curl_init();
     // curl_setopt($ch, CURLOPT_URL, 'https://test-mapi.1qianbao.com:3443/revOrder');
     // curl_setopt($ch, CURLOPT_HEADER, 0);
     // curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     // curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     // curl_setopt($ch, CURLOPT_POST, count($data));
     // curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     // $output = curl_exec($ch);
     // echo $output;
     // echo $output."<script>document.getElementById('form').action='http://www.baidu.com/s'</script>";
     // header('location:https://test-mapi.1qianbao.com:3443/revOrder?'.$postData);
     // header('location:http://demo.dev.me/admin.php/Index/sign2?'.$postData);
     // exit();
     $uri = "https://test-mapi.1qianbao.com:3443/revOrder";
     // 参数数组
     $data2 = array("version" => "1.0.0", "charset" => "UTF-8", "transType" => "001", "transCode" => "0001", "merchantId" => "900000000009", "mercOrderNo" => "1234511111", "orderAmount" => "1", "orderCurrency" => "CNY", "signMethod" => "SHA-256", "merchantKey" => "9286ed7a54e94c5e96820896d02c412d");
     //加载平安付
     Vendor('PaPay.conf');
     Vendor('PaPay.http');
     Vendor('PaPay.merchant');
     $sign = Merchant::sign($data2);
     $data2['signature'] = $sign;
     //echo $str;
     //return ;
     //$rr = $this->curlPost('https://test-mapi.1qianbao.com:3443/revOrder',$str);
     //echo $rr;
     //dump($data2);
     //return;
     // // dump($sign);
     $data3 = array("version" => "1.0.0", "charset" => "UTF-8", "transType" => "001", "transCode" => "0001", "merchantId" => "900000000009", "platMerchantId" => "", "backEndUrl" => "", "frontEndUrl" => "", "sameOrderFlag" => "", "orderTime" => "", "mercOrderNo" => "1234511111", "merchantTransDesc" => "", "language" => "", "commodityList" => "", "commodityList" => "", "orderAmount" => "1", "orderCurrency" => "CNY", "distributeInfo" => "", "customerMerchantId" => "", "customerPAFId" => "", "customerName" => "", "customerIdType" => "", "customerIdNo" => "", "specifiedPayType" => "", "specifiedBankNumber" => "", "transTimeout" => "", "antiPhishingTimeStamp" => "", "customerIp" => "", "customerRefer" => "", "token" => "", "mercRetrunPara" => "", "merReserved" => "", "merReserved2" => "", "businessScene" => "", "signMethod" => "SHA-256", "origMercOrderNo" => "", "origOrderTraceNo" => "", "merchantKey" => "9286ed7a54e94c5e96820896d02c412d", "signature" => "c62a2cc3bbb616387f242cfe2b0847733ee4e85f00140a4b31bdceb76f305c29");
     $str = "";
     foreach ($data3 as $key => $v) {
         $str .= $key . "=" . $v . "&";
     }
     $str2 = substr($str, 0, -1);
     //	echo $str2;
     //return;
     //echo $str;
     //$data = $this->curlPost('https://test-mapi.1qianbao.com:3443/revOrder',$data3);
     //echo ($data);
     $dd = $this->postData('https://test-mapi.1qianbao.com:3443/revOrder', $str2);
     echo $dd;
     // dump($data);
     // echo "------------------------------";
     // dump($_POST);
     // curl_setopt($ch, CURLOPT_URL, 'https://test-mapi.1qianbao.com:3443/revOrder');
     // curl_setopt($ch, CURLOPT_HEADER, 0);
     // curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     // curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     // curl_setopt($ch, CURLOPT_POST, count($data));
     // curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     // $output = curl_exec($ch);
     // echo $output;
     // $ch = curl_init();//chain link fencing
     // curl_setopt($ch,CURLOPT_URL,'https://test-mapi.1qianbao.com:3443/revOrder');
     // curl_setopt($ch,CURLOPT_HEADER,1);
     // curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
     // curl_setopt($ch,CURLOPT_POST,1);
     // curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
     // $return = curl_exec();
     // curl_close($ch);
     // echo $return;
     // $login_url = 'https://test-mapi.1qianbao.com:3443/revOrder';
     // $ch = curl_init($login_url);
     // //curl_setopt($ch, CURLOPT_HEADER,0);
     // curl_setopt($ch, CURLOPT_HEADER, TRUE);
     // curl_setopt($ch, CURLOPT_NOBODY, FALSE);
     // curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
     // curl_setopt ($ch,CURLOPT_REFERER,'');
     // curl_setopt($ch,CURLOPT_POST,1);
     // curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
     // curl_setopt($hh,CURLOPT_SSL_VERIFYHOST,1);
     // 			curl_setopt($hh,CURLOPT_SSL_VERIFYPEER,FALSE);
     // // $opt[CURLOPT_SSL_VERIFYHOST] = 1;
     // //    		  $opt[CURLOPT_SSL_VERIFYPEER] = FALSE;
     // $arr = curl_exec($ch);
     // //if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == '200') {
     //     			 echo '111'.$arr;
     //}
     //curl_close($ch);
     //echo $arr;
     // $ch = curl_init ();
     // // print_r($ch);
     // curl_setopt ( $ch, CURLOPT_URL, $uri );
     // curl_setopt ( $ch, CURLOPT_POST, 1 );
     // curl_setopt ( $ch, CURLOPT_HEADER, 0 );
     // curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
     // curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
     // $return = curl_exec ( $ch );
     // curl_close ( $ch );
     // echo $return;
 }
<?php

/**
 * Created by PhpStorm.
 * User: agustin
 * Date: 27/07/2015
 * Time: 12:34
 */
$path_to_IncludeClases = "../com/payhub/ws/extra/includeClasses.php";
include_once $path_to_IncludeClases;
//Defining the Web Service URL
$WsURL = "https://sandbox-api.payhub.com/api/v2/";
$oauth_token = "2a5d6a73-d294-4fba-bfba-957a4948d4a3";
//Defining data for the SALE transaction
// Merchant data (obtained from the payHub Virtual Terminal (3rd party integration)
$merchant = new Merchant();
$merchant->setOrganizationId(10074);
$merchant->setTerminalId(134);
$transaction = new TransactionManager($merchant, $WsURL, $oauth_token);
$result = $transaction->getGeneralSettings();
var_dump($result);
Exemplo n.º 25
0
<?php

/**
 *  商户查询功能demo
 * $Author: zhaoshuangxi 
*/
error_reporting(0);
require "config.php";
require "http.php";
require "merchant.class.php";
$http = Http::factory(Http::TYPE_STREAM);
$arr = array("version" => $config['version'], "charset" => $config['charset'], "signMethod" => $config['signMethod'], "transType" => "005", "merId" => $config['merchantId'], "merchantKey" => $config['merchantKey'], "mercOrderNo" => "1234500026", "signature" => "");
$arr['signature'] = Merchant::sign($arr);
$res = $http->post($config['postUrl'], $arr);
print $res;
Exemplo n.º 26
0
 /**
  * Perform the required redirect. If no redirect is required, returns FALSE.
  */
 public function redirect()
 {
     if ($this->is_redirect() == FALSE) {
         return FALSE;
     }
     if ('POST' == strtoupper($this->redirect_method())) {
         return Merchant::post_redirect($this->redirect_url(), $this->redirect_data(), $this->redirect_message());
     }
     return Merchant::redirect($this->redirect_url());
 }
<?php

include_once 'lock.php';
//Classes
include_once 'Classes/Merchant.php';
include_once 'Classes/Filter.php';
// Variables
$id_merchant = '';
$lead = '';
$name = '';
//Objects
$merchant = new Merchant();
$filter = new Filter();
if (isset($_POST['id_merchant']) && !is_numeric($_POST['id_merchant'])) {
    $merchant->setLead($_POST['lead']);
    $merchant->setName($_POST['name']);
    $merchant->insertMerchant();
    $lastmerchant = $merchant->getIDMerchant();
    $filter->setIdMerchant($lastmerchant);
    $filter->insertFilter();
}
if (isset($_GET['edit'])) {
    $merchant->Merchant($_GET['edit']);
    $id_merchant = $merchant->getIDMerchant();
    $lead = $merchant->getLead();
    $name = $merchant->getName();
}
if (isset($_POST['id_merchant']) && is_numeric($_POST['id_merchant'])) {
    $merchant->setLead($_POST['lead']);
    $merchant->setName($_POST['name']);
    $merchant->updateMerchant();
 public function convertData($json)
 {
     $data = json_decode($json, true);
     $this->merchant = Merchant::fromArray($data);
 }
Exemplo n.º 29
0
 public function postSynclegacy()
 {
     set_time_limit(0);
     $mymerchant = Merchant::where('group_id', 4)->get();
     $count = 0;
     foreach ($mymerchant->toArray() as $m) {
         $member = Member::where('legacyId', $m['id'])->first();
         if ($member) {
         } else {
             $member = new Member();
         }
         foreach ($m as $k => $v) {
             $member->{$k} = $v;
         }
         if (!isset($member->status)) {
             $member->status = 'inactive';
         }
         if (!isset($member->url)) {
             $member->url = '';
         }
         $member->legacyId = new MongoInt32($m['id']);
         $member->roleId = Prefs::getRoleId('Merchant');
         $member->unset('id');
         $member->save();
         $count++;
     }
     return Response::json(array('result' => 'OK', 'count' => $count));
 }
<?php

/**
 * Created by PhpStorm.
 * User: agustin
 * Date: 28/07/2015
 * Time: 15:40
 */
$path_to_IncludeClases = "../com/payhub/ws/extra/includeClasses.php";
include_once $path_to_IncludeClases;
//Defining the Web Service URL
$WsURL = "https://staging-api.payhub.com/api/v2/";
$oauth_token = "107d74ab-4a18-4713-88ff-69bd05710086";
//Defining data for the SALE transaction
// Merchant data (obtained from the payHub Virtual Terminal (3rd party integration)
$merchant = new Merchant();
$merchant->setOrganizationId(10127);
$merchant->setTerminalId(215);
$transaction = new TransactionManager($merchant, $WsURL, $oauth_token);
$result = $transaction->getAllCustomerForRecurringBillInformation();
var_dump($result);