- $date = CRM_Utils_Date::format($params['credit_card_exp_date']);
- $date = CRM_Utils_Date::mysqlToIso($date);
- $form->assign('credit_card_type', CRM_Utils_Array::value('credit_card_type', $params));
- $form->assign('credit_card_exp_date', $date);
- $form->assign('credit_card_number',
- CRM_Utils_System::mungeCreditCard($params['credit_card_number'])
- );
+ $valuesForForm = CRM_Contribute_Form_AbstractEditPayment::formatCreditCardDetails($params);
+ $form->assignVariables($valuesForForm, ['credit_card_exp_date', 'credit_card_type', 'credit_card_number']);