Update this better.
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 22 Jun 2018 14:32:13 +0000 (10:32 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 22 Jun 2018 14:32:13 +0000 (10:32 -0400)
Use same error stuff as renewal form.

index.php
models/front/billing/becomeMember.php

index 65ca3c7..1910f6f 100644 (file)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Members Billing
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: This is glmAssociate Billing Module
- * Version: 1.0.2
+ * Version: 1.0.3
  * Author: Gaslight Media
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -19,7 +19,7 @@
  * @package glmMembersBillingAddOn
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.0.2
+ * @version 1.0.3
  */
 
 /*
@@ -37,7 +37,7 @@
  *  so that we're sure the other add-ons see an up to date
  *  version from this plugin.
  */
-define('GLM_MEMBERS_BILLING_PLUGIN_VERSION', '1.0.2');
+define('GLM_MEMBERS_BILLING_PLUGIN_VERSION', '1.0.3');
 define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.25');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
index 780d54b..2ff1ac8 100644 (file)
@@ -472,12 +472,22 @@ class GlmMembersFront_billing_becomeMember // extends GlmDataBilling
                         // Do the Payment Processing.
                         $processErrors = $BillingSupport->processMemberRenewal( $accountID, $invoice_id, $invoice_data['amount'], $invoice_data['employees'] );
                         if ( $processErrors ) {
-                            if ( count( $processErrors ) > 0 ) {
+                            // if ( count( $processErrors ) > 0 ) {
+                            //     $error = true;
+                            //     $error_message = ( isset( $processErrors[0] ) && $processErrors[0] ) ? $processErrors[0] : 'There was an error trying to process your card!';
+                            //     $messages[] = '<span style="color:red;">An error occurred! ' . $error_message . '</span>';
+                            // }
+                            if ( isset( $processErrors ) && is_array( $processErrors ) && count( $processErrors ) > 0 ) {
                                 $error = true;
-                                $error_message = ( isset( $processErrors[0] ) && $processErrors[0] ) ? $processErrors[0] : 'There was an error trying to process your card!';
-                                $messages[] = '<span style="color:red;">An error occurred! ' . $error_message . '</span>';
+                                foreach ( $processErrors as $error ) {
+                                    $messages[] = '<span style="color: red;">'.$error.'</span>';
+                                }
+                            } else if ( isset( $processErrors ) && $processErrors ) {
+                                $error = true;
+                                $messages[] = '<span style="color: red;">'.$processErrors.'</span>';
                             }
                         }
+
                         break;
                     case 'pay_by_check':
                         break;