| 1 |
<?php |
| 2 |
// Hoock functions |
| 3 |
add_action('usces_construct', 'usces_action_acting_construct', 10); |
| 4 |
add_action('usces_after_cart_instant', 'usces_action_acting_transaction', 10); |
| 5 |
|
| 6 |
function usces_action_acting_construct(){ |
| 7 |
|
| 8 |
if(isset($_POST['X-TRANID']) && !isset($_POST['OPT'])){//remise |
| 9 |
|
| 10 |
$rand = $_POST['X-S_TORIHIKI_NO']; |
| 11 |
$datas = usces_get_order_acting_data($rand); |
| 12 |
$_GET['uscesid'] = $datas['sesid']; |
| 13 |
if( empty($datas['sesid']) ){ |
| 14 |
usces_log('remise construct : error1', 'acting_transaction.log'); |
| 15 |
}else{ |
| 16 |
usces_log('remise construct : '.$_POST['X-TRANID'], 'acting_transaction.log'); |
| 17 |
usces_set_acting_notification_time( $rand ); |
| 18 |
} |
| 19 |
|
| 20 |
}elseif( in_array($_SERVER['REMOTE_ADDR'], array('210.164.6.67', '202.221.139.50')) ){//zeus |
| 21 |
|
| 22 |
$rand = $_REQUEST['sendpoint']; |
| 23 |
$datas = usces_get_order_acting_data($rand); |
| 24 |
$_GET['uscesid'] = $datas['sesid']; |
| 25 |
if( empty($datas['sesid']) ){ |
| 26 |
usces_log('zeus construct : error1', 'acting_transaction.log'); |
| 27 |
}else{ |
| 28 |
usces_log('zeus construct : '.$_REQUEST['sendpoint'], 'acting_transaction.log'); |
| 29 |
} |
| 30 |
|
| 31 |
} elseif( isset($_POST['res_result']) && isset($_POST['res_pay_method']) ) {//SoftBankPayment |
| 32 |
|
| 33 |
$rand = $_REQUEST['order_id']; |
| 34 |
$datas = usces_get_order_acting_data($rand); |
| 35 |
$_GET['uscesid'] = $datas['sesid']; |
| 36 |
if( empty($datas['sesid']) ) { |
| 37 |
usces_log('SoftBankPayment construct : error1', 'acting_transaction.log'); |
| 38 |
} else { |
| 39 |
usces_log('SoftBankPayment construct : '.$_REQUEST['order_id'], 'acting_transaction.log'); |
| 40 |
} |
| 41 |
|
| 42 |
} elseif( isset($_POST['SID']) && isset($_POST['FUKA']) && isset($_POST['CVS']) ) {//digitalcheck_conv |
| 43 |
|
| 44 |
$rand = $_REQUEST['SID']; |
| 45 |
$datas = usces_get_order_acting_data($rand); |
| 46 |
$_GET['uscesid'] = $datas['sesid']; |
| 47 |
if( empty($datas['sesid']) ) { |
| 48 |
usces_log('digitalcheck construct : error1', 'acting_transaction.log'); |
| 49 |
} else { |
| 50 |
usces_log('digitalcheck construct : '.$_REQUEST['SID'], 'acting_transaction.log'); |
| 51 |
} |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
function usces_action_acting_transaction(){ |
| 56 |
global $usces, $wpdb; |
| 57 |
|
| 58 |
//*** remise_card ***// |
| 59 |
if(isset($_POST['X-TRANID']) && !isset($_POST['OPT'])){ |
| 60 |
foreach( $_POST as $key => $value ){ |
| 61 |
$data[$key] = mb_convert_encoding($value, 'UTF-8', 'SJIS'); |
| 62 |
} |
| 63 |
usces_log('remise acting_transaction : '.print_r($data, true), 'acting_transaction.log'); |
| 64 |
|
| 65 |
$rand = $_POST['X-S_TORIHIKI_NO']; |
| 66 |
// if( empty($rand) ){ |
| 67 |
// usces_log('remise card error1 : '.print_r($data, true), 'acting_transaction.log'); |
| 68 |
// die('error1'); |
| 69 |
// }else{ |
| 70 |
// $res = usces_check_notification_time( $rand, 15 ); |
| 71 |
// if( !$res ) |
| 72 |
// die('error : time over'); |
| 73 |
// } |
| 74 |
// |
| 75 |
// if( 0 !== (int)$_POST['X-ERRLEVEL'] ){ |
| 76 |
// usces_log('remise card error2 : '.print_r($data, true), 'acting_transaction.log'); |
| 77 |
// die('error2'); |
| 78 |
// } |
| 79 |
|
| 80 |
if( '0000000' === substr($rand, 0, 7) ){//card up |
| 81 |
usces_log('remise card_update : '.print_r($data, true), 'acting_transaction.log'); |
| 82 |
if( isset($_POST['X-EXPIRE']) ){ |
| 83 |
$expire = substr($_POST['X-EXPIRE'], 0, 2) . '/' . substr($_POST['X-EXPIRE'], 2, 2); |
| 84 |
$usces->set_member_meta_value('limitofcard', $expire, $_POST['X-AC_S_KAIIN_NO']); |
| 85 |
} |
| 86 |
if( isset($_POST['X-PARTOFCARD']) ) |
| 87 |
$usces->set_member_meta_value('partofcard', $_POST['X-PARTOFCARD'], $_POST['X-AC_S_KAIIN_NO']); |
| 88 |
|
| 89 |
//20120510ysk start |
| 90 |
//die('<SDBKDATA>STATUS=800</SDBKDATA>'); |
| 91 |
$status = (isset($_POST['CARIER_TYPE'])) ? '900' : '800'; |
| 92 |
die('<SDBKDATA>STATUS='.$status.'</SDBKDATA>'); |
| 93 |
//20120510ysk end |
| 94 |
} |
| 95 |
|
| 96 |
//20110203ysk start |
| 97 |
// $res = $usces->order_processing(); |
| 98 |
// if( 'error' == $res ){ |
| 99 |
// usces_log('remise card error3 : '.print_r($data, true), 'acting_transaction.log'); |
| 100 |
// die('error3'); |
| 101 |
// }else{ |
| 102 |
if( isset($_POST['X-PAYQUICKID']) ) |
| 103 |
$usces->set_member_meta_value('remise_pcid', $_POST['X-PAYQUICKID']); |
| 104 |
if( isset($_POST['X-AC_MEMBERID']) ) |
| 105 |
$usces->set_member_meta_value('remise_memid', $_POST['X-AC_MEMBERID']); |
| 106 |
//20120511ysk start |
| 107 |
if( isset($_POST['X-EXPIRE']) ) { |
| 108 |
$limitofcard = substr($_POST['X-EXPIRE'], 0, 2) . '/' . substr($_POST['X-EXPIRE'], 2, 2); |
| 109 |
$usces->set_member_meta_value('limitofcard', $limitofcard); |
| 110 |
} |
| 111 |
if( isset($_POST['X-PARTOFCARD']) ) |
| 112 |
$usces->set_member_meta_value('partofcard', $_POST['X-PARTOFCARD']); |
| 113 |
//20120511ysk end |
| 114 |
usces_log('remise card transaction : '.$_POST['X-TRANID'], 'acting_transaction.log'); |
| 115 |
//20120510ysk start |
| 116 |
//die('<SDBKDATA>STATUS=800</SDBKDATA>'); |
| 117 |
$status = (isset($_POST['CARIER_TYPE'])) ? '900' : '800'; |
| 118 |
die('<SDBKDATA>STATUS='.$status.'</SDBKDATA>'); |
| 119 |
//20120510ysk end |
| 120 |
// } |
| 121 |
//20110203ysk end |
| 122 |
|
| 123 |
//*** remise_conv ***// |
| 124 |
}elseif( isset($_POST['S_TORIHIKI_NO']) && isset($_POST['REC_FLG']) ){ |
| 125 |
foreach( $_POST as $key => $value ){ |
| 126 |
$data[$key] = mb_convert_encoding($value, 'UTF-8', 'SJIS'); |
| 127 |
} |
| 128 |
|
| 129 |
$table_name = $wpdb->prefix . "usces_order"; |
| 130 |
$table_meta_name = $wpdb->prefix . "usces_order_meta"; |
| 131 |
|
| 132 |
$mquery = $wpdb->prepare("SELECT order_id FROM $table_meta_name WHERE meta_key = %s AND meta_value = %s", 'settlement_id', $_POST['S_TORIHIKI_NO']); |
| 133 |
$order_id = $wpdb->get_var( $mquery ); |
| 134 |
if( $order_id == NULL ){ |
| 135 |
usces_log('remise conv error1 : '.print_r($data, true), 'acting_transaction.log'); |
| 136 |
die('error1'); |
| 137 |
} |
| 138 |
|
| 139 |
$mquery = $wpdb->prepare(" |
| 140 |
UPDATE $table_name SET order_status = |
| 141 |
CASE |
| 142 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN REPLACE(order_status, 'noreceipt', 'receipted') |
| 143 |
WHEN LOCATE('receipted', order_status) > 0 THEN order_status |
| 144 |
ELSE CONCAT('receipted,', order_status ) |
| 145 |
END |
| 146 |
WHERE ID = %d", $order_id); |
| 147 |
$res = $wpdb->query( $mquery ); |
| 148 |
if( $res === false ){ |
| 149 |
usces_log('remise conv error2 : '.print_r($data, true), 'acting_transaction.log'); |
| 150 |
die('error2'); |
| 151 |
} |
| 152 |
|
| 153 |
$datastr = serialize( $data ); |
| 154 |
$mquery = $wpdb->prepare( |
| 155 |
"UPDATE $table_meta_name SET meta_value = %s WHERE meta_key = %s AND order_id = %d", $datastr, 'settlement_id', $order_id); |
| 156 |
$res = $wpdb->query( $mquery ); |
| 157 |
if( $res === false ){ |
| 158 |
usces_log('remise conv error3 : '.print_r($data, true), 'acting_transaction.log'); |
| 159 |
die('error3'); |
| 160 |
} |
| 161 |
|
| 162 |
usces_action_acting_getpoint( $order_id );//20120306ysk 0000324 |
| 163 |
|
| 164 |
//usces_send_receipted_mail( $order_id, 'remise_conv' ); |
| 165 |
usces_log('remise conv transaction : '.$_POST['S_TORIHIKI_NO'], 'acting_transaction.log'); |
| 166 |
die('<SDBKDATA>STATUS=800</SDBKDATA>'); |
| 167 |
|
| 168 |
//*** zeus_card ***// |
| 169 |
}elseif( isset($_REQUEST['acting']) && 'zeus_card' == $_REQUEST['acting'] && isset($_REQUEST['result']) && isset($_REQUEST['ordd']) ){ |
| 170 |
foreach( $_REQUEST as $key => $value ){ |
| 171 |
$data[$key] = $value; |
| 172 |
} |
| 173 |
//usces_log('zeus card : '.print_r($data, true), 'acting_transaction.log'); |
| 174 |
|
| 175 |
$acting_opts = $usces->options['acting_settings']['zeus']; |
| 176 |
|
| 177 |
$rand = $_GET['sendpoint']; |
| 178 |
if( empty($rand) ){ |
| 179 |
usces_log('zeus card error1 : '.print_r($data, true), 'acting_transaction.log'); |
| 180 |
die('error1'); |
| 181 |
} |
| 182 |
|
| 183 |
if( 'OK' == $_REQUEST['result'] ){ |
| 184 |
header("HTTP/1.0 200 OK"); |
| 185 |
die('zeus'); |
| 186 |
}else{ |
| 187 |
usces_log('zeus card error3 : '.print_r($data, true), 'acting_transaction.log'); |
| 188 |
header("HTTP/1.0 200 OK"); |
| 189 |
die('error3'); |
| 190 |
} |
| 191 |
|
| 192 |
//*** zeus_bank ***// |
| 193 |
}elseif( isset($_REQUEST['acting']) && 'zeus_bank' == $_REQUEST['acting'] && isset($_REQUEST['order_no']) && isset($_REQUEST['tracking_no']) ){ |
| 194 |
foreach( $_REQUEST as $key => $value ){ |
| 195 |
$data[$key] = $value; |
| 196 |
} |
| 197 |
usces_log('zeus construct_data : '.print_r($data,true), 'acting_transaction.log'); |
| 198 |
|
| 199 |
//20130426ysk start 0000701 |
| 200 |
if( '04' === $_REQUEST['status'] or '05' === $_REQUEST['status'] ) { |
| 201 |
usces_log( 'zeus bank error0 : status='.$_REQUEST['status'], 'acting_transaction.log' ); |
| 202 |
die('error0'); |
| 203 |
} |
| 204 |
//20130426ysk end |
| 205 |
|
| 206 |
$acting_opts = $usces->options['acting_settings']['zeus']; |
| 207 |
|
| 208 |
$table_name = $wpdb->prefix . "usces_order"; |
| 209 |
$table_meta_name = $wpdb->prefix . "usces_order_meta"; |
| 210 |
$mquery = $wpdb->prepare("SELECT order_id, meta_value FROM $table_meta_name WHERE meta_key = %s", 'acting_'.$_REQUEST['tracking_no']); |
| 211 |
$values = $wpdb->get_row( $mquery, ARRAY_A ); |
| 212 |
//usces_log('zeus construct_values1 : '.print_r($values,true), 'acting_transaction.log'); |
| 213 |
if( $values == NULL ){ |
| 214 |
|
| 215 |
//20110203ysk start |
| 216 |
$res = $usces->order_processing(); |
| 217 |
if( 'error' == $res ){ |
| 218 |
//usces_log('zeus bank error1 : '.print_r($data, true), 'acting_transaction.log'); |
| 219 |
usces_log('zeus bank error1 : order_processing', 'acting_transaction.log'); |
| 220 |
die('error1'); |
| 221 |
}else{ |
| 222 |
$order_id = $usces->cart->get_order_entry('ID'); |
| 223 |
$value = serialize($_GET); |
| 224 |
$query = $wpdb->prepare("INSERT INTO $table_meta_name (order_id, meta_key, meta_value) VALUES (%d, %s, %s)", $order_id, 'acting_'.$_REQUEST['tracking_no'], $value); |
| 225 |
$res = $wpdb->query( $query ); |
| 226 |
|
| 227 |
$mquery = $wpdb->prepare("SELECT order_id, meta_value FROM $table_meta_name WHERE meta_key = %s", 'acting_'.$_REQUEST['tracking_no']); |
| 228 |
$values = $wpdb->get_row( $mquery, ARRAY_A ); |
| 229 |
$usces->cart->crear_cart(); |
| 230 |
} |
| 231 |
//20110203ysk end |
| 232 |
} |
| 233 |
|
| 234 |
//usces_log('zeus construct_values2 : '.print_r($values,true), 'acting_transaction.log'); |
| 235 |
$value = unserialize($values['meta_value']); |
| 236 |
$status = ( '03' === $_REQUEST['status'] ) ? 'receipted,' : 'noreceipt,'; |
| 237 |
$order_id = $values['order_id']; |
| 238 |
$add_point = true;//20120306ysk 0000324 |
| 239 |
if( 'receipted,' == $status ){ |
| 240 |
$mquery = $wpdb->prepare(" |
| 241 |
UPDATE $table_name SET order_status = |
| 242 |
CASE |
| 243 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN REPLACE(order_status, 'noreceipt', 'receipted') |
| 244 |
WHEN LOCATE('receipted', order_status) > 0 THEN order_status |
| 245 |
ELSE CONCAT('receipted,', order_status ) |
| 246 |
END |
| 247 |
WHERE ID = %d", $order_id); |
| 248 |
}else{ |
| 249 |
$mquery = $wpdb->prepare(" |
| 250 |
UPDATE $table_name SET order_status = |
| 251 |
CASE |
| 252 |
WHEN LOCATE('receipted', order_status) > 0 THEN REPLACE(order_status, 'receipted', 'noreceipt') |
| 253 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN order_status |
| 254 |
ELSE CONCAT('noreceipt,', order_status ) |
| 255 |
END |
| 256 |
WHERE ID = %d", $order_id); |
| 257 |
$add_point = false;//20120306ysk 0000324 |
| 258 |
} |
| 259 |
$res = $wpdb->query( $mquery ); |
| 260 |
if( false === $res ){ |
| 261 |
//usces_log('zeus bank error2 : '.print_r($data, true), 'acting_transaction.log'); |
| 262 |
usces_log('zeus bank error2 : update usces_order', 'acting_transaction.log'); |
| 263 |
die('error2'); |
| 264 |
} |
| 265 |
usces_action_acting_getpoint( $order_id, $add_point );//20120306ysk 0000324 |
| 266 |
|
| 267 |
$upvalue = array( 'acting' => $_GET['acting'], 'order_no' => $_GET['order_no'], 'tracking_no' => $_GET['tracking_no'], 'status' => $_GET['status'], 'error_message' => $_GET['error_message'], 'money' => $_GET['money'] ); |
| 268 |
$mquery = $wpdb->prepare("UPDATE $table_meta_name SET meta_value = %s WHERE order_id = %d AND meta_key = %s", serialize($upvalue), $order_id, 'acting_'.$_REQUEST['tracking_no']); |
| 269 |
//usces_log('mquery2 : '.print_r($mquery, true), 'acting_transaction.log'); |
| 270 |
$res = $wpdb->query( $mquery ); |
| 271 |
if(!$res){ |
| 272 |
//usces_log('zeus bank error3 : '.print_r($data, true), 'acting_transaction.log'); |
| 273 |
usces_log('zeus bank error3 : update usces_order_meta', 'acting_transaction.log'); |
| 274 |
die('error3'); |
| 275 |
} |
| 276 |
|
| 277 |
usces_log('zeus bank transaction : '.$_REQUEST['tracking_no'], 'acting_transaction.log'); |
| 278 |
die('zeus'); |
| 279 |
|
| 280 |
//*** zeus_conv ***// |
| 281 |
}elseif( isset($_REQUEST['acting']) && 'zeus_conv' == $_REQUEST['acting'] && isset($_REQUEST['status']) && isset($_REQUEST['sendpoint']) ){ |
| 282 |
foreach( $_REQUEST as $key => $value ){ |
| 283 |
$data[$key] = $value; |
| 284 |
} |
| 285 |
|
| 286 |
$acting_opts = $usces->options['acting_settings']['zeus']; |
| 287 |
|
| 288 |
$table_name = $wpdb->prefix . "usces_order"; |
| 289 |
$table_meta_name = $wpdb->prefix . "usces_order_meta"; |
| 290 |
$mquery = $wpdb->prepare("SELECT order_id, meta_value FROM $table_meta_name WHERE meta_key = %s", 'acting_'.$_REQUEST['sendpoint']); |
| 291 |
$values = $wpdb->get_row( $mquery, ARRAY_A ); |
| 292 |
if( $values == NULL ){ |
| 293 |
|
| 294 |
//20110203ysk start |
| 295 |
$res = $usces->order_processing(); |
| 296 |
if( 'error' == $res ){ |
| 297 |
usces_log('zeus conv error1 : '.print_r($data, true), 'acting_transaction.log'); |
| 298 |
die('error1'); |
| 299 |
}else{ |
| 300 |
$order_id = $usces->cart->get_order_entry('ID'); |
| 301 |
$value = serialize($_GET); |
| 302 |
$query = $wpdb->prepare("INSERT INTO $table_meta_name (order_id, meta_key, meta_value) VALUES (%d, %s, %s)", $order_id, 'acting_'.$_REQUEST['sendpoint'], $value); |
| 303 |
$res = $wpdb->query( $query ); |
| 304 |
} |
| 305 |
//20110203ysk end |
| 306 |
|
| 307 |
|
| 308 |
}else{ |
| 309 |
|
| 310 |
$value = unserialize($values['meta_value']); |
| 311 |
$status = ( '04' === $_REQUEST['status'] ) ? 'receipted,' : 'noreceipt,'; |
| 312 |
$order_id = $values['order_id']; |
| 313 |
$add_point = true;//20120306ysk 0000324 |
| 314 |
if( 'receipted,' == $status ){ |
| 315 |
$mquery = $wpdb->prepare(" |
| 316 |
UPDATE $table_name SET order_status = |
| 317 |
CASE |
| 318 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN REPLACE(order_status, 'noreceipt', 'receipted') |
| 319 |
WHEN LOCATE('receipted', order_status) > 0 THEN order_status |
| 320 |
ELSE CONCAT('receipted,', order_status ) |
| 321 |
END |
| 322 |
WHERE ID = %d", $order_id); |
| 323 |
}else{ |
| 324 |
$mquery = $wpdb->prepare(" |
| 325 |
UPDATE $table_name SET order_status = |
| 326 |
CASE |
| 327 |
WHEN LOCATE('receipted', order_status) > 0 THEN REPLACE(order_status, 'receipted', 'noreceipt') |
| 328 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN order_status |
| 329 |
ELSE CONCAT('noreceipt,', order_status ) |
| 330 |
END |
| 331 |
WHERE ID = %d", $order_id); |
| 332 |
$add_point = false;//20120306ysk 0000324 |
| 333 |
} |
| 334 |
$res = $wpdb->query( $mquery ); |
| 335 |
if(!$res){ |
| 336 |
usces_log('zeus conv error2 : '.print_r($data, true), 'acting_transaction.log'); |
| 337 |
die('error2'); |
| 338 |
} |
| 339 |
foreach( $_GET as $key => $v ){ |
| 340 |
$newvalue[$key] = mb_convert_encoding($v, 'UTF-8', 'SJIS'); |
| 341 |
} |
| 342 |
$value = serialize($newvalue); |
| 343 |
$mquery = $wpdb->prepare("UPDATE $table_meta_name SET meta_value = %s WHERE order_id = %d AND meta_key = %s", $value, $order_id, 'acting_'.$_REQUEST['sendpoint']); |
| 344 |
$res = $wpdb->query( $mquery ); |
| 345 |
if(!$res){ |
| 346 |
usces_log('zeus conv error3 : '.print_r($data, true), 'acting_transaction.log'); |
| 347 |
die('error3'); |
| 348 |
} |
| 349 |
usces_action_acting_getpoint( $order_id, $add_point );//20120306ysk 0000324 |
| 350 |
} |
| 351 |
|
| 352 |
usces_log('zeus conv transaction : '.$_REQUEST['sendpoint'], 'acting_transaction.log'); |
| 353 |
die('zeus'); |
| 354 |
|
| 355 |
//20101018ysk start |
| 356 |
//*** jpayment_card ***// |
| 357 |
} elseif(isset($_REQUEST['acting']) && 'jpayment_card' == $_REQUEST['acting']) { |
| 358 |
//$args=''; |
| 359 |
//foreach((array)$_GET as $key => $value) { |
| 360 |
// $args.='&('.$key.')=('.$value.')'; |
| 361 |
//} |
| 362 |
//usces_log('jpayment card : '.$args, 'acting_transaction.log'); |
| 363 |
|
| 364 |
//*** jpayment_conv ***// |
| 365 |
} elseif(isset($_REQUEST['acting']) && 'jpayment_conv' == $_REQUEST['acting'] && isset($_GET['ap'])) { |
| 366 |
//$args=''; |
| 367 |
//foreach((array)$_GET as $key => $value) { |
| 368 |
// $args.='&('.$key.')=('.$value.')'; |
| 369 |
//} |
| 370 |
//usces_log('jpayment conv : '.$args, 'acting_transaction.log'); |
| 371 |
foreach( $_REQUEST as $key => $value ){ |
| 372 |
$data[$key] = $value; |
| 373 |
} |
| 374 |
|
| 375 |
switch($_GET['ap']) { |
| 376 |
case 'CPL_PRE'://コンビニペーパーレス決済識別コード |
| 377 |
break; |
| 378 |
|
| 379 |
case 'CPL'://� |
| 380 |
�金確定 |
| 381 |
$table_name = $wpdb->prefix."usces_order"; |
| 382 |
$table_meta_name = $wpdb->prefix."usces_order_meta"; |
| 383 |
|
| 384 |
$query = $wpdb->prepare("SELECT order_id FROM $table_meta_name WHERE meta_key = %s AND meta_value = %s", 'settlement_id', $_GET['cod']); |
| 385 |
$order_id = $wpdb->get_var($query); |
| 386 |
if($order_id == NULL) { |
| 387 |
usces_log('jpayment conv error1 : '.print_r($data, true), 'acting_transaction.log'); |
| 388 |
die('error1'); |
| 389 |
} |
| 390 |
|
| 391 |
$query = $wpdb->prepare(" |
| 392 |
UPDATE $table_name SET order_status = |
| 393 |
CASE |
| 394 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN REPLACE(order_status, 'noreceipt', 'receipted') |
| 395 |
WHEN LOCATE('receipted', order_status) > 0 THEN order_status |
| 396 |
ELSE CONCAT('receipted,', order_status ) |
| 397 |
END |
| 398 |
WHERE ID = %d", $order_id); |
| 399 |
$res = $wpdb->query($query); |
| 400 |
if($res === false) { |
| 401 |
usces_log('jpayment conv error2 : '.print_r($data, true), 'acting_transaction.log'); |
| 402 |
die('error2'); |
| 403 |
} |
| 404 |
|
| 405 |
foreach($_GET as $key => $value) { |
| 406 |
$data[$key] = mysql_real_escape_string($value); |
| 407 |
} |
| 408 |
$res = $usces->set_order_meta_value('acting_'.$_REQUEST['acting'], serialize($data), $order_id); |
| 409 |
if($res === false) { |
| 410 |
usces_log('jpayment conv error3 : '.print_r($data, true), 'acting_transaction.log'); |
| 411 |
die('error3'); |
| 412 |
} |
| 413 |
|
| 414 |
usces_action_acting_getpoint( $order_id );//20120306ysk 0000324 |
| 415 |
|
| 416 |
usces_log('J-Payment conv transaction : '.$_GET['gid'], 'acting_transaction.log'); |
| 417 |
die('J-Payment'); |
| 418 |
break; |
| 419 |
|
| 420 |
case 'CVS_CAN'://� |
| 421 |
�金取消 |
| 422 |
$table_name = $wpdb->prefix."usces_order"; |
| 423 |
$table_meta_name = $wpdb->prefix."usces_order_meta"; |
| 424 |
|
| 425 |
$query = $wpdb->prepare("SELECT order_id FROM $table_meta_name WHERE meta_key = %s AND meta_value = %s", 'settlement_id', $_GET['cod']); |
| 426 |
$order_id = $wpdb->get_var($query); |
| 427 |
if($order_id == NULL) { |
| 428 |
usces_log('jpayment conv error1 : '.print_r($data, true), 'acting_transaction.log'); |
| 429 |
die('error1'); |
| 430 |
} |
| 431 |
|
| 432 |
$query = $wpdb->prepare(" |
| 433 |
UPDATE $table_name SET order_status = |
| 434 |
CASE |
| 435 |
WHEN LOCATE('receipted', order_status) > 0 THEN REPLACE(order_status, 'receipted', 'noreceipt') |
| 436 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN order_status |
| 437 |
ELSE CONCAT('noreceipt,', order_status ) |
| 438 |
END |
| 439 |
WHERE ID = %d", $order_id); |
| 440 |
$res = $wpdb->query($query); |
| 441 |
if($res === false) { |
| 442 |
usces_log('jpayment conv error2 : '.print_r($data, true), 'acting_transaction.log'); |
| 443 |
die('error2'); |
| 444 |
} |
| 445 |
|
| 446 |
foreach($_GET as $key => $value) { |
| 447 |
$data[$key] = mysql_real_escape_string($value); |
| 448 |
} |
| 449 |
$res = $usces->set_order_meta_value('acting_'.$_REQUEST['acting'], serialize($data), $order_id); |
| 450 |
if($res === false) { |
| 451 |
usces_log('jpayment conv error3 : '.print_r($data, true), 'acting_transaction.log'); |
| 452 |
die('error3'); |
| 453 |
} |
| 454 |
|
| 455 |
usces_action_acting_getpoint( $order_id, false );//20120306ysk 0000324 |
| 456 |
|
| 457 |
usces_log('J-Payment conv transaction : '.$_GET['gid'], 'acting_transaction.log'); |
| 458 |
die('J-Payment'); |
| 459 |
break; |
| 460 |
} |
| 461 |
|
| 462 |
//*** jpayment_bank ***// |
| 463 |
} elseif(isset($_REQUEST['acting']) && 'jpayment_bank' == $_REQUEST['acting']) { |
| 464 |
//$args=''; |
| 465 |
//foreach((array)$_GET as $key => $value) { |
| 466 |
// $args.='&('.$key.')=('.$value.')'; |
| 467 |
//} |
| 468 |
//usces_log('jpayment bank : '.$args, 'acting_transaction.log'); |
| 469 |
foreach( $_REQUEST as $key => $value ){ |
| 470 |
$data[$key] = $value; |
| 471 |
} |
| 472 |
|
| 473 |
switch($_GET['ap']) { |
| 474 |
case 'BANK'://受付完了 |
| 475 |
break; |
| 476 |
|
| 477 |
case 'BAN_SAL'://� |
| 478 |
�金完了 |
| 479 |
if($_GET['mf'] == '1') {//� |
| 480 |
�金マッチングの場合 |
| 481 |
$table_name = $wpdb->prefix."usces_order"; |
| 482 |
$table_meta_name = $wpdb->prefix."usces_order_meta"; |
| 483 |
|
| 484 |
$query = $wpdb->prepare("SELECT order_id FROM $table_meta_name WHERE meta_key = %s AND meta_value = %s", 'settlement_id', $_GET['cod']); |
| 485 |
$order_id = $wpdb->get_var($query); |
| 486 |
if($order_id == NULL) { |
| 487 |
usces_log('jpayment bank error1 : '.print_r($data, true), 'acting_transaction.log'); |
| 488 |
die('error1'); |
| 489 |
} |
| 490 |
|
| 491 |
$query = $wpdb->prepare(" |
| 492 |
UPDATE $table_name SET order_status = |
| 493 |
CASE |
| 494 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN REPLACE(order_status, 'noreceipt', 'receipted') |
| 495 |
WHEN LOCATE('receipted', order_status) > 0 THEN order_status |
| 496 |
ELSE CONCAT('receipted,', order_status ) |
| 497 |
END |
| 498 |
WHERE ID = %d", $order_id); |
| 499 |
$res = $wpdb->query($query); |
| 500 |
if($res === false) { |
| 501 |
usces_log('jpayment bank error2 : '.print_r($data, true), 'acting_transaction.log'); |
| 502 |
die('error2'); |
| 503 |
} |
| 504 |
|
| 505 |
foreach($_GET as $key => $value) { |
| 506 |
$data[$key] = mysql_real_escape_string($value); |
| 507 |
} |
| 508 |
$res = $usces->set_order_meta_value('acting_'.$_REQUEST['acting'], serialize($data), $order_id); |
| 509 |
if($res === false) { |
| 510 |
usces_log('jpayment bank error3 : '.print_r($data, true), 'acting_transaction.log'); |
| 511 |
die('error3'); |
| 512 |
} |
| 513 |
|
| 514 |
usces_action_acting_getpoint( $order_id );//20120306ysk 0000324 |
| 515 |
} |
| 516 |
|
| 517 |
usces_log('J-Payment bank transaction : '.$_REQUEST['gid'], 'acting_transaction.log'); |
| 518 |
die('J-Payment'); |
| 519 |
break; |
| 520 |
} |
| 521 |
//20101018ysk end |
| 522 |
//*** epsilon ***// |
| 523 |
}elseif( !isset($_GET['acting_return']) && isset($_GET['trans_code']) && isset($_GET['user_id']) && isset($_GET['result']) && isset($_GET['order_number']) ){ |
| 524 |
$query = 'trans_code=' . $_GET['trans_code'] . '&user_id=' . $_GET['user_id'] . '&result=' . $_GET['result'] . '&order_number=' . $_GET['order_number']; |
| 525 |
usces_log('epsilon (acting_transaction) : ' . $query, 'acting_transaction.log'); |
| 526 |
$permalink_structure = get_option('permalink_structure'); |
| 527 |
$delim = ( !$usces->use_ssl && $permalink_structure) ? '?' : '&'; |
| 528 |
|
| 529 |
header('location: ' . USCES_CART_URL . $delim . 'acting=epsilon&acting_return=1&' . $query ); |
| 530 |
exit; |
| 531 |
//20110208ysk start |
| 532 |
} elseif( !isset($_GET['acting_return']) && (isset($_GET['acting']) && 'paypal_ipn' == $_GET['acting']) ) { |
| 533 |
foreach( $_REQUEST as $key => $value ){ |
| 534 |
$data[$key] = $value; |
| 535 |
} |
| 536 |
usces_log('paypal_ipn in '.print_r($data,true), 'acting_transaction.log'); |
| 537 |
require_once($usces->options['settlement_path'] . 'paypal.php'); |
| 538 |
$ipn_res = paypal_ipn_check($usces_paypal_url); |
| 539 |
if( $ipn_res[0] === true ){ |
| 540 |
$res = $usces->order_processing( $ipn_res ); |
| 541 |
if( 'ordercompletion' == $res ){ |
| 542 |
$usces->cart->crear_cart(); |
| 543 |
}else{ |
| 544 |
usces_log('paypal_ipn error : '.print_r($data, true), 'acting_transaction.log'); |
| 545 |
die('error1'); |
| 546 |
} |
| 547 |
do_action('usces_action_paypal_ipn', $res, $ipn_res); |
| 548 |
} |
| 549 |
usces_log('PayPal IPN transaction : '.$_REQUEST['txn_id'], 'acting_transaction.log'); |
| 550 |
die('PayPal'); |
| 551 |
//20110523ysk start |
| 552 |
//*** paypal ipn ***// |
| 553 |
} elseif( isset($_GET['ipn_track_id']) ) { |
| 554 |
foreach( $_REQUEST as $key => $value ){ |
| 555 |
$data[$key] = $value; |
| 556 |
} |
| 557 |
usces_log('paypal ipn : '.print_r($data, true), 'acting_transaction.log'); |
| 558 |
die('PayPal'); |
| 559 |
//20110523ysk end |
| 560 |
//20120413ysk start |
| 561 |
//*** SoftBankPayment ***// |
| 562 |
} elseif( !isset($_GET['acting_return']) && isset($_POST['res_result']) && isset($_POST['res_pay_method']) ) { |
| 563 |
//usces_log('SoftBankPayment : '.print_r($_REQUEST, true), 'acting_transaction.log'); |
| 564 |
foreach( $_POST as $key => $value ) { |
| 565 |
$data[$key] = mb_convert_encoding($value, 'UTF-8', 'SJIS'); |
| 566 |
} |
| 567 |
$acting = $data['free1']; |
| 568 |
|
| 569 |
switch( $data['res_result'] ) { |
| 570 |
case 'OK'://決済処理OK |
| 571 |
$table_meta_name = $wpdb->prefix."usces_order_meta"; |
| 572 |
$query = $wpdb->prepare("SELECT order_id FROM $table_meta_name WHERE meta_key = %s AND meta_value = %s", 'res_tracking_id', $data['res_tracking_id']); |
| 573 |
$order_id = $wpdb->get_var($query); |
| 574 |
if( !$order_id ) { |
| 575 |
|
| 576 |
$res = $usces->order_processing(); |
| 577 |
if( 'ordercompletion' == $res ){ |
| 578 |
$usces->cart->crear_cart(); |
| 579 |
} else { |
| 580 |
usces_log('SoftBankPayment '.$data['res_pay_method'].' order processing error : '.print_r($data, true), 'acting_transaction.log'); |
| 581 |
die('NG,order processing error'); |
| 582 |
} |
| 583 |
} |
| 584 |
|
| 585 |
//$acting_opts = $usces->options['acting_settings']['sbps']; |
| 586 |
//if( 'on' == $acting_opts['cust'] ) { |
| 587 |
// $usces->set_member_meta_value( 'sbps_cust_no', $data['res_sps_cust_no'], $data['cust_code'] ); |
| 588 |
// $usces->set_member_meta_value( 'sbps_payment_no', $data['res_sps_payment_no'], $data['cust_code'] ); |
| 589 |
//} |
| 590 |
usces_log('SoftBankPayment '.$data['res_pay_method'].' [OK] transaction : '.$data['res_tracking_id'], 'acting_transaction.log'); |
| 591 |
die('OK,'); |
| 592 |
break; |
| 593 |
|
| 594 |
case 'PY'://� |
| 595 |
�金結果通知 |
| 596 |
$table_name = $wpdb->prefix."usces_order"; |
| 597 |
$table_meta_name = $wpdb->prefix."usces_order_meta"; |
| 598 |
$query = $wpdb->prepare("SELECT order_id FROM $table_meta_name WHERE meta_key = %s AND meta_value = %s", 'res_tracking_id', $data['res_tracking_id']); |
| 599 |
$order_id = $wpdb->get_var($query); |
| 600 |
if( $order_id == NULL ) { |
| 601 |
usces_log('SoftBankPayment '.$data['res_pay_method'].' [PY] error1 : '.print_r($data, true), 'acting_transaction.log'); |
| 602 |
die('NG,order_id error'); |
| 603 |
} |
| 604 |
|
| 605 |
$query = $wpdb->prepare(" |
| 606 |
UPDATE $table_name SET order_status = |
| 607 |
CASE |
| 608 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN REPLACE(order_status, 'noreceipt', 'receipted') |
| 609 |
WHEN LOCATE('receipted', order_status) > 0 THEN order_status |
| 610 |
ELSE CONCAT('receipted,', order_status ) |
| 611 |
END |
| 612 |
WHERE ID = %d", $order_id); |
| 613 |
$res = $wpdb->query($query); |
| 614 |
if( $res === false ) { |
| 615 |
usces_log('SoftBankPayment '.$data['res_pay_method'].' [PY] error2 : '.print_r($data, true), 'acting_transaction.log'); |
| 616 |
die('NG,usces_order update error'); |
| 617 |
} |
| 618 |
|
| 619 |
$res = $usces->set_order_meta_value($acting, serialize($data), $order_id); |
| 620 |
if( $res === false ) { |
| 621 |
usces_log('SoftBankPayment '.$data['res_pay_method'].' [PY] error3 : '.print_r($data, true), 'acting_transaction.log'); |
| 622 |
die('NG,usces_order_meta update error'); |
| 623 |
} |
| 624 |
|
| 625 |
usces_action_acting_getpoint( $order_id ); |
| 626 |
|
| 627 |
usces_log('SoftBankPayment '.$data['res_pay_method'].' [PY] transaction : '.$order_id, 'acting_transaction.log'); |
| 628 |
die('OK,'); |
| 629 |
|
| 630 |
case 'CN'://期限切通知 |
| 631 |
$table_name = $wpdb->prefix."usces_order"; |
| 632 |
$table_meta_name = $wpdb->prefix."usces_order_meta"; |
| 633 |
$query = $wpdb->prepare("SELECT order_id FROM $table_meta_name WHERE meta_key = %s AND meta_value = %s", 'res_tracking_id', $data['res_tracking_id']); |
| 634 |
$order_id = $wpdb->get_var($query); |
| 635 |
if( $order_id == NULL ) { |
| 636 |
usces_log('SoftBankPayment '.$data['res_pay_method'].' [CN] error1 : '.print_r($data, true), 'acting_transaction.log'); |
| 637 |
die('NG,order_id error'); |
| 638 |
} |
| 639 |
|
| 640 |
$query = $wpdb->prepare(" |
| 641 |
UPDATE $table_name SET order_status = |
| 642 |
CASE |
| 643 |
WHEN LOCATE('receipted', order_status) > 0 THEN REPLACE(order_status, 'receipted', 'noreceipt') |
| 644 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN order_status |
| 645 |
ELSE CONCAT('noreceipt,', order_status ) |
| 646 |
END |
| 647 |
WHERE ID = %d", $order_id); |
| 648 |
$res = $wpdb->query($query); |
| 649 |
if( $res === false ) { |
| 650 |
usces_log('SoftBankPayment '.$data['res_pay_method'].' [CN] error2 : '.print_r($data, true), 'acting_transaction.log'); |
| 651 |
die('NG,usces_order update error'); |
| 652 |
} |
| 653 |
|
| 654 |
$res = $usces->set_order_meta_value($acting, serialize($data), $order_id); |
| 655 |
if( $res === false ) { |
| 656 |
usces_log('SoftBankPayment '.$data['res_pay_method'].' [CN] error3 : '.print_r($data, true), 'acting_transaction.log'); |
| 657 |
die('NG,usces_order_meta update error'); |
| 658 |
} |
| 659 |
|
| 660 |
usces_action_acting_getpoint( $order_id, false ); |
| 661 |
|
| 662 |
usces_log('SoftBankPayment '.$data['res_pay_method'].' [CN] transaction : '.$order_id, 'acting_transaction.log'); |
| 663 |
die('OK,'); |
| 664 |
|
| 665 |
default: |
| 666 |
usces_log('SoftBankPayment '.$data['res_pay_method'].' ['.$data['res_result'].'] : '.print_r($data,true), 'acting_transaction.log'); |
| 667 |
die('OK,'); |
| 668 |
} |
| 669 |
//20120413ysk end |
| 670 |
//20121030ysk start |
| 671 |
//*** telecom credit ***// |
| 672 |
} elseif( isset($_REQUEST['clientip']) && isset($_REQUEST['sendid']) && (isset($_REQUEST['acting']) && 'telecom_edy' == $_REQUEST['acting']) ) { |
| 673 |
foreach( $_REQUEST as $key => $value ) { |
| 674 |
$data[$key] = $value; |
| 675 |
} |
| 676 |
usces_log('telecom edy : '.print_r($data, true), 'acting_transaction.log'); |
| 677 |
//die('SuccessOK'); |
| 678 |
} elseif( isset($_REQUEST['clientip']) && isset($_REQUEST['sendid']) && isset($_REQUEST['edy']) ) { |
| 679 |
foreach( $_REQUEST as $key => $value ) { |
| 680 |
$data[$key] = $value; |
| 681 |
} |
| 682 |
if( $_REQUEST['rel'] === 'yes' && isset($_REQUEST['option']) ) { |
| 683 |
$table_meta_name = $wpdb->prefix."usces_order_meta"; |
| 684 |
$mquery = $wpdb->prepare( "SELECT order_id, meta_value FROM $table_meta_name WHERE meta_key = %s", $_REQUEST['option'] ); |
| 685 |
$mvalue = $wpdb->get_row( $mquery, ARRAY_A ); |
| 686 |
$value = unserialize( $mvalue['meta_value'] ); |
| 687 |
$_SESSION['usces_cart'] = $value['usces_cart']; |
| 688 |
$_SESSION['usces_entry'] = $value['usces_entry']; |
| 689 |
$_SESSION['usces_member'] = $value['usces_member']; |
| 690 |
$res = $usces->order_processing(); |
| 691 |
if( 'ordercompletion' == $res ) { |
| 692 |
$query = $wpdb->prepare( "DELETE FROM $table_meta_name WHERE meta_key = %s", $_REQUEST['option'] ); |
| 693 |
$res = $wpdb->query( $query ); |
| 694 |
usces_log('telecom edy - Payment confirmation : '.print_r($data, true), 'acting_transaction.log'); |
| 695 |
} else { |
| 696 |
usces_log('telecom edy - Error 1 : '.print_r($data, true), 'acting_transaction.log'); |
| 697 |
} |
| 698 |
} else { |
| 699 |
usces_log('telecom edy - Error 2 : '.print_r($data, true), 'acting_transaction.log'); |
| 700 |
} |
| 701 |
die('SuccessOK'); |
| 702 |
//20121030ysk end |
| 703 |
//20120618ysk start |
| 704 |
//*** telecom credit ***// |
| 705 |
}elseif( isset($_REQUEST['clientip']) && isset($_REQUEST['sendid']) && isset($_REQUEST['rel']) ){ |
| 706 |
foreach( $_REQUEST as $key => $value ){ |
| 707 |
$data[$key] = $value; |
| 708 |
} |
| 709 |
usces_log('telecom card : '.print_r($data, true), 'acting_transaction.log'); |
| 710 |
die('SuccessOK'); |
| 711 |
//20120618ysk end |
| 712 |
//20121206ysk start |
| 713 |
//*** digitalcheck card ***// |
| 714 |
} elseif( isset($_REQUEST['SID']) && isset($_REQUEST['FUKA']) && substr($_REQUEST['FUKA'], 0, 24) == 'acting_digitalcheck_card' ) { |
| 715 |
foreach( $_REQUEST as $key => $value ) { |
| 716 |
$data[$key] = $value; |
| 717 |
} |
| 718 |
$sid = ( isset($data['SID']) ) ? $data['SID'] : ''; |
| 719 |
//usces_log('digitalcheck card : '.print_r($data, true), 'digitalcheck.log'); |
| 720 |
|
| 721 |
if( isset($data['SEQ']) ) { |
| 722 |
$acting_opts = $usces->options['acting_settings']['digitalcheck']; |
| 723 |
$ip_user_id = substr($data['FUKA'], 24); |
| 724 |
//usces_log('ip_user_id : '.$ip_user_id, 'digitalcheck.log'); |
| 725 |
if( 'on' == $acting_opts['card_user_id'] and !empty($ip_user_id) ) { |
| 726 |
$usces->set_member_meta_value('digitalcheck_ip_user_id', $ip_user_id, $ip_user_id); |
| 727 |
} |
| 728 |
|
| 729 |
$res = $usces->order_processing(); |
| 730 |
if( 'ordercompletion' == $res ) { |
| 731 |
$order_id = $usces->cart->get_order_entry('ID'); |
| 732 |
$usces->set_order_meta_value( 'acting_digitalcheck_card', serialize( $data ), $order_id ); |
| 733 |
} else { |
| 734 |
usces_log('digitalcheck card : order processing error', 'acting_transaction.log'); |
| 735 |
} |
| 736 |
|
| 737 |
header('content-type : text/plain;charset=Shift_JIS'); |
| 738 |
die("0"); |
| 739 |
} |
| 740 |
|
| 741 |
//*** digitalcheck conv ***// |
| 742 |
} elseif( isset($_REQUEST['SID']) && isset($_REQUEST['FUKA']) && substr($_REQUEST['FUKA'], 0, 24) == 'acting_digitalcheck_conv' ) { |
| 743 |
foreach( $_REQUEST as $key => $value ) { |
| 744 |
$data[$key] = $value; |
| 745 |
} |
| 746 |
$sid = ( isset($data['SID']) ) ? $data['SID'] : ''; |
| 747 |
//usces_log("digitalcheck conv : ".print_r($_REQUEST,true), 'digitalcheck.log'); |
| 748 |
|
| 749 |
if( isset($data['SEQ']) ) { |
| 750 |
$table_name = $wpdb->prefix."usces_order"; |
| 751 |
$table_meta_name = $wpdb->prefix."usces_order_meta"; |
| 752 |
|
| 753 |
$query = $wpdb->prepare("SELECT order_id FROM $table_meta_name WHERE meta_key = %s AND meta_value = %s", 'SID', $sid ); |
| 754 |
$order_id = $wpdb->get_var( $query ); |
| 755 |
if( $order_id == NULL ) { |
| 756 |
usces_log( 'digitalcheck conv error1 : '.print_r($data, true), 'acting_transaction.log' ); |
| 757 |
header('content-type : text/plain;charset=Shift_JIS'); |
| 758 |
die('9'); |
| 759 |
} |
| 760 |
|
| 761 |
if( isset($data['CVS']) ) {//� |
| 762 |
�金 |
| 763 |
$mquery = $wpdb->prepare(" |
| 764 |
UPDATE $table_name SET order_status = |
| 765 |
CASE |
| 766 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN REPLACE(order_status, 'noreceipt', 'receipted') |
| 767 |
WHEN LOCATE('receipted', order_status) > 0 THEN order_status |
| 768 |
ELSE CONCAT('receipted,', order_status ) |
| 769 |
END |
| 770 |
WHERE ID = %d", $order_id ); |
| 771 |
$res = $wpdb->query( $mquery ); |
| 772 |
if( $res === false ) { |
| 773 |
usces_log('digitalcheck conv error2 : '.print_r($data, true), 'acting_transaction.log'); |
| 774 |
header('content-type : text/plain;charset=Shift_JIS'); |
| 775 |
die('9'); |
| 776 |
} |
| 777 |
|
| 778 |
usces_action_acting_getpoint( $order_id ); |
| 779 |
|
| 780 |
} else {//取消 |
| 781 |
$mquery = $wpdb->prepare(" |
| 782 |
UPDATE $table_name SET order_status = |
| 783 |
CASE |
| 784 |
WHEN LOCATE('receipted', order_status) > 0 THEN REPLACE(order_status, 'receipted', 'noreceipt') |
| 785 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN order_status |
| 786 |
ELSE CONCAT('noreceipt,', order_status ) |
| 787 |
END |
| 788 |
WHERE ID = %d", $order_id ); |
| 789 |
$res = $wpdb->query( $mquery ); |
| 790 |
if( $res === false ) { |
| 791 |
usces_log('digitalcheck conv error3 : '.print_r($data, true), 'acting_transaction.log'); |
| 792 |
header('content-type : text/plain;charset=Shift_JIS'); |
| 793 |
die('9'); |
| 794 |
} |
| 795 |
|
| 796 |
usces_action_acting_getpoint( $order_id, false ); |
| 797 |
} |
| 798 |
|
| 799 |
$usces->set_order_meta_value( 'acting_digitalcheck_conv', serialize( $data ), $order_id ); |
| 800 |
|
| 801 |
$dquery = $wpdb->prepare( "DELETE FROM $table_meta_name WHERE meta_key = %s", $sid ); |
| 802 |
$res = $wpdb->query( $dquery ); |
| 803 |
|
| 804 |
header('content-type : text/plain;charset=Shift_JIS'); |
| 805 |
die("0"); |
| 806 |
|
| 807 |
} else { |
| 808 |
if( isset($data['CVS']) and isset($data['SHNO']) ) {//決済 |
| 809 |
$table_meta_name = $wpdb->prefix."usces_order_meta"; |
| 810 |
$query = $wpdb->prepare("SELECT order_id FROM $table_meta_name WHERE meta_key = %s AND meta_value = %s", 'SID', $sid ); |
| 811 |
$order_id = $wpdb->get_var($query); |
| 812 |
if( $order_id ) { |
| 813 |
$usces->set_order_meta_value( 'acting_digitalcheck_conv', serialize( $data ), $order_id ); |
| 814 |
|
| 815 |
} else { |
| 816 |
$res = $usces->order_processing(); |
| 817 |
if( 'ordercompletion' == $res ) { |
| 818 |
$order_id = $usces->cart->get_order_entry('ID'); |
| 819 |
$usces->set_order_meta_value( 'acting_digitalcheck_conv', serialize( $data ), $order_id ); |
| 820 |
} else { |
| 821 |
usces_log('digitalcheck conv : order processing error', 'acting_transaction.log'); |
| 822 |
} |
| 823 |
} |
| 824 |
header('content-type : text/plain;charset=Shift_JIS'); |
| 825 |
die("0"); |
| 826 |
|
| 827 |
} elseif( isset($data['purchase']) ) { |
| 828 |
|
| 829 |
} else { |
| 830 |
$permalink_structure = get_option('permalink_structure'); |
| 831 |
$delim = ( !$usces->use_ssl && $permalink_structure ) ? '?' : '&'; |
| 832 |
header( 'location: '.USCES_CART_URL.$delim.'acting=digitalcheck_conv&acting_return=1&SID='.$sid ); |
| 833 |
exit; |
| 834 |
} |
| 835 |
} |
| 836 |
//20121206ysk end |
| 837 |
//20130225ysk start |
| 838 |
//*** mizuho card ***// |
| 839 |
} elseif( ( isset($_GET['p_ver']) && $_GET['p_ver'] == '0200' ) && ( isset($_GET['bkcode']) && $_GET['bkcode'] == 'bg01' ) ) { |
| 840 |
//usces_log('mizuho card : '.print_r($_GET,true),'mizuho.log'); |
| 841 |
$stran = ( array_key_exists('stran', $_REQUEST) ) ? $_REQUEST['stran'] : ''; |
| 842 |
$mbtran = ( array_key_exists('mbtran', $_REQUEST) ) ? $_REQUEST['mbtran'] : ''; |
| 843 |
$rsltcd = ( array_key_exists('rsltcd', $_REQUEST) ) ? $_REQUEST['rsltcd'] : ''; |
| 844 |
$permalink_structure = get_option( 'permalink_structure' ); |
| 845 |
$delim = ( !$usces->use_ssl && $permalink_structure ) ? '?' : '&'; |
| 846 |
if( '108' == substr($rsltcd, 0, 3) or '208' == substr($rsltcd, 0, 3) or '308' == substr($rsltcd, 0, 3 ) ) {//キャンセル |
| 847 |
header( 'location: '.USCES_CART_URL.$delim.'confirm=1' ); |
| 848 |
} elseif( '109' == substr($rsltcd, 0, 3) or '209' == substr($rsltcd, 0, 3) or '309' == substr($rsltcd, 0, 3) ) {//エラー |
| 849 |
header( 'location: '.USCES_CART_URL.$delim.'confirm=1' ); |
| 850 |
} else { |
| 851 |
header( 'location: '.USCES_CART_URL.$delim.'acting=mizuho_card&acting_return=1&stran='.$stran.'&mbtran='.$mbtran.'&rsltcd='.$rsltcd ); |
| 852 |
} |
| 853 |
die(); |
| 854 |
|
| 855 |
//*** mizuho conv ***// |
| 856 |
} elseif( ( isset($_GET['p_ver']) && $_GET['p_ver'] == '0200' ) && ( isset($_GET['bkcode']) && ( $_GET['bkcode'] == 'cv01' or $_GET['bkcode'] == 'cv02' ) ) ) { |
| 857 |
usces_log('mizuho conv : '.print_r($_GET,true),'mizuho.log'); |
| 858 |
$stran = ( array_key_exists('stran', $_REQUEST) ) ? $_REQUEST['stran'] : ''; |
| 859 |
$mbtran = ( array_key_exists('mbtran', $_REQUEST) ) ? $_REQUEST['mbtran'] : ''; |
| 860 |
$bktrans = ( array_key_exists('bktrans', $_REQUEST) ) ? $_REQUEST['bktrans'] : ''; |
| 861 |
$tranid = ( array_key_exists('tranid', $_REQUEST) ) ? $_REQUEST['tranid'] : ''; |
| 862 |
$tdate = ( array_key_exists('tdate', $_REQUEST) ) ? $_REQUEST['tdate'] : ''; |
| 863 |
$rsltcd = ( array_key_exists('rsltcd', $_REQUEST) ) ? $_REQUEST['rsltcd'] : ''; |
| 864 |
$permalink_structure = get_option( 'permalink_structure' ); |
| 865 |
$delim = ( !$usces->use_ssl && $permalink_structure ) ? '?' : '&'; |
| 866 |
if( '' != $tdate ) {//� |
| 867 |
�金通知 |
| 868 |
foreach( $_REQUEST as $key => $value ) { |
| 869 |
$data[$key] = $value; |
| 870 |
} |
| 871 |
if( $rsltcd == "0000000000000" ) { |
| 872 |
$table_name = $wpdb->prefix."usces_order"; |
| 873 |
$table_meta_name = $wpdb->prefix."usces_order_meta"; |
| 874 |
|
| 875 |
$query = $wpdb->prepare( "SELECT order_id FROM $table_meta_name WHERE meta_key = %s AND meta_value = %s", 'stran', $stran ); |
| 876 |
$order_id = $wpdb->get_var( $query ); |
| 877 |
if( $order_id == NULL ) { |
| 878 |
usces_log( 'mizuho conv error1 : '.print_r($data, true), 'acting_transaction.log' ); |
| 879 |
|
| 880 |
} else { |
| 881 |
$mquery = $wpdb->prepare(" |
| 882 |
UPDATE $table_name SET order_status = |
| 883 |
CASE |
| 884 |
WHEN LOCATE('noreceipt', order_status) > 0 THEN REPLACE(order_status, 'noreceipt', 'receipted') |
| 885 |
WHEN LOCATE('receipted', order_status) > 0 THEN order_status |
| 886 |
ELSE CONCAT('receipted,', order_status ) |
| 887 |
END |
| 888 |
WHERE ID = %d", $order_id ); |
| 889 |
$res = $wpdb->query( $mquery ); |
| 890 |
if( $res === false ) { |
| 891 |
usces_log( 'mizuho conv error2 : '.print_r($data, true), 'acting_transaction.log' ); |
| 892 |
|
| 893 |
} else { |
| 894 |
usces_action_acting_getpoint( $order_id ); |
| 895 |
|
| 896 |
$usces->set_order_meta_value( 'acting_mizuho_conv', serialize($data), $order_id ); |
| 897 |
|
| 898 |
$dquery = $wpdb->prepare( "DELETE FROM $table_meta_name WHERE meta_key = %s", $stran ); |
| 899 |
$res = $wpdb->query( $dquery ); |
| 900 |
} |
| 901 |
} |
| 902 |
|
| 903 |
} else { |
| 904 |
header( 'location: '.USCES_CART_URL.$delim.'confirm=1' ); |
| 905 |
} |
| 906 |
|
| 907 |
} elseif( '108' == substr($rsltcd, 0, 3) or '208' == substr($rsltcd, 0, 3) or '308' == substr($rsltcd, 0, 3) ) {//キャンセル |
| 908 |
header( 'location: '.USCES_CART_URL.$delim.'confirm=1' ); |
| 909 |
} elseif( '109' == substr($rsltcd, 0, 3) or '209' == substr($rsltcd, 0, 3) or '309' == substr($rsltcd, 0, 3) ) {//エラー |
| 910 |
header( 'location: '.USCES_CART_URL.$delim.'confirm=1' ); |
| 911 |
} else { |
| 912 |
header( 'location: '.USCES_CART_URL.$delim.'acting=mizuho_conv&acting_return=1&stran='.$stran.'&mbtran='.$mbtran.'&bktrans='.$_GET['bktrans'].'&tranid='.$tranid.'&rsltcd='.$rsltcd ); |
| 913 |
} |
| 914 |
die(); |
| 915 |
//20130225ysk end |
| 916 |
} |
| 917 |
} |
| 918 |
?> |
| 919 |
|