From: Steve Sutton Date: Wed, 10 Apr 2019 15:36:31 +0000 (-0400) Subject: Square payment setup X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=9ed41359992af7813011af968949ba6290bca188;p=WP-Plugins%2Fglm-member-db-billing.git Square payment setup Working with errors from square. --- diff --git a/css/sq-payment-form.css b/css/sq-payment-form.css index 5ab577e..56f6f61 100644 --- a/css/sq-payment-form.css +++ b/css/sq-payment-form.css @@ -175,7 +175,6 @@ width: 100%; margin-top: 16px; font-size: 14px; - color: red; font-weight: bold; text-align: left; opacity: 0.8; diff --git a/models/admin/ajax/billingAccount.php b/models/admin/ajax/billingAccount.php index 82c7d5c..7829f9d 100644 --- a/models/admin/ajax/billingAccount.php +++ b/models/admin/ajax/billingAccount.php @@ -130,20 +130,20 @@ class GlmMembersAdmin_ajax_billingAccount extends GlmDataAccounts case 'verifyInvoiceNumber': if ( isset( $_REQUEST['invoice_number'] ) && $invoiceNumber = filter_var( $_REQUEST['invoice_number'], FILTER_VALIDATE_INT ) ) { // Get the invoice - $Invoices = new GlmDataInvoices( $this->wpdb, $this->config ); + $Invoices = new GlmDataInvoices( $this->wpdb, $this->config ); $Invoices->line_items_post = true; - $invoice = $Invoices->getEntry( $invoiceNumber ); + $invoice = $Invoices->getEntry( $invoiceNumber ); $Invoices->line_items_post = false; // trigger_error( print_r( $invoice, true ), E_USER_NOTICE ); if ( !$invoice ) { - $return = array( 'status' => false, 'message' => 'no invoice' ); + $return = array( 'status' => false, 'message' => 'no invoice' ); } // trigger_error( print_r( $invoice, true ), E_USER_NOTICE ); $accountId = $invoice['account']['value']; // trigger_error( print_r( $accountId, true ), E_USER_NOTICE ); if ( !$accountId ) { - $return = array( 'status' => false, 'message' => 'no accountId' ); + $return = array( 'status' => false, 'message' => 'no accountId' ); } $invoiceTypeId = false; // Get the invoice id for the renewal line item @@ -164,9 +164,7 @@ class GlmMembersAdmin_ajax_billingAccount extends GlmDataAccounts ), ARRAY_A ); - // trigger_error( print_r( $account, true ), E_USER_NOTICE ); // Returning the invoice_type of the account - // TODO: This maybe should be the actual invoice type_id if ( $account ) { $return = array( 'status' => true, diff --git a/models/front/billing/paymentForm.php b/models/front/billing/paymentForm.php index d96b84b..b154eb2 100644 --- a/models/front/billing/paymentForm.php +++ b/models/front/billing/paymentForm.php @@ -238,16 +238,17 @@ class GlmMembersFront_billing_paymentForm // extends GlmDataBilling case 'pay_by_credit_card': // Do the Payment Processing. $processErrors = $BillingSupport->processOnlinePayment( $accountId, $invoiceId, $_REQUEST['total_renew_amount'] ); + // echo '
$processErrors: ' . print_r( $processErrors, true ) . '
'; if ( $processErrors ) { if ( isset( $processErrors ) && is_array( $processErrors ) && count( $processErrors ) > 0 ) { $error = true; foreach ( $processErrors as $error ) { - $messages[] = ''.$error.''; + $messages[] = $error; } } else if ( isset( $processErrors ) && $processErrors ) { $error = true; - $messages[] = ''.$processErrors.''; + $messages[] = $processErrors; } else { $paymentSuccess = true; } diff --git a/views/front/billing/paymentForm.html b/views/front/billing/paymentForm.html index 7419daf..d61426f 100644 --- a/views/front/billing/paymentForm.html +++ b/views/front/billing/paymentForm.html @@ -5,11 +5,13 @@ {if $paymentSuccess}Payment Completed{/if} {if $paymentError}Error With Payment{/if} +
{if $messages} {foreach $messages as $message} -
{$message}
+
  • {$message}
  • {/foreach} {/if} +
    @@ -17,19 +19,17 @@ - - -
    +

    Start by entering your invoice number. We will look up your account.

    Invoice #
    - +
    -
    +
    Membership Class
    @@ -47,7 +47,11 @@
    -
    +
    + Found invoice for: + +
    +
    Total Due
    @@ -130,7 +134,10 @@ jQuery(document).ready(function($){ console.log( 'invoice_type', msg.invoice_type ); {if $settings.allow_membership_choice} $('#invoice_type_id_' + msg.invoice_type ).attr('checked', true); + $('#billing-msg-center').hide(); $('#membername').html(msg.invoice.member_name); + $('#billing-total-due').show(); + $('#billing-member-name').show(); getPageTotal(); {else} $('#member_renewing').data( 'amount', msg.invoice.amount_total ); @@ -142,6 +149,16 @@ jQuery(document).ready(function($){ }); } ); + {if $messages} + $('#billing-error').show(); + $('#billing-msg-center').hide(); + // $('#billing-total-due').show(); + // $('#billing-member-name').show(); + {if $invoiceId} + $('#invoice_number').val( {$invoiceId} ).trigger('change'); + {/if} + + {/if} // Generate the total for the renewal. function getPageTotal(){