当前位置: 首页>>代码示例>>PHP>>正文


PHP Merchant类代码示例

本文整理汇总了PHP中Merchant的典型用法代码示例。如果您正苦于以下问题:PHP Merchant类的具体用法?PHP Merchant怎么用?PHP Merchant使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Merchant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: capture

 /**
  * @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());
 }
开发者ID:3lchamac0,项目名称:IlisPaymentBundle,代码行数:34,代码来源:Redsys.php

示例2: compare

 public static function compare(Merchant $a, Merchant $b)
 {
     if ($a->getApiKey() != $b->getApiKey()) {
         return false;
     }
     if ($a->getEndpoint() != $b->getEndpoint()) {
         return false;
     }
     return true;
 }
开发者ID:expressly,项目名称:php-common,代码行数:10,代码来源:Merchant.php

示例3: _process_return

 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);
         }
     }
 }
开发者ID:rosellkarlrossj,项目名称:FireSALE,代码行数:29,代码来源:merchant_paypal.php

示例4: _process

 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']);
     }
 }
开发者ID:rat4m3n,项目名称:PyroCart,代码行数:31,代码来源:merchant_sagepay_direct.php

示例5: getMerchant

 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;
 }
开发者ID:krvd,项目名称:cms-Inji,代码行数:9,代码来源:MerchantHelper.php

示例6: _process

 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());
 }
开发者ID:rat4m3n,项目名称:PyroCart,代码行数:10,代码来源:merchant_authorize_net_sim.php

示例7: add

 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", "tester@soft.com");
     $oSTA->setAddressDetails("Add1", "Add2", "Add3", "City", "State", "443543", "IND", "sad@df.com");
     #$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>";
     }
 }
开发者ID:Numerico-Informatic-Systems-Pvt-Ltd,项目名称:gsmpoly,代码行数:40,代码来源:BlogsController.php

示例8: _verifyGatewayResponse

 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");
         }
     }
 }
开发者ID:braintree,项目名称:braintree_php,代码行数:13,代码来源:MerchantGateway.php

示例9: _process

 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);
     }
 }
开发者ID:rosellkarlrossj,项目名称:FireSALE,代码行数:14,代码来源:merchant_stripe.php

示例10: _process

 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);
 }
开发者ID:rosellkarlrossj,项目名称:FireSALE,代码行数:14,代码来源:merchant_2checkout.php

示例11: _process

 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');
     }
 }
开发者ID:rat4m3n,项目名称:PyroCart,代码行数:48,代码来源:merchant_paypal_pro.php

示例12: _process

 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);
     }
 }
开发者ID:rosellkarlrossj,项目名称:FireSALE,代码行数:18,代码来源:merchant_dps_pxpost.php

示例13: buildMerchants

 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;
 }
开发者ID:vicenteguerra,项目名称:Flashbuy,代码行数:51,代码来源:MerchantLocationService.php

示例14: _process_return

 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);
     }
 }
开发者ID:rosellkarlrossj,项目名称:FireSALE,代码行数:19,代码来源:merchant_eway_shared.php

示例15: _process

 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);
     }
 }
开发者ID:rat4m3n,项目名称:PyroCart,代码行数:20,代码来源:merchant_eway.php


注:本文中的Merchant类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。