| 56 |
|
|
| 57 |
$items[] = array( |
$items[] = array( |
| 58 |
'path' => 'admin/store/settings/banks/add', |
'path' => 'admin/store/settings/banks/add', |
| 59 |
'title' => t('Add New Bank'), |
'title' => t('Add New Bank'), |
| 60 |
'description' => t('Add a New Bank'), |
'description' => t('Add a New Bank'), |
| 61 |
'callback' => 'drupal_get_form', |
'callback' => 'drupal_get_form', |
| 62 |
'callback arguments' => array('uc_turkish_banks_add_form', 'add'), |
'callback arguments' => array('uc_turkish_banks_add_form', 'add'), |
| 63 |
'access' => user_access('manage banks'), |
'access' => user_access('manage banks'), |
| 64 |
'type' => MENU_LOCAL_TASK, |
'type' => MENU_LOCAL_TASK, |
| 65 |
'weight' => 10, |
'weight' => 10, |
| 66 |
); |
); |
| 67 |
$items[] = array( |
$items[] = array( |
| 68 |
'path' => 'admin/store/settings/banks/instalments', |
'path' => 'admin/store/settings/banks/instalments', |
| 73 |
'type' => MENU_NORMAL_ITEM, |
'type' => MENU_NORMAL_ITEM, |
| 74 |
); |
); |
| 75 |
$items[] = array( |
$items[] = array( |
| 76 |
'path' => 'admin/store/settings/banks/instalments/add', |
'path' => 'admin/store/settings/banks/instalments/add', |
| 77 |
'title' => t('Add Instalment'), |
'title' => t('Add Instalment'), |
| 78 |
'description' => t('Add a New Instalment'), |
'description' => t('Add a New Instalment'), |
| 79 |
'callback' => 'drupal_get_form', |
'callback' => 'drupal_get_form', |
| 80 |
'callback arguments' => array('uc_turkish_banks_instalments_add_form', 'add'), |
'callback arguments' => array('uc_turkish_banks_instalments_add_form', 'add'), |
| 81 |
'access' => user_access('manage banks'), |
'access' => user_access('manage banks'), |
| 82 |
'type' => MENU_LOCAL_TASK, |
'type' => MENU_LOCAL_TASK, |
| 83 |
'weight' => 10, |
'weight' => 10, |
| 84 |
); |
); |
| 85 |
} |
} |
| 86 |
else { |
else { |
| 87 |
$items[] = array( |
$items[] = array( |
| 88 |
'path' => 'admin/store/settings/banks/'. arg(4) . '/edit', |
'path' => 'admin/store/settings/banks/'. arg(4) .'/edit', |
| 89 |
'title' => t('Edit Banks'), |
'title' => t('Edit Banks'), |
| 90 |
'description' => t('Edit an available bank'), |
'description' => t('Edit an available bank'), |
| 91 |
'callback' => 'drupal_get_form', |
'callback' => 'drupal_get_form', |
| 92 |
'callback arguments' => array('uc_turkish_banks_add_form', 'edit', arg(4)), |
'callback arguments' => array('uc_turkish_banks_add_form', 'edit', arg(4)), |
| 93 |
'access' => user_access('manage banks'), |
'access' => user_access('manage banks'), |
| 94 |
'type' => MENU_DYNAMIC_ITEM, |
'type' => MENU_DYNAMIC_ITEM, |
| 95 |
); |
); |
| 96 |
$items[] = array( |
$items[] = array( |
| 97 |
'path' => 'admin/store/settings/banks/'. arg(4) . '/delete', |
'path' => 'admin/store/settings/banks/'. arg(4) .'/delete', |
| 98 |
'title' => t('Delete Bank'), |
'title' => t('Delete Bank'), |
| 99 |
'description' => t('Delete a bank'), |
'description' => t('Delete a bank'), |
| 100 |
'callback' => 'drupal_get_form', |
'callback' => 'drupal_get_form', |
| 101 |
'callback arguments' => array('uc_turkish_banks_delete_confirm', arg(4)), |
'callback arguments' => array('uc_turkish_banks_delete_confirm', arg(4)), |
| 102 |
'access' => user_access('manage banks'), |
'access' => user_access('manage banks'), |
| 103 |
'type' => MENU_DYNAMIC_ITEM, |
'type' => MENU_DYNAMIC_ITEM, |
| 104 |
); |
); |
| 105 |
$items[] = array( |
$items[] = array( |
| 106 |
'path' => 'admin/store/settings/banks/instalments/'. arg(5).'/'.arg(6).'/delete', |
'path' => 'admin/store/settings/banks/instalments/'. arg(5) .'/'. arg(6) .'/delete', |
| 107 |
'title' => t('Delete instalment'), |
'title' => t('Delete instalment'), |
| 108 |
'description' => t('Delete an instalment'), |
'description' => t('Delete an instalment'), |
| 109 |
'callback' => 'drupal_get_form', |
'callback' => 'drupal_get_form', |
| 110 |
'callback arguments' => array('uc_turkish_banks_instalments_delete_confirm', arg(5),arg(6)), |
'callback arguments' => array('uc_turkish_banks_instalments_delete_confirm', arg(5), arg(6)), |
| 111 |
'access' => user_access('manage banks'), |
'access' => user_access('manage banks'), |
| 112 |
'type' => MENU_DYNAMIC_ITEM, |
'type' => MENU_DYNAMIC_ITEM, |
| 113 |
); |
); |
| 114 |
} |
} |
| 115 |
|
|
| 126 |
$rows = array(); |
$rows = array(); |
| 127 |
while ($row = db_fetch_object($result)) { |
while ($row = db_fetch_object($result)) { |
| 128 |
if ($row->type == 'percentage') { |
if ($row->type == 'percentage') { |
| 129 |
$value = $row->value . '%'; |
$value = $row->value .'%'; |
| 130 |
} |
} |
| 131 |
else { |
else { |
| 132 |
$value = '$' . $row->value; |
$value = '$'. $row->value; |
| 133 |
} |
} |
| 134 |
$rows[] = array( |
$rows[] = array( |
| 135 |
$row->cid, |
$row->cid, |
| 136 |
$row->instalment, |
$row->instalment, |
| 137 |
$row->instalment_ratio, |
$row->instalment_ratio, |
| 138 |
format_date($row->valid_until, 'custom', 'd/m/Y'), |
format_date($row->valid_until, 'custom', 'd/m/Y'), |
| 139 |
l(t('delete'),"admin/store/settings/banks/instalments/$row->cid/$row->instalment/delete")); |
l(t('delete'), "admin/store/settings/banks/instalments/$row->cid/$row->instalment/delete")); |
| 140 |
} |
} |
| 141 |
|
|
| 142 |
$header = array(array('data' => 'Instalment', 'width' => '10'), 'Ratio','Valid Until','Ops'); |
$header = array(array('data' => 'Instalment', 'width' => '10'), 'Ratio', 'Valid Until', 'Ops'); |
| 143 |
$output .= theme('table',$header, $rows, array('width' => '100%')); |
$output .= theme('table', $header, $rows, array('width' => '100%')); |
| 144 |
if ($output == null) { |
if ($output == null) { |
| 145 |
$output = "<p>There are currently no instalments in the system.</p>"; |
$output = "<p>There are currently no instalments in the system.</p>"; |
| 146 |
} |
} |
| 147 |
$output .= l(t('Add a new instalment'), "admin/store/settings/banks/instalments/add/$cid"); |
$output .= l(t('Add a new instalment'), "admin/store/settings/banks/instalments/add/$cid"); |
| 148 |
$output .= "<br/>"; |
$output .= "<br/>"; |
| 149 |
$output .= l(t('Back to Banks'),"admin/store/settings/banks"); |
$output .= l(t('Back to Banks'), "admin/store/settings/banks"); |
| 150 |
return $output; |
return $output; |
| 151 |
} |
} |
| 152 |
|
|
| 153 |
function uc_turkish_banks_instalments_add_form($action, $cid = null) { |
function uc_turkish_banks_instalments_add_form($action, $cid = null) { |
| 154 |
$form['uc_turkish_banks_instalments'] = array('#type' => 'fieldset', |
$form['uc_turkish_banks_instalments'] = array('#type' => 'fieldset', |
| 155 |
'#title' => t('Instalments'), |
'#title' => t('Instalments'), |
| 156 |
'#collapsible' => true, |
'#collapsible' => true, |
| 157 |
'#collapsed' => false, |
'#collapsed' => false, |
| 158 |
'#weight' => 0, |
'#weight' => 0, |
| 159 |
); |
); |
| 160 |
$form['cid'] = array('#type' => 'value', |
$form['cid'] = array('#type' => 'value', |
| 161 |
'#value' => arg(6), |
'#value' => arg(6), |
| 162 |
); |
); |
| 163 |
|
|
| 164 |
$form['uc_turkish_banks_instalments']['instalment'] = array('#type' => 'textfield', |
$form['uc_turkish_banks_instalments']['instalment'] = array('#type' => 'textfield', |
| 165 |
'#title' => t('Instalment'), |
'#title' => t('Instalment'), |
| 166 |
'#default_value' => $value['instalment'], |
'#default_value' => $value['instalment'], |
| 167 |
'#size' => 3, |
'#size' => 3, |
| 168 |
'#weight' => -3, |
'#weight' => -3, |
| 169 |
'#required' => true, |
'#required' => true, |
| 170 |
); |
); |
| 171 |
$form['uc_turkish_banks_instalments']['instalment_ratio'] = array('#type' => 'textfield', |
$form['uc_turkish_banks_instalments']['instalment_ratio'] = array('#type' => 'textfield', |
| 172 |
'#title' => t('Ratio'), |
'#title' => t('Ratio'), |
| 173 |
'#default_value' => $value['instalment_ratio'], |
'#default_value' => $value['instalment_ratio'], |
| 174 |
'#size' => 5, |
'#size' => 5, |
| 175 |
'#weight' => -2, |
'#weight' => -2, |
| 176 |
'#required' => true, |
'#required' => true, |
| 177 |
); |
); |
| 178 |
$valid_until = getdate($value['valid_until']); |
$valid_until = getdate($value['valid_until']); |
| 179 |
$default_valid_until= array( |
$default_valid_until= array( |
| 180 |
'month' => $valid_until['mon'], |
'month' => $valid_until['mon'], |
| 181 |
'day' => $valid_until['mday'], |
'day' => $valid_until['mday'], |
| 182 |
'year' => $valid_until['year'], |
'year' => $valid_until['year'], |
| 183 |
); |
); |
| 184 |
$form['uc_turkish_banks_instalments']['valid_until'] = array('#type' => 'select', |
$form['uc_turkish_banks_instalments']['valid_until'] = array('#type' => 'select', |
| 185 |
'#title' => t('Valid Until'), |
'#title' => t('Valid Until'), |
| 186 |
'#type' => 'date', |
'#type' => 'date', |
| 187 |
'#default_value' => $default_valid_until, |
'#default_value' => $default_valid_until, |
| 188 |
'#required' => TRUE, |
'#required' => TRUE, |
| 189 |
'#weight' => 3, |
'#weight' => 3, |
| 190 |
); |
); |
| 191 |
|
|
| 192 |
$form['cancel'] = array('#type' => 'item', |
$form['cancel'] = array('#type' => 'item', |
| 193 |
'#value' => l(t('Cancel and return to instalments listing'), 'admin/store/settings/banks/instalments/'.arg(0)), |
'#value' => l(t('Cancel and return to instalments listing'), 'admin/store/settings/banks/instalments/'. arg(0)), |
| 194 |
'#weight' => 20, |
'#weight' => 20, |
| 195 |
); |
); |
| 196 |
$form['op'] = array('#type' => 'submit', |
$form['op'] = array('#type' => 'submit', |
| 197 |
'#value' => t('Submit'), |
'#value' => t('Submit'), |
| 198 |
'#weight' => 21, |
'#weight' => 21, |
| 199 |
); |
); |
| 200 |
return $form; |
return $form; |
| 201 |
} |
} |
| 214 |
* Insert instalment |
* Insert instalment |
| 215 |
*/ |
*/ |
| 216 |
function uc_turkish_banks_instalments_add_form_submit($form_id, $form) { |
function uc_turkish_banks_instalments_add_form_submit($form_id, $form) { |
| 217 |
$valid_until = mktime(23,59,59, |
$valid_until = mktime(23, 59, 59, |
| 218 |
$form['valid_until']['month'], |
$form['valid_until']['month'], |
| 219 |
$form['valid_until']['day'], |
$form['valid_until']['day'], |
| 220 |
$form['valid_until']['year'] |
$form['valid_until']['year'] |
| 221 |
); |
); |
| 228 |
$message = "Sorry instalment could not be added. Try again."; |
$message = "Sorry instalment could not be added. Try again."; |
| 229 |
} |
} |
| 230 |
drupal_set_message($message); |
drupal_set_message($message); |
| 231 |
drupal_goto('admin/store/settings/banks/instalments/'.$form['cid']); |
drupal_goto('admin/store/settings/banks/instalments/'. $form['cid']); |
| 232 |
} |
} |
| 233 |
|
|
| 234 |
/** |
/** |
| 239 |
$form['instalment'] = array('#type' => 'value', '#value' => $instalment); |
$form['instalment'] = array('#type' => 'value', '#value' => $instalment); |
| 240 |
return confirm_form($form, |
return confirm_form($form, |
| 241 |
t('Confirm Deletion of instalment %instalment', array('%instalment' => $instalment)), |
t('Confirm Deletion of instalment %instalment', array('%instalment' => $instalment)), |
| 242 |
'admin/store/settings/banks/instalments/'.$cid, |
'admin/store/settings/banks/instalments/'. $cid, |
| 243 |
t('Are you sure ?'), |
t('Are you sure?'), |
| 244 |
t('Delete'), |
t('Delete'), |
| 245 |
t('Cancel') |
t('Cancel') |
| 246 |
); |
); |
| 258 |
else { |
else { |
| 259 |
drupal_set_message("Error deleting instalment"); |
drupal_set_message("Error deleting instalment"); |
| 260 |
} |
} |
| 261 |
drupal_goto('admin/store/settings/banks/instalments/'.$form['cid']); |
drupal_goto('admin/store/settings/banks/instalments/'. $form['cid']); |
| 262 |
} |
} |
| 263 |
|
|
| 264 |
|
|
| 270 |
$rows = array(); |
$rows = array(); |
| 271 |
while ($row = db_fetch_object($result)) { |
while ($row = db_fetch_object($result)) { |
| 272 |
if ($row->type == 'percentage') { |
if ($row->type == 'percentage') { |
| 273 |
$value = $row->value . '%'; |
$value = $row->value .'%'; |
| 274 |
} |
} |
| 275 |
else { |
else { |
| 276 |
$value = '$'. $row->value; |
$value = '$'. $row->value; |
| 277 |
} |
} |
| 278 |
$rows[] = array($row->bankname, $row->cardname, format_date($row->valid_until, 'custom', 'd/m/Y'),l(t('Instalments'), "admin/store/settings/banks/instalments/$row->cid") . '|' . l(t('edit'), "admin/store/settings/banks/$row->cid/edit") . '|' . l(t('delete'),"admin/store/settings/banks/$row->cid/delete")); |
$rows[] = array($row->bankname, $row->cardname, format_date($row->valid_until, 'custom', 'd/m/Y'), l(t('Instalments'), "admin/store/settings/banks/instalments/$row->cid") .'|'. l(t('edit'), "admin/store/settings/banks/$row->cid/edit") .'|'. l(t('delete'), "admin/store/settings/banks/$row->cid/delete")); |
| 279 |
} |
} |
| 280 |
|
|
| 281 |
$header = array(array('data' => 'Bank Name', 'width' => '100'), 'Card Name','Valid Until','Ops'); |
$header = array(array('data' => 'Bank Name', 'width' => '100'), 'Card Name', 'Valid Until', 'Ops'); |
| 282 |
$output .= theme('table',$header, $rows, array('width' => '100%')); |
$output .= theme('table', $header, $rows, array('width' => '100%')); |
| 283 |
if ($output == null) { |
if ($output == null) { |
| 284 |
$output = "<p>There are currently no bank in the system.</p>"; |
$output = "<p>There are currently no bank in the system.</p>"; |
| 285 |
} |
} |
| 296 |
$value = uc_turkish_banks_load($cid); |
$value = uc_turkish_banks_load($cid); |
| 297 |
// Set a form variable that holds the coupon id |
// Set a form variable that holds the coupon id |
| 298 |
$form['cid'] = array('#type' => 'value', |
$form['cid'] = array('#type' => 'value', |
| 299 |
'#value' => $value['cid'], |
'#value' => $value['cid'], |
| 300 |
); |
); |
| 301 |
$valid_until = getdate($value['valid_until']); |
$valid_until = getdate($value['valid_until']); |
| 302 |
$default_valid_until= array( |
$default_valid_until= array( |
| 310 |
$allowed_users = explode(',', $value['users']); |
$allowed_users = explode(',', $value['users']); |
| 311 |
} |
} |
| 312 |
$form['bank'] = array('#type' => 'fieldset', |
$form['bank'] = array('#type' => 'fieldset', |
| 313 |
'#title' => t('Genel Tanimlar'), |
'#title' => t('Genel Tanimlar'), |
| 314 |
'#collapsible' => true, |
'#collapsible' => true, |
| 315 |
'#collapsed' => false, |
'#collapsed' => false, |
| 316 |
'#weight' => 0, |
'#weight' => 0, |
| 317 |
); |
); |
| 318 |
|
|
| 319 |
$form['bank']['bankname'] = array('#type' => 'textfield', |
$form['bank']['bankname'] = array('#type' => 'textfield', |
| 320 |
'#title' => t('Bank Name'), |
'#title' => t('Bank Name'), |
| 321 |
'#default_value' => $value['bankname'], |
'#default_value' => $value['bankname'], |
| 322 |
'#size' => 30, |
'#size' => 30, |
| 323 |
'#weight' => -3, |
'#weight' => -3, |
| 324 |
'#required' => true, |
'#required' => true, |
| 325 |
); |
); |
| 326 |
$form['bank']['clientid'] = array('#type' => 'textfield', |
$form['bank']['clientid'] = array('#type' => 'textfield', |
| 327 |
'#title' => t('Client Id'), |
'#title' => t('Client Id'), |
| 328 |
'#default_value' => $value['clientid'], |
'#default_value' => $value['clientid'], |
| 329 |
'#size' => 30, |
'#size' => 30, |
| 330 |
'#weight' => -2, |
'#weight' => -2, |
| 331 |
'#required' => true, |
'#required' => true, |
| 332 |
); |
); |
| 333 |
$form['bank']['username'] = array('#type' => 'textfield', |
$form['bank']['username'] = array('#type' => 'textfield', |
| 334 |
'#title' => t('Username'), |
'#title' => t('Username'), |
| 335 |
'#default_value' => $value['username'], |
'#default_value' => $value['username'], |
| 336 |
'#size' => 20, |
'#size' => 20, |
| 337 |
'#weight' => -1, |
'#weight' => -1, |
| 338 |
'#required' => true, |
'#required' => true, |
| 339 |
); |
); |
| 340 |
$form['bank']['password'] = array('#type' => 'textfield', |
$form['bank']['password'] = array('#type' => 'textfield', |
| 341 |
'#title' => t('Password'), |
'#title' => t('Password'), |
| 342 |
'#default_value' => $value['password'], |
'#default_value' => $value['password'], |
| 343 |
'#size' => 20, |
'#size' => 20, |
| 344 |
'#weight' => 0, |
'#weight' => 0, |
| 345 |
'#required' => true, |
'#required' => true, |
| 346 |
); |
); |
| 347 |
$form['bank']['storekey'] = array('#type' => 'textfield', |
$form['bank']['storekey'] = array('#type' => 'textfield', |
| 348 |
'#title' => t('Store Key'), |
'#title' => t('Store Key'), |
| 349 |
'#default_value' => $value['storekey'], |
'#default_value' => $value['storekey'], |
| 350 |
'#size' => 20, |
'#size' => 20, |
| 351 |
'#weight' => 1, |
'#weight' => 1, |
| 352 |
'#required' => true, |
'#required' => true, |
| 353 |
); |
); |
| 354 |
$form['bank']['bankurl'] = array('#type' => 'textfield', |
$form['bank']['bankurl'] = array('#type' => 'textfield', |
| 355 |
'#title' => t('Bank URL'), |
'#title' => t('Bank URL'), |
| 356 |
'#default_value' => $value['bankurl'], |
'#default_value' => $value['bankurl'], |
| 357 |
'#size' => 100, |
'#size' => 100, |
| 358 |
'#weight' => 1, |
'#weight' => 1, |
| 359 |
'#required' => true, |
'#required' => true, |
| 360 |
); |
); |
| 361 |
$form['bank']['processtype'] = array('#type' => 'select', |
$form['bank']['processtype'] = array('#type' => 'select', |
| 362 |
'#title' => t('Process Type'), |
'#title' => t('Process Type'), |
| 363 |
'#default_value' => $value['processtype'], |
'#default_value' => $value['processtype'], |
| 364 |
'#description' => t('Auth: Satis PreAuth: On Otorizasyon.'), |
'#description' => t('Auth: Satis PreAuth: On Otorizasyon.'), |
| 365 |
'#options' => array( |
'#options' => array( |
| 366 |
'Auth' => t('Auth'), |
'Auth' => t('Auth'), |
| 367 |
'PreAuth' => t('PreAuth'), |
'PreAuth' => t('PreAuth'), |
| 368 |
), |
), |
| 369 |
'#weight' => 1, |
'#weight' => 1, |
| 370 |
'#required' => true, |
'#required' => true, |
| 371 |
); |
); |
| 372 |
|
|
| 373 |
$form['bank']['cardname'] = array('#type' => 'textfield', |
$form['bank']['cardname'] = array('#type' => 'textfield', |
| 374 |
'#title' => t('Card Name'), |
'#title' => t('Card Name'), |
| 375 |
'#default_value' => $value['cardname'], |
'#default_value' => $value['cardname'], |
| 376 |
'#size' => 30, |
'#size' => 30, |
| 377 |
'#weight' => 2, |
'#weight' => 2, |
| 378 |
'#required' => true, |
'#required' => true, |
| 379 |
); |
); |
| 380 |
|
|
| 381 |
$form['bank']['valid_until'] = array('#type' => 'select', |
$form['bank']['valid_until'] = array('#type' => 'select', |
| 382 |
'#title' => t('Experiation Date'), |
'#title' => t('Experiation Date'), |
| 383 |
'#type' => 'date', |
'#type' => 'date', |
| 384 |
'#default_value' => $default_valid_until, |
'#default_value' => $default_valid_until, |
| 385 |
'#required' => TRUE, |
'#required' => TRUE, |
| 386 |
'#weight' => 3, |
'#weight' => 3, |
| 387 |
); |
); |
| 388 |
|
|
| 389 |
$form['cancel'] = array('#type' => 'item', |
$form['cancel'] = array('#type' => 'item', |
| 390 |
'#value' => l(t('Cancel and return to Bank Listing'), 'admin/store/settings/banks'), |
'#value' => l(t('Cancel and return to Bank Listing'), 'admin/store/settings/banks'), |
| 391 |
'#weight' => 20, |
'#weight' => 20, |
| 392 |
); |
); |
| 393 |
$form['op'] = array('#type' => 'submit', |
$form['op'] = array('#type' => 'submit', |
| 394 |
'#value' => t('Submit'), |
'#value' => t('Submit'), |
| 395 |
'#weight' => 21, |
'#weight' => 21, |
| 396 |
); |
); |
| 397 |
return $form; |
return $form; |
| 398 |
} |
} |
| 412 |
* Insert/Update coupon |
* Insert/Update coupon |
| 413 |
*/ |
*/ |
| 414 |
function uc_turkish_banks_add_form_submit($form_id, $form) { |
function uc_turkish_banks_add_form_submit($form_id, $form) { |
| 415 |
$valid_until = mktime(23,59,59, |
$valid_until = mktime(23, 59, 59, |
| 416 |
$form['valid_until']['month'], |
$form['valid_until']['month'], |
| 417 |
$form['valid_until']['day'], |
$form['valid_until']['day'], |
| 418 |
$form['valid_until']['year'] |
$form['valid_until']['year'] |
| 422 |
|
|
| 423 |
if (db_query("INSERT INTO {uc_turkish_banks} (bankname,clientid,username,password,bankurl,storekey,processtype,cardname,valid_until) |
if (db_query("INSERT INTO {uc_turkish_banks} (bankname,clientid,username,password,bankurl,storekey,processtype,cardname,valid_until) |
| 424 |
VALUES ('%s','%s','%s','%s','%s','%s','%s','%s', '%d')", |
VALUES ('%s','%s','%s','%s','%s','%s','%s','%s', '%d')", |
| 425 |
$form['bankname'],$form['clientid'],$form['username'],$form['password'],$form['bankurl'],$form['storekey'],$form['processtype'],$form['cardname'],$valid_until |
$form['bankname'], $form['clientid'], $form['username'], $form['password'], $form['bankurl'], $form['storekey'], $form['processtype'], $form['cardname'], $valid_until |
| 426 |
)) { |
)) { |
| 427 |
$message = "New bank {$form['name']} added succesfully"; |
$message = "New bank {$form['name']} added succesfully"; |
| 428 |
} |
} |
| 433 |
else { |
else { |
| 434 |
// Otherwise we try to update the coupon with matching coupon id |
// Otherwise we try to update the coupon with matching coupon id |
| 435 |
if (db_query("UPDATE {uc_turkish_banks} SET bankname = '%s', clientid = '%s',username = '%s',password = '%s',bankurl = '%s',storekey = '%s',processtype = '%s',cardname = '%s',valid_until = %d WHERE cid = %d", |
if (db_query("UPDATE {uc_turkish_banks} SET bankname = '%s', clientid = '%s',username = '%s',password = '%s',bankurl = '%s',storekey = '%s',processtype = '%s',cardname = '%s',valid_until = %d WHERE cid = %d", |
| 436 |
$form['bankname'],$form['clientid'],$form['username'],$form['password'],$form['bankurl'],$form['storekey'],$form['processtype'],$form['cardname'],$valid_until,$form['cid'])) { |
$form['bankname'], $form['clientid'], $form['username'], $form['password'], $form['bankurl'], $form['storekey'], $form['processtype'], $form['cardname'], $valid_until, $form['cid'])) { |
| 437 |
$message = "Bank updated succssfully"; |
$message = "Bank updated succssfully"; |
| 438 |
} |
} |
| 439 |
else { |
else { |
| 463 |
$form['cid'] = array('#type' => 'value', '#value' => $cid); |
$form['cid'] = array('#type' => 'value', '#value' => $cid); |
| 464 |
return confirm_form($form, |
return confirm_form($form, |
| 465 |
t('Confirm Deletion of Bank %cid', array('%cid' => $cid)), |
t('Confirm Deletion of Bank %cid', array('%cid' => $cid)), |
| 466 |
'admin/store/settings/banks', |
'admin/store/settings/banks', |
| 467 |
t('Are you sure ?'), |
t('Are you sure ?'), |
| 468 |
t('Delete'), |
t('Delete'), |
| 469 |
t('Cancel') |
t('Cancel') |
| 488 |
function uc_turkish_banks_order($op, $arg1, $arg2) { |
function uc_turkish_banks_order($op, $arg1, $arg2) { |
| 489 |
switch ($op) { |
switch ($op) { |
| 490 |
case 'save': |
case 'save': |
| 491 |
list($bank_temp,$amount_temp,$bank_cid,$taksit)=explode('|', $_SESSION['taksit']); |
list($bank_temp, $amount_temp, $bank_cid, $taksit)=explode('|', $_SESSION['taksit']); |
| 492 |
//print "TEST:".$_SESSION['bank_cid'].' '. $bank.' '.$amount ; |
//print "TEST:".$_SESSION['bank_cid'].' '. $bank.' '.$amount ; |
| 493 |
db_query("UPDATE {uc_order_line_items} SET title = '%s', amount = %f, weight = 0 WHERE order_id = %d AND type ='instalment'",$bank_temp, $amount_temp, $arg1->order_id); |
db_query("UPDATE {uc_order_line_items} SET title = '%s', amount = %f, weight = 0 WHERE order_id = %d AND type ='instalment'", $bank_temp, $amount_temp, $arg1->order_id); |
| 494 |
if (db_affected_rows() == 0) { |
if (db_affected_rows() == 0) { |
| 495 |
db_query("INSERT INTO {uc_order_line_items} (order_id, type, title, amount, weight) VALUES (%d, 'instalment', '%s', %f, 0)", $arg1->order_id,$bank_temp, $amount_temp); |
db_query("INSERT INTO {uc_order_line_items} (order_id, type, title, amount, weight) VALUES (%d, 'instalment', '%s', %f, 0)", $arg1->order_id, $bank_temp, $amount_temp); |
| 496 |
} |
} |
| 497 |
break; |
break; |
| 498 |
/* |
/* |
| 507 |
} |
} |
| 508 |
break; |
break; |
| 509 |
*/ |
*/ |
| 510 |
} |
} |
| 511 |
} |
} |
| 512 |
|
|
| 513 |
/** |
/** |
| 595 |
return $methods; |
return $methods; |
| 596 |
} |
} |
| 597 |
|
|
|
/******************************************************************************* |
|
|
* Callback Functions, Forms, and Tables |
|
|
******************************************************************************/ |
|
|
|
|
| 598 |
/** |
/** |
| 599 |
* Callback for banks payment method settings. |
* Callback for banks payment method settings. |
| 600 |
*/ |
*/ |
| 617 |
$select1.='<option selected>Bankalar...</option>'; |
$select1.='<option selected>Bankalar...</option>'; |
| 618 |
$outer=1; |
$outer=1; |
| 619 |
while ($row = db_fetch_array($result)) { |
while ($row = db_fetch_array($result)) { |
| 620 |
$select1.= '<OPTION VALUE="'. $outer. '">'. $row['bankname'].'</OPTION>' ; |
$select1 .= '<option value="'. $outer .'">'. $row['bankname'] .'</option>'; |
| 621 |
$select2Opt.= 'group[0]['.$outer.']=new Option("option'.$outer.'");'; |
$select2Opt .= 'group[0]['. $outer .']=new Option("option'. $outer .'");'; |
| 622 |
$inner=0; |
$inner=0; |
| 623 |
$select3OptLst .= 'group['.$outer.']['.$inner++.']=new Option("Taksitler");'; |
$select3OptLst .= 'group['. $outer .']['. $inner++ .']=new Option("Taksitler");'; |
| 624 |
|
|
| 625 |
$cid_ins = $row['cid']; |
$cid_ins = $row['cid']; |
| 626 |
$result_ins = db_query("SELECT * FROM {uc_turkish_banks_instalments} where cid = %d and valid_until > CURDATE() ORDER BY instalment", $cid_ins); |
$result_ins = db_query("SELECT * FROM {uc_turkish_banks_instalments} where cid = %d and valid_until > CURDATE() ORDER BY instalment", $cid_ins); |
| 627 |
while ($row_ins = db_fetch_array($result_ins)) { |
while ($row_ins = db_fetch_array($result_ins)) { |
| 628 |
$new= $row_ins['instalment_ratio'] * $subtotal; |
$new= $row_ins['instalment_ratio'] * $subtotal; |
| 629 |
$select_text = $row_ins['instalment']. " taksit +". uc_currency_format($new); |
$select_text = $row_ins['instalment'] ." taksit +". uc_currency_format($new); |
| 630 |
$select_value= $row['cardname']. ' ile '.$row_ins['instalment'] .' taksit'. '|'. $new.'|'.$row['cid'].'|'.$i; |
$select_value= $row['cardname'] .' ile '. $row_ins['instalment'] .' taksit'.'|'. $new .'|'. $row['cid'] .'|'. $i; |
| 631 |
$select3OptLst .= 'group['.$outer.']['.$inner++.']=new Option("'.$select_text.'","'.$select_value.'");'; |
$select3OptLst .= 'group['. $outer. ']['. $inner++ .']=new Option("'. $select_text .'","'. $select_value .'");'; |
| 632 |
} |
} |
| 633 |
/* |
/* |
| 634 |
for ($i=2;$i<=18;$i++) |
for ($i=2;$i<=18;$i++) |
| 646 |
} |
} |
| 647 |
$select1.='</select>'; |
$select1.='</select>'; |
| 648 |
|
|
| 649 |
$details = '<div class="form-item"><b>'. t('Select instalment:'). '</b>' |
$details = '<div class="form-item"><b>'. t('Select instalment:') .'</b>' |
| 650 |
. $select1 |
. $select1 |
| 651 |
. $select2 |
. $select2 |
| 652 |
.'<script> |
.'<script> |
| 654 |
var groups=document.getElementById("uc-cart-checkout-form").banka.options.length; |
var groups=document.getElementById("uc-cart-checkout-form").banka.options.length; |
| 655 |
var group=new Array(groups); |
var group=new Array(groups); |
| 656 |
for (i=0; i<groups; i++) |
for (i=0; i<groups; i++) |
| 657 |
group[i]=new Array();' |
group[i]=new Array();'. $select2Opt . $select3OptLst |
|
.$select2Opt |
|
|
.$select3OptLst |
|
|
|
|
| 658 |
.'var temp=document.getElementById("uc-cart-checkout-form").taksit; |
.'var temp=document.getElementById("uc-cart-checkout-form").taksit; |
|
|
|
| 659 |
function subselect(x){ |
function subselect(x){ |
| 660 |
if (x > 0) |
if (x > 0) |
| 661 |
{ |
{ |
| 719 |
function uc_turkish_banks_form($order) { |
function uc_turkish_banks_form($order) { |
| 720 |
//print "CID:".$_SESSION['taksit']; |
//print "CID:".$_SESSION['taksit']; |
| 721 |
|
|
| 722 |
list($bank_temp,$amount_temp,$bank_cid,$taksit)=explode('|', $_SESSION['taksit']); |
list($bank_temp, $amount_temp, $bank_cid, $instalment)=explode('|', $_SESSION['taksit']); |
| 723 |
|
|
| 724 |
$bank = db_fetch_object(db_query("SELECT * FROM {uc_turkish_banks} WHERE cid = %d", $bank_cid)); |
$bank = db_fetch_object(db_query("SELECT * FROM {uc_turkish_banks} WHERE cid = %d", $bank_cid)); |
| 725 |
|
|
| 726 |
$clientId = $bank->clientid; //banks tarafindan magazaya verilen isyeri numarasi |
$client_id = $bank->clientid; //banks tarafindan magazaya verilen isyeri numarasi |
| 727 |
$amount = uc_currency_format($order->order_total, FALSE, FALSE, '.'); //tutar |
$amount = uc_currency_format($order->order_total, FALSE, FALSE, '.'); //tutar |
| 728 |
$oid = $order->order_id; //Siparis numarasi |
$oid = $order->order_id; //Siparis numarasi |
| 729 |
$okUrl = url('cart/banks/complete/'. uc_cart_get_id(), NULL, NULL, TRUE); //Islem basariliysa dönülecek isyeri sayfasi (3D isleminin ve ödeme isleminin sonucu) |
$ok_url = url('cart/banks/complete/'. uc_cart_get_id(), NULL, NULL, TRUE); //Islem basariliysa dönülecek isyeri sayfasi (3D isleminin ve ödeme isleminin sonucu) |
| 730 |
$failUrl = url('cart/banks/complete/'. uc_cart_get_id(), NULL, NULL, TRUE); //Islem basarisizsa dönülecek isyeri sayfasi (3D isleminin ve ödeme isleminin sonucu) |
$fail_url = url('cart/banks/complete/'. uc_cart_get_id(), NULL, NULL, TRUE); //Islem basarisizsa dönülecek isyeri sayfasi (3D isleminin ve ödeme isleminin sonucu) |
| 731 |
$rnd = microtime(); //Tarih ve zaman gibi sürekli degisen bir deger güvenlik amacli kullaniliyor |
$rnd = microtime(); //Tarih ve zaman gibi sürekli degisen bir deger güvenlik amacli kullaniliyor |
| 732 |
$islemtipi= $bank->processtype; //Islem tipi |
$process_type= $bank->processtype; //Islem tipi |
| 733 |
$storekey = $bank->storekey; //Isyeri anahtari |
$storekey = $bank->storekey; //Isyeri anahtari |
|
|
|
|
$hashstr = $clientId . $oid . $amount . $okUrl . $failUrl . $islemtipi . $taksit . $rnd . $storekey; //güvenlik amacli hashli deger |
|
|
$hash = base64_encode(pack('H*',sha1($hashstr))); |
|
| 734 |
|
|
| 735 |
|
$hashstr = $client_id . $oid . $amount . $ok_url . $fail_url . $process_type . $instalment . $rnd . $storekey; //güvenlik amacli hashli deger |
| 736 |
|
$hash = base64_encode(pack('H*', sha1($hashstr))); |
| 737 |
|
|
| 738 |
$data = array( |
$data = array( |
| 739 |
'clientid' => $clientId, |
'clientid' => $client_id, |
| 740 |
'firmaadi' => variable_get('uc_store_name', ''), |
'firmaadi' => variable_get('uc_store_name', ''), |
| 741 |
'amount' => $amount, |
'amount' => $amount, |
| 742 |
'oid' => $oid, |
'oid' => $oid, |
| 743 |
'okUrl' => $okUrl, |
'okUrl' => $ok_url, |
| 744 |
'failUrl' => $failUrl, |
'failUrl' => $fail_url, |
| 745 |
'islemtipi' => $islemtipi, |
'islemtipi' => $process_type, |
| 746 |
'taksit' => $taksit, |
'taksit' => $instalment, |
| 747 |
'rnd' => $rnd, |
'rnd' => $rnd, |
| 748 |
'hash' => $hash, |
'hash' => $hash, |
| 749 |
'storetype' => '3d_oos_pay', |
'storetype' => '3d_oos_pay', |
| 795 |
$index2=0; |
$index2=0; |
| 796 |
|
|
| 797 |
while ($index1 < strlen($hashparams)) { |
while ($index1 < strlen($hashparams)) { |
| 798 |
$index2 = strpos($hashparams,":",$index1); |
$index2 = strpos($hashparams, ":", $index1); |
| 799 |
$vl = $_POST[substr($hashparams,$index1,$index2- $index1)]; |
$vl = $_POST[substr($hashparams, $index1, $index2 - $index1)]; |
| 800 |
if ($vl == NULL) { |
if ($vl == NULL) { |
| 801 |
$vl = ""; |
$vl = ""; |
| 802 |
} |
} |
| 804 |
$index1 = $index2 + 1; |
$index1 = $index2 + 1; |
| 805 |
} |
} |
| 806 |
$storekey = variable_get('banks_settings_isyeri_anahtari', ''); |
$storekey = variable_get('banks_settings_isyeri_anahtari', ''); |
| 807 |
$hashval = $paramsval.$storekey; |
$hashval = $paramsval . $storekey; |
| 808 |
|
|
| 809 |
$hash = base64_encode(pack('H*',sha1($hashval))); |
$hash = base64_encode(pack('H*', sha1($hashval))); |
| 810 |
|
|
| 811 |
if($paramsval != $hashparamsval || $hashparam != $hash) |
if ($paramsval!=$hashparamsval || $hashparam!=$hash) { |
|
{ |
|
| 812 |
uc_order_comment_save($order->order_id, 0, t('Güvenlik Uyarisi. Sayisal Imza Geçerli Degil'), 'admin'); |
uc_order_comment_save($order->order_id, 0, t('Güvenlik Uyarisi. Sayisal Imza Geçerli Degil'), 'admin'); |
| 813 |
} |
} |
| 814 |
|
|
| 815 |
$mdStatus = $_POST["mdStatus"]; |
$md_status = $_POST["mdStatus"]; |
| 816 |
$ErrMsg = $_POST["mdErrorMsg"]; |
$err_msg = $_POST["mdErrorMsg"]; |
| 817 |
|
|
| 818 |
if($mdStatus == 1 || $mdStatus == 2 || $mdStatus == 3 || $mdStatus == 4) |
if ($md_status == 1 || $md_status == 2 || $md_status == 3 || $md_status == 4) { |
|
{ |
|
| 819 |
$comment = t('Ödeme alidi.'); |
$comment = t('Ödeme alidi.'); |
| 820 |
uc_payment_enter($order->order_id, 'Garanti Bank', $_POST["amount"], 0, NULL, $comment); |
uc_payment_enter($order->order_id, 'Garanti Bank', $_POST["amount"], 0, NULL, $comment); |
| 821 |
uc_order_comment_save($order->order_id, 0, t('Order created through website.'), 'admin'); |
uc_order_comment_save($order->order_id, 0, t('Order created through website.'), 'admin'); |
| 822 |
$_SESSION['do_complete'] = TRUE; |
$_SESSION['do_complete'] = TRUE; |
| 823 |
drupal_goto('cart/checkout/complete'); |
drupal_goto('cart/checkout/complete'); |
| 824 |
} |
} |
| 825 |
else |
else { |
|
{ |
|
| 826 |
$message = t('Odemeniz <b><font color="RED">GERCEKLESEMEMISTIR</font></b>. Lutfen sepetinizi kontrol ederek tekrar deneyiniz.'); |
$message = t('Odemeniz <b><font color="RED">GERCEKLESEMEMISTIR</font></b>. Lutfen sepetinizi kontrol ederek tekrar deneyiniz.'); |
| 827 |
$message .= t('<br/><b>Detay:</b>'.$mdStatus.':'.$ErrMsg.'.'); |
$message .= t('<br/><b>Detay:</b>'. $md_status .':'. $err_msg .'.'); |
| 828 |
drupal_set_message($message); |
drupal_set_message($message); |
| 829 |
$_SESSION['do_review'] = TRUE; |
$_SESSION['do_review'] = TRUE; |
| 830 |
drupal_goto('cart/checkout/review'); |
drupal_goto('cart/checkout/review'); |
| 833 |
|
|
| 834 |
/******************************************************************************* |
/******************************************************************************* |
| 835 |
* Hook Functions (Ubercart) |
* Hook Functions (Ubercart) |
| 836 |
******************************************************************************/ |
*******************************************************************************/ |
| 837 |
|
|
| 838 |
function uc_turkish_banks_payment_gateway() { |
function uc_turkish_banks_payment_gateway() { |
| 839 |
$gateways[] = array( |
$gateways[] = array( |
| 909 |
|
|
| 910 |
// XML request sablonu |
// XML request sablonu |
| 911 |
$request= "DATA=<?xml version=\"1.0\" encoding=\"ISO-8859-9\"?>". |
$request= "DATA=<?xml version=\"1.0\" encoding=\"ISO-8859-9\"?>". |
| 912 |
"<CC5Request>". |
"<CC5Request>". |
| 913 |
"<Name>{NAME}</Name>". |
"<Name>{NAME}</Name>". |
| 914 |
"<Password>{PASSWORD}</Password>". |
"<Password>{PASSWORD}</Password>". |
| 915 |
"<ClientId>{CLIENTID}</ClientId>". |
"<ClientId>{CLIENTID}</ClientId>". |
| 916 |
"<IPAddress>{IP}</IPAddress>". |
"<IPAddress>{IP}</IPAddress>". |
| 917 |
"<Email>{EMAIL}</Email>". |
"<Email>{EMAIL}</Email>". |
| 918 |
"<Mode>P</Mode>". |
"<Mode>P</Mode>". |
| 919 |
"<OrderId>{OID}</OrderId>". |
"<OrderId>{OID}</OrderId>". |
| 920 |
"<GroupId></GroupId>". |
"<GroupId></GroupId>". |
| 921 |
"<TransId></TransId>". |
"<TransId></TransId>". |
| 922 |
"<UserId></UserId>". |
"<UserId></UserId>". |
| 923 |
"<Type>{TYPE}</Type>". |
"<Type>{TYPE}</Type>". |
| 924 |
"<Number>{MD}</Number>". |
"<Number>{MD}</Number>". |
| 925 |
"<Expires></Expires>". |
"<Expires></Expires>". |
| 926 |
"<Cvv2Val></Cvv2Val>". |
"<Cvv2Val></Cvv2Val>". |
| 927 |
"<Total>{TUTAR}</Total>". |
"<Total>{TUTAR}</Total>". |
| 928 |
"<Currency>949</Currency>". |
"<Currency>949</Currency>". |
| 929 |
"<Taksit>{TAKSIT}</Taksit>". |
"<Taksit>{TAKSIT}</Taksit>". |
| 930 |
"<PayerTxnId>{XID}</PayerTxnId>". |
"<PayerTxnId>{XID}</PayerTxnId>". |
| 931 |
"<PayerSecurityLevel>{ECI}</PayerSecurityLevel>". |
"<PayerSecurityLevel>{ECI}</PayerSecurityLevel>". |
| 932 |
"<PayerAuthenticationCode>{CAVV}</PayerAuthenticationCode>". |
"<PayerAuthenticationCode>{CAVV}</PayerAuthenticationCode>". |
| 933 |
"<CardholderPresentCode>13</CardholderPresentCode>". |
"<CardholderPresentCode>13</CardholderPresentCode>". |
| 934 |
"<BillTo>". |
"<BillTo>". |
| 935 |
"<Name></Name>". |
"<Name></Name>". |
| 936 |
"<Street1></Street1>". |
"<Street1></Street1>". |
| 937 |
"<Street2></Street2>". |
"<Street2></Street2>". |
| 938 |
"<Street3></Street3>". |
"<Street3></Street3>". |
| 939 |
"<City></City>". |
"<City></City>". |
| 940 |
"<StateProv></StateProv>". |
"<StateProv></StateProv>". |
| 941 |
"<PostalCode></PostalCode>". |
"<PostalCode></PostalCode>". |
| 942 |
"<Country></Country>". |
"<Country></Country>". |
| 943 |
"<Company></Company>". |
"<Company></Company>". |
| 944 |
"<TelVoice></TelVoice>". |
"<TelVoice></TelVoice>". |
| 945 |
"</BillTo>". |
"</BillTo>". |
| 946 |
"<ShipTo>". |
"<ShipTo>". |
| 947 |
"<Name></Name>". |
"<Name></Name>". |
| 948 |
"<Street1></Street1>". |
"<Street1></Street1>". |
| 949 |
"<Street2></Street2>". |
"<Street2></Street2>". |
| 950 |
"<Street3></Street3>". |
"<Street3></Street3>". |
| 951 |
"<City></City>". |
"<City></City>". |
| 952 |
"<StateProv></StateProv>". |
"<StateProv></StateProv>". |
| 953 |
"<PostalCode></PostalCode>". |
"<PostalCode></PostalCode>". |
| 954 |
"<Country></Country>". |
"<Country></Country>". |
| 955 |
"</ShipTo>". |
"</ShipTo>". |
| 956 |
"<Extra></Extra>". |
"<Extra></Extra>". |
| 957 |
"</CC5Request>"; |
"</CC5Request>"; |
| 958 |
|
|
| 959 |
$taksit=0; |
$taksit=0; |
| 960 |
|
|
| 961 |
$request=str_replace("{NAME}",variable_get('banks_settings_name',''),$request); |
$request=str_replace("{NAME}", variable_get('banks_settings_name', ''), $request); |
| 962 |
$request=str_replace("{PASSWORD}",variable_get('banks_settings_password',''),$request); |
$request=str_replace("{PASSWORD}", variable_get('banks_settings_password', ''), $request); |
| 963 |
$request=str_replace("{CLIENTID}",variable_get('banks_settings_clientid',''),$request); |
$request=str_replace("{CLIENTID}", variable_get('banks_settings_clientid', ''), $request); |
| 964 |
$request=str_replace("{IP}",GetHostByName($REMOTE_ADDR),$request); |
$request=str_replace("{IP}", GetHostByName($REMOTE_ADDR), $request); |
| 965 |
$request=str_replace("{OID}",$order_id,$request); |
$request=str_replace("{OID}", $order_id, $request); |
| 966 |
$request=str_replace("{TYPE}",variable_get('banks_transaction_mode', 'test'),$request); |
$request=str_replace("{TYPE}", variable_get('banks_transaction_mode', 'test'), $request); |
| 967 |
$request=str_replace("{CCNO}",$order->payment_details['cc_number'],$request); |
$request=str_replace("{CCNO}", $order->payment_details['cc_number'], $request); |
| 968 |
$request=str_replace("{CCTAR}","$order->payment_details['cc_exp_month']/$order->payment_details['cc_exp_year']",$request); |
$request=str_replace("{CCTAR}", "$order->payment_details['cc_exp_month']/$order->payment_details['cc_exp_year']", $request); |
| 969 |
$request=str_replace("{CV2}","$order->payment_details['cc_cvv']",$request); |
$request=str_replace("{CV2}", "$order->payment_details['cc_cvv']", $request); |
| 970 |
$request=str_replace("{TUTAR}",$amount,$request); |
$request=str_replace("{TUTAR}", $amount, $request); |
| 971 |
$request=str_replace("{TAKSIT}",$taksit,$request); |
$request=str_replace("{TAKSIT}", $taksit, $request); |
| 972 |
|
|
| 973 |
$transaction_mode = variable_get('banks_settings_transaction_mode', 'test'); |
$transaction_mode = variable_get('banks_settings_transaction_mode', 'test'); |
| 974 |
if ($transaction_mode == 'test') { |
if ($transaction_mode == 'test') { |
| 979 |
} |
} |
| 980 |
|
|
| 981 |
$ch = curl_init(); // initialize curl handle |
$ch = curl_init(); // initialize curl handle |
| 982 |
curl_setopt($ch, CURLOPT_URL,$url); // set url to post to |
curl_setopt($ch, CURLOPT_URL, $url); // set url to post to |
| 983 |
//curl_setopt($ch, CURLOPT_VERBOSE, 0); |
//curl_setopt($ch, CURLOPT_VERBOSE, 0); |
| 984 |
//curl_setopt($ch, CURLOPT_POST, 1); |
//curl_setopt($ch, CURLOPT_POST, 1); |
| 985 |
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
| 986 |
//curl_setopt($ch, CURLOPT_NOPROGRESS, 1); |
//curl_setopt($ch, CURLOPT_NOPROGRESS, 1); |
| 987 |
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION,0); |
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); |
| 988 |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,1); |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); |
| 989 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0); |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); |
| 990 |
curl_setopt($ch, CURLOPT_SSLVERSION, 3); |
curl_setopt($ch, CURLOPT_SSLVERSION, 3); |
| 991 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable |
| 992 |
curl_setopt($ch, CURLOPT_TIMEOUT, 90); // times out after 4s |
curl_setopt($ch, CURLOPT_TIMEOUT, 90); // times out after 4s |
| 993 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $request); // add POST fields |
curl_setopt($ch, CURLOPT_POSTFIELDS, $request); // add POST fields |
| 994 |
|
|
| 999 |
} |
} |
| 1000 |
curl_close($ch); |
curl_close($ch); |
| 1001 |
|
|
| 1002 |
$Response =""; |
$response =""; |
| 1003 |
$OrderId =""; |
$order_id =""; |
| 1004 |
$AuthCode =""; |
$auth_code =""; |
| 1005 |
$ProcReturnCode =""; |
$proc_return_code =""; |
| 1006 |
$ErrMsg =""; |
$err_msg =""; |
| 1007 |
$HOSTMSG =""; |
$host_msg =""; |
| 1008 |
|
|
| 1009 |
$response_tag="Response"; |
$response_tag="Response"; |
| 1010 |
$posf = strpos($result, "<". $response_tag .">"); |
$posf = strpos($result, "<". $response_tag .">"); |
| 1011 |
$posl = strpos($result, "</". $response_tag .">"); |
$posl = strpos($result, "</". $response_tag .">"); |
| 1012 |
$posf = $posf+ strlen($response_tag) +2 ; |
$posf = $posf+ strlen($response_tag) +2 ; |
| 1013 |
$Response = substr($result, $posf, $posl - $posf); |
$response = substr($result, $posf, $posl - $posf); |
| 1014 |
|
|
| 1015 |
$response_tag="OrderId"; |
$response_tag="OrderId"; |
| 1016 |
$posf = strpos($result, "<". $response_tag .">"); |
$posf = strpos($result, "<". $response_tag .">"); |
| 1017 |
$posl = strpos($result, "</". $response_tag .">"); |
$posl = strpos($result, "</". $response_tag .">"); |
| 1018 |
$posf = $posf+ strlen($response_tag) +2; |
$posf = $posf+ strlen($response_tag) +2; |
| 1019 |
$OrderId = substr($result, $posf, $posl - $posf); |
$order_id = substr($result, $posf, $posl - $posf); |
| 1020 |
|
|
| 1021 |
$response_tag="AuthCode"; |
$response_tag="AuthCode"; |
| 1022 |
$posf = strpos($result, "<". $response_tag .">"); |
$posf = strpos($result, "<". $response_tag .">"); |
| 1023 |
$posl = strpos($result, "</". $response_tag .">"); |
$posl = strpos($result, "</". $response_tag .">"); |
| 1024 |
$posf = $posf+ strlen($response_tag) +2; |
$posf = $posf+ strlen($response_tag) +2; |
| 1025 |
$AuthCode = substr($result, $posf, $posl - $posf); |
$auth_code = substr($result, $posf, $posl - $posf); |
| 1026 |
|
|
| 1027 |
$response_tag="ProcReturnCode"; |
$response_tag="ProcReturnCode"; |
| 1028 |
$posf = strpos($result, "<". $response_tag .">"); |
$posf = strpos($result, "<". $response_tag .">"); |
| 1029 |
$posl = strpos($result, "</". $response_tag .">"); |
$posl = strpos($result, "</". $response_tag .">"); |
| 1030 |
$posf = $posf+ strlen($response_tag) +2; |
$posf = $posf+ strlen($response_tag) +2; |
| 1031 |
$ProcReturnCode = substr($result, $posf, $posl - $posf); |
$proc_return_code = substr($result, $posf, $posl - $posf); |
| 1032 |
|
|
| 1033 |
$response_tag="ErrMsg"; |
$response_tag="ErrMsg"; |
| 1034 |
$posf = strpos($result, "<". $response_tag .">"); |
$posf = strpos($result, "<". $response_tag .">"); |
| 1035 |
$posl = strpos($result, "</". $response_tag .">"); |
$posl = strpos($result, "</". $response_tag .">"); |
| 1036 |
$posf = $posf+ strlen($response_tag) +2; |
$posf = $posf+ strlen($response_tag) +2; |
| 1037 |
$ErrMsg = substr($result, $posf, $posl - $posf); |
$err_msg = substr($result, $posf, $posl - $posf); |
| 1038 |
|
|
| 1039 |
$x_response_code = $Response; |
$x_response_code = $response; |
| 1040 |
$x_response_text = $ErrMsg; |
$x_response_text = $err_msg; |
| 1041 |
$x_approval_code = $AuthCode; |
$x_approval_code = $auth_code; |
| 1042 |
|
|
| 1043 |
if ($x_response_code != 'Approved') { |
if ($x_response_code != 'Approved') { |
| 1044 |
$message = t('Credit card declined: !amount', array('!amount' => uc_currency_format($amount))); |
$message = t('Credit card declined: !amount', array('!amount' => uc_currency_format($amount))); |