From 52bb50f6b7aadc14c15cdb2c1de35d88f42c368a Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 26 Apr 2019 09:09:08 -0400 Subject: [PATCH] Updates for square payments on admin side. square payment now working for admin side. --- classes/billingSupport.php | 4 ++++ models/admin/member/billing.php | 2 +- views/admin/billing/makePayment.html | 21 +++++++++++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/classes/billingSupport.php b/classes/billingSupport.php index fd6878b..651e6df 100644 --- a/classes/billingSupport.php +++ b/classes/billingSupport.php @@ -1400,6 +1400,7 @@ class GlmBillingSupport // Now try to run the card processor $ccResult = $CcProcessor->processPayment( $payment, $billing ); + // echo '
$ccResult: ' . print_r( $ccResult, true ) . '
'; // If successful submission - say we're complete if ( is_array( $ccResult ) && isset( $ccResult['status'] ) && $ccResult['status'] == 1 ) { @@ -1636,12 +1637,15 @@ class GlmBillingSupport $payment_id = implode( '-', $invoices ); $result = $this->processPayment( $account_id, $payment_id, $amount ); // echo '
$result: ' . print_r( $result, true ) . '
'; + if ( $result['status'] === 1 ) { // Need to record the payment. // Set transaction_time to current time. $_REQUEST['transaction_time'] = date( 'Y-m-d H:i:s' ); + $ccProcessor = $this->config['billing_settings']['proc_methods']; + // Create new payment. $payment_id = $this->createPayment( $account_id, $amount, 'Credit Card' ); diff --git a/models/admin/member/billing.php b/models/admin/member/billing.php index b54a233..4b4cfda 100644 --- a/models/admin/member/billing.php +++ b/models/admin/member/billing.php @@ -810,7 +810,7 @@ class GlmMembersAdmin_member_billing // extends GlmDataBilling // Make the Payment using Billing Support Class $errors = $BillingSupport->makePayment( $account_id, $invoices, $amount ); - echo '
$errors: ' . print_r( $errors, true ) . '
'; + // echo '
$errors: ' . print_r( $errors, true ) . '
'; // Errors will be an array if ( isset( $errors ) && !empty( $errors ) ) { diff --git a/views/admin/billing/makePayment.html b/views/admin/billing/makePayment.html index eee6ab1..1be2aeb 100644 --- a/views/admin/billing/makePayment.html +++ b/views/admin/billing/makePayment.html @@ -13,7 +13,7 @@ {/if} -
+ @@ -55,7 +55,7 @@ {* Only if payments types are setup *} {include file='common/billing/paymentForm.html'} - + {else} You don't have any unpaid invoices! @@ -65,6 +65,23 @@