Payment: paymentSetDecodedValue is empty aldığım hata bu.
Bir değeri boş gönderiyor diyor.
add_action("init", "d3Yonlendir");
function d3Yonlendir()
{
if (!empty($_REQUEST['Reason']) && empty($_REQUEST['payment_method'])) {
wc_add_notice(base64_decode($_REQUEST['Reason']), 'error');
}
if (isset($_REQUEST['d3Yonlendir'])) {
$order_id = $_REQUEST['d3Yonlendir'];
$paynkolay = new paynkolay();
$options = get_option("woocommerce_paynkolay_settings");
$order = wc_get_order($order_id);
$sx = $options['sx'];
$okUrl = get_site_url() . "/wc-api/paynkolay";
$failUrl = $order->get_checkout_payment_url(true);
$merchant_secret_key = $options['merchant_secret_key'];
$rnd = time();
$uniq_code = md5($rnd);
$amount = $_REQUEST['odenecek_tutar'];
$clientRefCode = time() . md5($order_id);
update_post_meta($order_id, "client_reference_code", $clientRefCode);
$hashstr = $sx . $clientRefCode . $amount . $okUrl . $failUrl . $rnd . $merchant_secret_key;
$hashData = base64_encode(pack('H*', sha1($hashstr)));
if ($options['3d_secure'] == "3d") {
$use3D = "true";
} else {
$use3D = "false";
}
$vars = [
'sx' => $sx,
'clientRefCode' => $clientRefCode,
'successUrl' => $okUrl,
'failUrl' => $failUrl,
'amount' => $amount,
'installmentNo' => $_REQUEST['secilen_taksit'],
'cardHolderName' => $_REQUEST['cardHolderName'],
'month' => $_REQUEST['ay'],
'year' => $_REQUEST['yil'],
'cvv' => $_REQUEST['cvv'],
'cardNumber' => $_REQUEST['cardNumber'],
'EncodedValue' => $_REQUEST['tsx' . $_REQUEST['secilen_taksit']],
'use3D' => $use3D,
'transactionType' => 'SALES',
'hosturl' => get_site_url(),
'rnd' => $rnd,
'hashData' => $hashData,
'environment' => 'API',
];
$result = json_decode($paynkolay->start3d($vars));
if ($result->USE_3D == "false") {
/*
* İşlem 3d değilse bu kısımdan işlem yapar.
*/
if ($result->RESPONSE_CODE != 2) {
wc_add_notice($result->RESPONSE_DATA, 'notice');
} else {
global $wpdb;
$read = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}postmeta WHERE meta_key = 'client_reference_code' AND meta_value = '%s'", $clientRefCode));
if (isset($read->post_id)) {
update_post_meta($read->post_id, "reference_code", $_REQUEST['REFERENCE_CODE']);
global $woocommerce;
$order = wc_get_order($read->post_id);
if ($result->RESPONSE_CODE == 2) {
$order->payment_complete();
$woocommerce->cart->empty_cart();
header("Location: " . $order->get_checkout_order_received_url());
} else {
header("Location: " . $order->get_checkout_payment_url() . "&Reason=" . base64_encode($sonuc->RESPONSE_DATA));
}
} else {
esc_html__('Geçersiz istek', 'paynkolay');
}
exit;
}
} else {
/*
* İşlem 3d ise bu kısımdan işlem yapar
*/
if ($result->RESPONSE_CODE != 2) {
header("Location: " . $order->get_checkout_payment_url() . "&Reason=" . base64_encode($result->RESPONSE_DATA));
} else {
print_r($result->BANK_REQUEST_MESSAGE);
exit;
}
}
}
}bakıyorm ama boş gönderilen değer de yok. anlmadım gitti.