\beGateway\Logger::getInstance()->setLogLevel(\beGateway\Logger::DEBUG);
$transaction = new \beGateway\Payment();
$amount = rand(100, 10000);
$transaction->money->setAmount($amount);
$transaction->money->setCurrency('EUR');
$transaction->setDescription('test');
$transaction->setTrackingId('my_custom_variable');
$transaction->card->setCardNumber('4200000000000000');
$transaction->card->setCardHolder('John Doe');
$transaction->card->setCardExpMonth(1);
$transaction->card->setCardExpYear(2030);
$transaction->card->setCardCvc('123');
$transaction->customer->setFirstName('John');
$transaction->customer->setLastName('Doe');
$transaction->customer->setCountry('LV');
$transaction->customer->setAddress('Demo str 12');
$transaction->customer->setCity('Riga');
$transaction->customer->setZip('LV-1082');
$transaction->customer->setIp('127.0.0.1');
$transaction->customer->setEmail('*****@*****.**');
$response = $transaction->submit();
print "Transaction message: " . $response->getMessage() . PHP_EOL;
print "Transaction status: " . $response->getStatus() . PHP_EOL;
if ($response->isSuccess()) {
    print "Transaction UID: " . $response->getUid() . PHP_EOL;
    print "Trying to Query by tracking id " . $transaction->getTrackingId() . PHP_EOL;
    $query = new \beGateway\QueryByTrackingId();
    $query->setTrackingId($transaction->getTrackingId());
    $query_response = $query->submit();
    print_r($query_response);
}
Пример #2
0
$module_id = "begateway.payment";
if( ! \Bitrix\Main\Loader::includeModule($module_id) ) return;

\beGateway\Settings::$shopId = CSalePaySystemAction::GetParamValue("SHOP_ID");
\beGateway\Settings::$shopKey = CSalePaySystemAction::GetParamValue("SHOP_KEY");
\beGateway\Settings::$gatewayBase = "https://" . CSalePaySystemAction::GetParamValue("DOMAIN_GATEWAY");
\beGateway\Settings::$checkoutBase = "https://" . CSalePaySystemAction::GetParamValue("DOMAIN_PAYMENT_PAGE");

$payment_id = CSalePaySystemAction::GetParamValue("ORDER_PAYMENT_ID");
$order_id = IntVal($GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ID"]);

$tracking_id = $order_id . ":" . $payment_id;

set_time_limit(0);

$query = new \beGateway\QueryByTrackingId;
$query->setTrackingId($tracking_id);

$response = $query->submit();

if ($response && $response != 'error') {
  $money = new \beGateway\Money;
  $money->setCurrency($response->getResponse()->transaction->currency);
  $money->setCents($response->getResponse()->transaction->amount);

	if($response->getTrackingId() == $tracking_id) {
		$arOrder = CSaleOrder::GetByID($order_id);
    $message = array();
    $message []= Loc::getMessage("SALE_BEGATEWAY_STATUS_MESSAGE_UID") . ' ' . $response->getUid(). ". " . Loc::getMessage("SALE_BEGATEWAY_STATUS_MESSAGE_TIME") . ' ' . $response->getResponse()->transaction->paid_at;

    if(isset($response->getResponse()->transaction->three_d_secure_verification->pa_status)) {