function uc_credit_cache in Ubercart 8.4
Same name and namespace in other branches
- 5 payment/uc_credit/uc_credit.module \uc_credit_cache()
- 6.2 payment/uc_credit/uc_credit.module \uc_credit_cache()
- 7.3 payment/uc_credit/uc_credit.module \uc_credit_cache()
Caches CC details on a pageload for use in various functions.
Parameters
string $data: The encrypted, serialized string containing the CC data.
bool $encrypted: TRUE if the data is encrypted, FALSE otherwise.
Return value
array An array of credit card details.
5 calls to uc_credit_cache()
- CreditCardPaymentMethodBase::cartDetails in payment/
uc_credit/ src/ CreditCardPaymentMethodBase.php - Returns the form or render array to be displayed at checkout.
- CreditCardPaymentMethodBase::cartProcess in payment/
uc_credit/ src/ CreditCardPaymentMethodBase.php - Called when checkout is submitted with this payment method selected.
- CreditCardPaymentMethodBase::orderLoad in payment/
uc_credit/ src/ CreditCardPaymentMethodBase.php - Called when an order is being loaded with this payment method.
- CreditCardTerminalForm::submitForm in payment/
uc_credit/ src/ Form/ CreditCardTerminalForm.php - Form submission handler.
- uc_credit_form_uc_cart_checkout_review_form_alter in payment/
uc_credit/ uc_credit.module - Implements hook_form_FORM_ID_alter() for uc_cart_checkout_review_form().
File
- payment/
uc_credit/ uc_credit.module, line 154 - Defines the credit card payment method and hooks in payment gateways.
Code
function uc_credit_cache($data = NULL, $encrypted = TRUE) {
// The CC data will be stored in this static variable.
$cache =& drupal_static(__FUNCTION__, []);
if ($data) {
if ($encrypted) {
// Initialize the encryption key and class.
$key = uc_credit_encryption_key();
$crypt = \Drupal::service('uc_store.encryption');
// Save the unencrypted CC details for the duration of this request.
$data = @unserialize(base64_decode($crypt
->decrypt($key, $data)));
}
$cache = $data;
}
return $cache;
}