本文整理汇总了PHP中Environment::setReportsCustomUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::setReportsCustomUrl方法的具体用法?PHP Environment::setReportsCustomUrl怎么用?PHP Environment::setReportsCustomUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::setReportsCustomUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($isCashPayment = false, $credentials = array())
{
PayU::$language = SupportedLanguages::ES;
//Seleccione el idioma.
if (sizeof($credentials) > 0) {
if (isset($credentials['accountID'])) {
$this->setAccountID($credentials['accountID']);
}
if (isset($credentials['apiKey'])) {
$this->setApiKey($credentials['apiKey']);
}
if (isset($credentials['apiLogin'])) {
$this->setApiLogin($credentials['apiLogin']);
}
if (isset($credentials['merchantId'])) {
$this->setMerchantId($credentials['merchantId']);
}
}
// URL de Pagos
Environment::setPaymentsCustomUrl("https://api.payulatam.com/payments-api/4.0/service.cgi");
// URL de Consultas
Environment::setReportsCustomUrl("https://api.payulatam.com/reports-api/4.0/service.cgi");
// URL de Suscripciones para Pagos Recurrentes
Environment::setSubscriptionsCustomUrl("https://api.payulatam.com/payments-api/rest/v4.3/");
//Informacion para conexion de SDK
PayU::$apiKey = $this->getApiKey();
PayU::$apiLogin = $this->getApiLogin();
PayU::$merchantId = $this->getMerchantId();
}
示例2: do_payment
static function do_payment($order_id, $description, $total, $email, $name, $dni, $card_number, $cvv, $expiration_Date, $offline_store, $is_offline)
{
require_once __DIR__ . '/payu/PayU.php';
try {
$gp_options = get_option('woocommerce_GP_PayU_offline_Gateway_settings');
PayU::$apiKey = $gp_options['api_key'];
PayU::$apiLogin = $gp_options['api_login'];
PayU::$merchantId = $gp_options['merchant_id'];
PayU::$language = SupportedLanguages::ES;
PayU::$isTest = $gp_options['environment'] == 'yes';
if (PayU::$isTest == true) {
Environment::setPaymentsCustomUrl("https://stg.api.payulatam.com/payments-api/4.0/service.cgi");
Environment::setReportsCustomUrl("https://stg.api.payulatam.com/reports-api/4.0/service.cgi");
$name = 'APPROVED';
} else {
Environment::setPaymentsCustomUrl("https://api.payulatam.com/payments-api/4.0/service.cgi");
Environment::setReportsCustomUrl("https://api.payulatam.com/reports-api/4.0/service.cgi");
}
if ($is_offline == false) {
if (preg_match('/^3[47][0-9]{13}$/', $card_number)) {
$paymentMethod = PaymentMethods::AMEX;
} elseif (preg_match('/^5[1-5][0-9]{14}$/', $card_number)) {
$paymentMethod = PaymentMethods::MASTERCARD;
} elseif (preg_match('/^4[0-9]{12}(?:[0-9]{3})?$/', $card_number)) {
$paymentMethod = PaymentMethods::VISA;
}
} else {
PayU::$isTest = false;
if ($offline_store == 'oxxo') {
$paymentMethod = PaymentMethods::OXXO;
} elseif ($offline_store == 'seveneleven') {
$paymentMethod = PaymentMethods::SEVEN_ELEVEN;
}
}
$reference_code = date("Ymd His - ") . $order_id;
$base_parameters = array(PayUParameters::ACCOUNT_ID => PayU_Middleware::$account_id, PayUParameters::REFERENCE_CODE => $reference_code, PayUParameters::DESCRIPTION => $description, PayUParameters::VALUE => $total, PayUParameters::CURRENCY => "MXN", PayUParameters::BUYER_EMAIL => $email, PayUParameters::PAYER_DNI => $dni, PayUParameters::PAYMENT_METHOD => $paymentMethod, PayUParameters::COUNTRY => PayUCountries::MX, PayUParameters::EXPIRATION_DATE => "2016-09-27T00:00:00", PayUParameters::IP_ADDRESS => $_SERVER['REMOTE_ADDR'], PayUParameters::PAYER_NAME => $name);
$online_parameters = array(PayUParameters::CREDIT_CARD_NUMBER => $card_number, PayUParameters::CREDIT_CARD_EXPIRATION_DATE => $expiration_Date, PayUParameters::CREDIT_CARD_SECURITY_CODE => $cvv, PayUParameters::PAYER_EMAIL, $email, PayUParameters::INSTALLMENTS_NUMBER => "1", PayUParameters::COUNTRY => PayUCountries::MX, PayUParameters::DEVICE_SESSION_ID => "vghs6tvkcle931686k1900o6e1", PayUParameters::PAYER_COOKIE => "11pt1t38347bs6jc9ruv2ecpv7o2", PayUParameters::USER_AGENT => $_SERVER['HTTP_USER_AGENT']);
if ($is_offline == false) {
$parameters = array_merge($base_parameters, $online_parameters);
} else {
$parameters = $base_parameters;
}
$response = PayUPayments::doAuthorizationAndCapture($parameters);
if ($response) {
$res = array('provider' => 'payu', 'order_id' => $order_id, 'reference_code' => $reference_code, 'state' => $response->transactionResponse->state, 'transaction_id' => $response->transactionResponse->transactionId, 'code' => $response->code, 'pending_reason' => $response->transactionResponse->pendingReason, 'payment_url' => $response->transactionResponse->extraParameters->URL_PAYMENT_RECEIPT_HTML, 'response_json' => json_encode($response));
do_action('gp_order_completed', json_encode($res));
return $res;
}
} catch (PayUException $e) {
do_action('gp_error_occurred', json_encode($e));
throw new Exception(__('PayU. ' . $e, 'GP_PayU_offline_Gateway'));
} catch (Exception $e) {
do_action('gp_error_occurred', json_encode($e));
throw new Exception(__('Generic. ' . $e, 'GP_PayU_offline_Gateway'));
}
}
示例3: date
* OK
* BANK_REFERENCED --bank payment
* @author nick
* @since 2015/12/09
*
*/
require_once 'payulib/PayU.php';
$startTime = date('Y-m-d H:i:s');
PayU::$apiKey = "6u39nqhq8ftd0hlvnjfs66eh8c";
PayU::$merchantId = "500238";
PayU::$apiLogin = "11959c415b33d0c";
PayU::$language = SupportedLanguages::ES;
PayU::$isTest = false;
Environment::setPaymentsCustomUrl("https://stg.api.payulatam.com/payments-api/4.0/service.cgi");
// Queries URL
Environment::setReportsCustomUrl("https://stg.api.payulatam.com/reports-api/4.0/service.cgi");
// Subscriptions for recurring payments URL
Environment::setSubscriptionsCustomUrl("https://stg.api.payulatam.com/payments-api/rest/v4.3/");
//---------------get order by order_test.php--------------------------
$filename = 'createOrderId.php';
$handle = fopen($filename, "r");
$order_id = fread($handle, filesize($filename));
fclose($handle);
$netOrder = $order_id + 1;
file_put_contents($filename, $netOrder);
//orderid = orderid + 1 in order_test.php
//---------------get order by order_test.php--------------------------
$reference = "comprame_test_" . $order_id;
$parameters = array(PayUParameters::ACCOUNT_ID => "500538", PayUParameters::REFERENCE_CODE => $reference, PayUParameters::DESCRIPTION => $reference, PayUParameters::VALUE => "20000", PayUParameters::CURRENCY => "COP", PayUParameters::BUYER_STREET => "calle 100", PayUParameters::BUYER_STREET_2 => "5555487", PayUParameters::BUYER_CITY => "Medellin", PayUParameters::BUYER_STATE => "Antioquia", PayUParameters::BUYER_COUNTRY => "CO", PayUParameters::BUYER_PHONE => "7563126", PayUParameters::BUYER_EMAIL => "nick@comprame.com", PayUParameters::PAYER_NAME => "11111111111111111", PayUParameters::PAYER_DNI => "5415668464654", PayUParameters::PAYMENT_METHOD => PaymentMethods::BANK_REFERENCED, PayUParameters::COUNTRY => PayUCountries::CO, PayUParameters::EXPIRATION_DATE => date("Y-m-d\\TH:i:s", strtotime("+7 days")), PayUParameters::IP_ADDRESS => "127.0.0.1", PayUParameters::PAYER_COOKIE => "pt1t38347bs6jc9ruv2ecpv7o2", PayUParameters::USER_AGENT => "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0");
$response = PayUPayments::doAuthorizationAndCapture($parameters);
if ($response) {
示例4: orderVerify
private function orderVerify($value)
{
$response = new stdClass();
if (empty($value)) {
$response->status = "Empty Value";
$response->status_code = 201;
} else {
$response->status_code = 202;
}
require_once 'plugin/payu_sdk/PayU.php';
Environment::setPaymentsCustomUrl("https://api.payulatam.com/payments-api/4.0/service.cgi");
Environment::setReportsCustomUrl("https://api.payulatam.com/reports-api/4.0/service.cgi");
Environment::setSubscriptionsCustomUrl("https://api.payulatam.com/payments-api/rest/v4.3/");
$commerce = $this->getDataCommerce();
PayU::$apiKey = $commerce->data['APIKEY'];
// apiKey.
PayU::$apiLogin = $commerce->data['APILOGIN'];
// apiLogin.
PayU::$merchantId = $commerce->data['MERCHANTID'];
// Id de Comercio.
PayU::$language = SupportedLanguages::ES;
//Seleccione el idioma.
PayU::$isTest = true;
//Dejarlo True cuando sean pruebas.
$transaction = new stdClass();
// Código de referencia de la orden.
$parameters = array(PayUParameters::REFERENCE_CODE => $value);
$response_payu = PayUReports::getOrderDetailByReferenceCode($parameters);
foreach ($response_payu as $order) {
$order->accountId;
$order->status;
$order->referenceCode;
$order->additionalValues->TX_VALUE->value;
$order->additionalValues->TX_TAX->value;
if ($order->buyer) {
$order->buyer->emailAddress;
$order->buyer->fullName;
}
$transactions = $order->transactions;
foreach ($transactions as $transaction) {
$transaction->type;
$transaction->transactionResponse->state;
$transaction->transactionResponse->paymentNetworkResponseCode;
$transaction->transactionResponse->trazabilityCode;
$transaction->transactionResponse->responseCode;
if ($transaction->payer) {
$transaction->payer->fullName;
$transaction->payer->emailAddress;
}
}
}
$result = $this->updateDataCommerceByReference($value, $transaction);
$response->answer = $transaction;
$response->status_code = 200;
$response->status = $result->status;
return $response;
}