- }
-
- /**
- * @param null $errorCode
- * @param null $errorMessage
- *
- * @return object
- */
- public function &error($errorCode = NULL, $errorMessage = NULL) {
- $e = CRM_Core_Error::singleton();
-
- if ($errorCode) {
- if ($errorCode == '101' || $errorCode == '102') {
- $display_error = ts('Card declined by bank. Please try with a different card.');
- }
- elseif ($errorCode == '103') {
- $display_error = ts('Card reported lost or stolen. This incident will be reported.');
- }
- elseif ($errorCode == '501') {
- $display_error = ts("It appears that this transaction is a duplicate. Have you already submitted the form once? If so there may have been a connection problem. Check your email for a receipt for this transaction. If you do not receive a receipt within 2 hours you can try your transaction again. If you continue to have problems please contact the site administrator.");
- }
- elseif ($errorCode == '509') {
- $display_error = $errorMessage;
- }
- else {
- $display_error = ts('We were unable to process your payment at this time. Please try again later.');
- }
- $e->push($errorCode, 0, NULL, $display_error);
- }
- else {
- $e->push(9001, 0, NULL, ts('We were unable to process your payment at this time. Please try again later.'));
- }
- return $e;