Skip to content

Instantly share code, notes, and snippets.

@cameri
Created September 3, 2014 18:21
Show Gist options
  • Save cameri/ff4dfb4482a84d6f8468 to your computer and use it in GitHub Desktop.
Save cameri/ff4dfb4482a84d6f8468 to your computer and use it in GitHub Desktop.
<?php
$config = array(
'endpoint' => 'https://btrans.evertecinc.com/postwebbtrans/post.php',
'currency_code' => '214', // DOP
'acquiring_institution_code' => '349',
'merchant_type' => '5311',
'merchant_number' => '349061069 ',
'merchant_terminal' => '300118456938 ',
'return_url' => 'https://www.maspormenos.do/orders/payment',
'cancel_url' => 'https://www.maspormenos.do/orders/cancel',
'page_languaje' => 'ESP',
'merchant_name' => 'ONLINE TRADING DOMINICANA SRL DO',
//'avs' => '33024 1000 ST JOHN PLACE PEMBROKE PINES FLORIDA',
'referer' => 'https://btrans.evertecinc.com/postwebbtrans/post.php'
);
$temp_orden_id = str_pad(substr((int)$user_id * time(), 0, 6), 6, '0', STR_PAD_LEFT); // no se puede repetir en un mismo dia
$temp_transaction_id = substr($user_id + time(), -6, 6); // no se puede repetir en un mismo dia
$ip_client = '200.200.200.200'; // ip por defecto
if (strpos($_SERVER['REMOTE_ADDR'],':') === false ) {
$ip_client = $_SERVER['REMOTE_ADDR']; // ip del cliente que esta realizando la transaccion
}
$data = array(
'CardnetTransaction' => array(
'endpoint' => $config['endpoint'],
'transaction_type' => '0200',
'currency_code' => $config['currency_code'],
'acquiring_institution_code' => $config['acquiring_institution_code'],
'merchant_type' => $config['merchant_type'],
'merchant_number' => $config['merchant_number'],
'merchant_terminal' => $config['merchant_terminal'],
'return_url' => $config['return_url'],
'cancel_url' => $config['cancel_url'],
'page_languaje' => $config['page_languaje'],
'merchant_name' => $config['merchant_name'],
'orden_id' => $temp_orden_id,
'transaction_id' => $temp_transaction_id,
//'avs' => $config['avs'],
'ip_client' => $ip_client,
),
);
$this->CardnetTransaction->create($data);
$this->CardnetTransaction->setAmount($cart['Order']['total']);
$this->CardnetTransaction->setTax(0.0);
$this->CardnetTransaction->refreshKeyEncryptionKey();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment