當前位置: 首頁>>代碼示例>>PHP>>正文


PHP stdClass::orderId方法代碼示例

本文整理匯總了PHP中stdClass::orderId方法的典型用法代碼示例。如果您正苦於以下問題:PHP stdClass::orderId方法的具體用法?PHP stdClass::orderId怎麽用?PHP stdClass::orderId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在stdClass的用法示例。


在下文中一共展示了stdClass::orderId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: buildTransactionRequest

 /**
  * Build a transaction object to be added to payment request
  * @param array $parameters the parameters to build a transaction
  * @param strng $lang to be used
  * @return the transaction built
  * @throws InvalidArgumentException if any paramter is invalid
  * 
  */
 private static function buildTransactionRequest($parameters, $lang)
 {
     $transaction = new stdClass();
     $order = null;
     $transaction->paymentCountry = CommonRequestUtil::getParameter($parameters, PayUParameters::COUNTRY);
     if (CommonRequestUtil::getParameter($parameters, PayUParameters::ORDER_ID) == null) {
         $signature = null;
         if (CommonRequestUtil::getParameter($parameters, PayUParameters::SIGNATURE) != null) {
             $signature = CommonRequestUtil::getParameter($parameters, PayUParameters::SIGNATURE);
         }
         $merchantId = PayU::$merchantId;
         $order = RequestPaymentsUtil::buildOrderRequest($parameters, $lang);
         if ($signature == null && $merchantId != null) {
             $signature = SignatureUtil::buildSignature($order, $merchantId, PayU::$apiKey, SignatureUtil::MD5_ALGORITHM);
         }
         $order->signature = $signature;
         $transaction->order = $order;
     } else {
         $orderId = CommonRequestUtil::getParameter($parameters, PayUParameters::ORDER_ID);
         $order = new stdClass();
         $order->orderId($orderId);
         $transaction . setOrder($order);
     }
     $transaction->order->buyer = RequestPaymentsUtil::buildBuyer($parameters);
     if (CommonRequestUtil::getParameter($parameters, PayUParameters::PAYER_IP_ADDRESS) != null) {
         $transaction->ipAddress = CommonRequestUtil::getParameter($parameters, PayUParameters::PAYER_IP_ADDRESS);
     } else {
         $transaction->ipAddress = RequestPaymentsUtil::getIpAddress();
     }
     if (CommonRequestUtil::getParameter($parameters, PayUParameters::PAYER_COOKIE) != null) {
         $transaction->cookie = CommonRequestUtil::getParameter($parameters, PayUParameters::PAYER_COOKIE);
     } else {
         $transaction->cookie = 'cookie_' . microtime();
     }
     $transaction->userAgent = sprintf("%s %s", PayU::API_NAME, PayU::API_VERSION);
     $transaction->source = PayU::API_CODE_NAME;
     if (CommonRequestUtil::getParameter($parameters, PayUParameters::CREDIT_CARD_NUMBER) != null) {
         $transaction->creditCard = RequestPaymentsUtil::buildCreditCardTransaction($transaction, $parameters);
     } else {
         if (CommonRequestUtil::getParameter($parameters, PayUParameters::TOKEN_ID) != null) {
             $transaction->creditCard = RequestPaymentsUtil::buildCreditCardForToken($parameters);
         }
     }
     if (CommonRequestUtil::getParameter($parameters, PayUParameters::INSTALLMENTS_NUMBER) != null) {
         $transaction = RequestPaymentsUtil::addExtraParameter($transaction, PayUKeyMapName::TRANSACTION_INSTALLMENTS_NUMBER, CommonRequestUtil::getParameter($parameters, PayUParameters::INSTALLMENTS_NUMBER));
     }
     $expirationDate = CommonRequestUtil::getParameter($parameters, PayUParameters::EXPIRATION_DATE);
     if (isset($expirationDate) && CommonRequestUtil::isValidDate($expirationDate, PayUConfig::PAYU_DATE_FORMAT, PayUParameters::EXPIRATION_DATE)) {
         $transaction->expirationDate = $expirationDate;
     }
     $transaction->creditCardTokenId = CommonRequestUtil::getParameter($parameters, PayUParameters::TOKEN_ID);
     $paymentMethod = CommonRequestUtil::getParameter($parameters, PayUParameters::PAYMENT_METHOD);
     if (!PaymentMethods::isValidPaymentMethod($paymentMethod)) {
         throw new InvalidArgumentException(sprintf("The payment method value %s sent in parameter %s is invalid", $paymentMethod, PayUParameters::PAYMENT_METHOD));
     }
     $transaction->paymentMethod = $paymentMethod;
     $transaction->payer = RequestPaymentsUtil::buildPayer($parameters);
     $transaction->order = $order;
     return $transaction;
 }
開發者ID:brayancruces,項目名稱:integracion-payu-php,代碼行數:68,代碼來源:RequestPaymentsUtil.php


注:本文中的stdClass::orderId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。