Created
March 23, 2012 13:46
-
-
Save zeroasterisk/2170737 to your computer and use it in GitHub Desktop.
litleRecyclerDate()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$recycle_date = null; | |
// if 305 (Expired Card) -- we alter the cc_expires on retries every 4 days | |
if ($response_code == 305 && $attempts < 5) { | |
$cc_expires_year_increment = 0; | |
if ($attempts==1) { | |
// increment expires year by 3 = ~30% fix | |
$cc_expires_year_increment = 3; | |
} elseif ($attempts==2) { | |
// increment expires year by 2 = ~20% fix | |
$cc_expires_year_increment = 2; | |
} elseif ($attempts==3) { | |
// increment expires year by 4 = ~7% fix | |
$cc_expires_year_increment = 4; | |
} elseif ($attempts==4) { | |
// increment expires year by 1 = ~4% fix | |
$cc_expires_year_increment = 1; | |
} | |
list($month, $year) = explode('/', $bill[$this->alias]["cc_expires"]); | |
if ($cc_expires_year_increment > 0 && intval($month) > 0 && intval($year) > 0) { | |
$year = $year + $cc_expires_year_increment; | |
$recycle_date = date('Y-m-d H:i:s', strtotime('+4days')); | |
$this->__importModels('Util'); | |
$this->Util->deleteAll(array( | |
'key' => 'recyler_cc_expire_alt', | |
'misc1' => $bill[$this->alias]['id'], | |
)); | |
$this->Util->create(false); | |
$this->Util->save(array( | |
'key' => 'recyler_cc_expire_alt', | |
'misc1' => $bill[$this->alias]['id'], | |
'val' => "{$month}/{$year}", | |
)); | |
} | |
} elseif ($response_code == 100 && $attempts <= 3) { | |
$recycle_date = date('Y-m-d H:i:s', strtotime('+6days')); | |
} elseif ($response_code == 101 && $attempts <= 3) { | |
$recycle_date = date('Y-m-d H:i:s', strtotime('+6days')); | |
} elseif ($response_code == 102 && $attempts <= 2) { | |
$recycle_date = date('Y-m-d H:i:s', strtotime('+6days')); | |
} elseif ($response_code == 110 && $attempts <= 7) { | |
$recycle_date = date('Y-m-d H:i:s', strtotime('+6days')); | |
} elseif ($response_code == 120 && $attempts <= 6) { | |
$recycle_date = date('Y-m-d H:i:s', strtotime('+6days')); | |
} elseif ($response_code == 127 && $attempts <= 6) { | |
$recycle_date = date('Y-m-d H:i:s', strtotime('+6days')); | |
} elseif ($response_code == 301 && $attempts <= 4) { | |
$recycle_date = date('Y-m-d H:i:s', strtotime('+6days')); | |
} elseif ($response_code == 307 && $attempts <= 6) { | |
$recycle_date = date('Y-m-d H:i:s', strtotime('+6days')); | |
} elseif ($response_code == 349 && $attempts <= 7) { | |
$recycle_date = date('Y-m-d H:i:s', strtotime('+6days')); | |
} elseif ($response_code == 350 && $attempts <= 6) { | |
$recycle_date = date('Y-m-d H:i:s', strtotime('+6days')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment