From: Steve Sutton Date: Fri, 29 Mar 2019 14:22:34 +0000 (-0400) Subject: Create new front end form for payments. X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=c55ef7fa63154ba3e0ea58639d0ecc3d0c405699;p=WP-Plugins%2Fglm-member-db-billing.git Create new front end form for payments. This will allow members to make payments without having to log in. --- diff --git a/classes/billingSupport.php b/classes/billingSupport.php index 5727936..9fc180f 100644 --- a/classes/billingSupport.php +++ b/classes/billingSupport.php @@ -1480,6 +1480,33 @@ class GlmBillingSupport } + public function processOnlinePayment( $account_id, $invoice_id, $amount ) { + + $result = $this->processPayment( $account_id, $invoice_id, $amount ); + + if ( $result['status'] === 1 ) { + + $_REQUEST['transaction_time'] = date( 'Y-m-d H:i:s' ); + + // Create new payment. + $payment_id = $this->createPayment( $account_id, $amount, 'Credit Card' ); + + // Record the payment. + $this->recordPayment( $payment_id, $account_id, $amount, $invoice_id ); + + // Set the contact_role for the member contact so they can login now. + if ( $account_id ) { + $this->setMemberAccountActive( $account_id ); + } + + $errors = array();//$result['errors']; + } else { + $errors = $result['errors']; + } + + return $errors; + } + /** * Set the member contact for this account as active user now. * Set member contact to contact_role = 20 diff --git a/models/admin/ajax/billingAccount.php b/models/admin/ajax/billingAccount.php index 2df9bc5..a649f51 100644 --- a/models/admin/ajax/billingAccount.php +++ b/models/admin/ajax/billingAccount.php @@ -138,10 +138,10 @@ class GlmMembersAdmin_ajax_billingAccount extends GlmDataAccounts if ( !$invoice ) { $return = array( 'status' => false, 'message' => 'no invoice' ); } - trigger_error( print_r( $invoice, true ), E_USER_NOTICE ); + // trigger_error( print_r( $invoice, true ), E_USER_NOTICE ); $accountId = $invoice['account']['value']; - trigger_error( print_r( $accountId, true ), E_USER_NOTICE ); + // trigger_error( print_r( $accountId, true ), E_USER_NOTICE ); if ( !$accountId ) { $return = array( 'status' => false, 'message' => 'no accountId' ); } @@ -164,7 +164,7 @@ class GlmMembersAdmin_ajax_billingAccount extends GlmDataAccounts ), ARRAY_A ); - trigger_error( print_r( $account, true ), E_USER_NOTICE ); + // 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 ) { diff --git a/models/admin/billing/reports.php b/models/admin/billing/reports.php index d092f01..8621b40 100644 --- a/models/admin/billing/reports.php +++ b/models/admin/billing/reports.php @@ -268,6 +268,7 @@ class GlmMembersAdmin_billing_reports extends GlmDataTransactions $this->member_data = true; $this->notes = true; $accountsResult = $this->getList( $reportWhere, $orderBy, true, 'id', $start, $limit ); + // echo '
' . print_r( $accountsResult, true ) . '
'; $totalAccounts = $this->getStats( $reportWhere ); $totalInvoices = $this->getInvoiceTotal( $reportWhere ); $totalPayments = $this->getPaymentTotal( $reportWhere ); diff --git a/models/front/billing/paymentForm.php b/models/front/billing/paymentForm.php new file mode 100644 index 0000000..b57ffab --- /dev/null +++ b/models/front/billing/paymentForm.php @@ -0,0 +1,380 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ +define('GLM_MEMBERS_BILLING_MEMBER_MENU', true); +require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataInvoices.php'; +require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/billingSupport.php'; + +class GlmMembersFront_billing_paymentForm // extends GlmDataBilling +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Billing ID + * + * @var $memberId + * @access public + */ + public $memberId = false; + + /** + * Constructor + * + * This contructor performs the work for this model. This model returns + * an array containing the following. + * + * 'status' + * + * True if successfull and false if there was a fatal failure. + * + * 'view' + * + * A suggested view name that the contoller should use instead of the + * default view for this model or false to indicate that the default view + * should be used. + * + * 'data' + * + * Data that the model is returning for use in merging with the view to + * produce output. + * + * @wpdb object WordPress database object + * + * @return array Array containing status, suggested view, and any data + */ + public function __construct ($wpdb, $config) + { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + /* + * Run constructor for the Billing data class + * + * Note, the third parameter is a flag that indicates to the Contacts + * data class that it should flag a group of fields as 'view_only'. + */ + // parent::__construct(false, false, true); + + } + + public function modelAction( $actionData = false ) + { + // Initialize Variables Here + $fromMemberMenu = false; + $this->memberId = false; + $memberData = false; + $memberName = false; + $haveMember = false; + $haveAccount = false; + $option = 'payment'; + $view = 'paymentForm'; + $account = false; + $accountId = 0; + $account_data = false; + $balance_due = false; + $invoiceHtml = false; + $management = false; + $messages = array(); + $paymentSuccess = false; + $paymentError = false; + $hasBillingAccount = false; + $member_invoice = false; + $payable_types = false; + $account_status = false; + $unregistered = false; + $invoiceId = false; + + // For lockedToMember. + $lockedToMember = false; + $lockedWhereT = 'true'; + $lockedWhere = 'true'; + + // Check for unregistered. + if ( isset( $actionData['request']['unregistered'] ) && filter_var( $actionData['request']['unregistered'], FILTER_VALIDATE_BOOLEAN ) ) { + $unregistered = filter_var( $actionData['request']['unregistered'], FILTER_VALIDATE_BOOLEAN ); + } + + // echo '
$unregistered: ' . print_r( $unregistered, true ) . '
'; + + // Call in the support class + $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config ); + + if ( isset( $_REQUEST['member'] ) && $memberId = filter_var( $_REQUEST['member'], FILTER_VALIDATE_INT ) ) { + $this->memberId = $memberId; + } + + require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMembers.php'; + $this->Members = new GlmDataMembers( $this->wpdb, $this->config ); + + if ( $this->memberId ) { + $memberData = $this->Members->getEntry( $this->memberId ); + } + + if ( isset( $memberData ) && is_array( $memberData ) && $memberData['id'] > 0 ) { + $haveMember = true; + $memberName = $memberData['name']; + } + + if ( isset( $_REQUEST['option'] ) ) { + $option = $_REQUEST['option']; + } + + $Accounts = new GlmDataAccounts( $this->wpdb, $this->config ); + + if ( isset( $memberId ) && $memberId ) { + require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php'; + $accountId = $this->wpdb->get_var( + $this->wpdb->prepare( + "SELECT id + FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts + WHERE ref_dest = %d", + $this->memberId + ) + ); + if ( isset( $accountId ) && $accountId ) { + $account_status = apply_filters( 'glm-billing-get-account-status', '', $accountId ); + } + } + + switch ( $option ) { + case 'payment': + // TODO: only the renew form if the member is not active + if ( $account_status == 'Active' ) { + $view = 'nonrenew'; + } else { + $view = 'paymentForm'; + + if ( $unregistered ) { + $lockedToMember = true; + } + + // Get list of payable invoice_types + $payable_types = $BillingSupport->getAllPayableInvoiceTypes(); + // echo '
$payable_types: ' . print_r( $payable_types, true ) . '
'; + + // Load DataClass for Management. + require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataManagement.php'; + $Management = new GlmDataBillingManagement( $this->wpdb, $this->config ); + $management = $Management->getEntry( 1 ); + + require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php'; + if ( $accountId ) { + // Need to see if there's an account for this member. + $account = $Accounts->editEntry( $accountId ); + } else { + $account = $Accounts->newEntry(); + } + } + + break; + + case 'paymentProcess': + $error = false; + $view = 'paymentFormProcess'; + + if ( isset( $_REQUEST['invoice_number'] ) ) { + $invoiceId = filter_var( $_REQUEST['invoice_number'], FILTER_VALIDATE_INT ); + } else { + die( 'Error: no invoiceId' ); + } + + // Check for account_number + // If given then this is from unregistered user. + // Have to verify that this number does match with billing_account. + if ( isset( $_REQUEST['account_number'] ) && $account_number = filter_var( $_REQUEST['account_number'], FILTER_SANITIZE_STRING ) ) { + // Verify account number. + $accountId = $this->wpdb->get_var( + $this->wpdb->prepare( + "SELECT id + FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts + WHERE account_number = %s", + $account_number + ) + ); + } + + // Start database transaction + $this->wpdb->show_errors(); + $this->wpdb->query('START TRANSACTION'); + + // Look at the payment option given + $payment_option = filter_var( $_REQUEST['payment_option'], FILTER_SANITIZE_STRING ); + + switch ( $payment_option ) { + case 'pay_by_credit_card': + // Do the Payment Processing. + $processErrors = $BillingSupport->processOnlinePayment( $accountId, $invoiceId, $_REQUEST['total_renew_amount'] ); + + if ( $processErrors ) { + if ( isset( $processErrors ) && is_array( $processErrors ) && count( $processErrors ) > 0 ) { + $error = true; + foreach ( $processErrors as $error ) { + $messages[] = ''.$error.''; + } + } else if ( isset( $processErrors ) && $processErrors ) { + $error = true; + $messages[] = ''.$processErrors.''; + } else { + $paymentSuccess = true; + } + $view = 'paymentForm'; + + // Get list of payable invoice_types + $payable_types = $BillingSupport->getAllPayableInvoiceTypes(); + + $member_invoice_id = $BillingSupport->getMembersInvoiceTypeByRefDest( $this->memberId ); + if ( $member_invoice_id ) { + $member_invoice = $BillingSupport->getInvoiceTypeById( $member_invoice_id ); + } + + if ( $this->config['settings']['allow_employees'] ) { + // Get a list of this accounts employees. If they have any. + $employees = $BillingSupport->getListOfAccountEmployees( $this->memberId ); + } + + // Load DataClass for Management. + require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataManagement.php'; + $Management = new GlmDataBillingManagement( $this->wpdb, $this->config ); + $management = $Management->getEntry( 1 ); + + // Need to see if there's an account for this member. + $account = $Accounts->editEntry( $accountId ); + } + break; + case 'pay_by_check': + break; + } + + // If there's no error reported then show the invoice + if ( !$error ) { + $this->wpdb->query( 'COMMIT' ); + // Now need to show the invoice. + $view = 'viewInvoice'; + + // Get the invoice. + $invoiceHtml = $BillingSupport->viewInvoice( $invoiceId ); + + // If the member_type is changing then update member + // Get current member type + $member_id = filter_var( $_REQUEST['member'], FILTER_VALIDATE_INT ); + if ( $member_id ) { + $current_member_type = $this->wpdb->get_var( + $this->wpdb->prepare( + "SELECT member_type + FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members + WHERE id = %d", + $member_id + ) + ); + $new_type = filter_var( $_REQUEST['member_renewing'], FILTER_VALIDATE_INT ); + $new_member_type = $this->wpdb->get_var( + $this->wpdb->prepare( + "SELECT member_type + FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoice_types + WHERE id = %d", + $new_type + ) + ); + if ( $current_member_type != $new_member_type ) { + $this->wpdb->update( + GLM_MEMBERS_PLUGIN_DB_PREFIX . 'members', + array( 'member_type' => $new_member_type ), + array( 'id' => $member_id ), + array( '%d' ), + array( '%d' ) + ); + } + } + } else { + $this->wpdb->query( 'ROLLBACK' ); + } + + break; + + } + + // Get the list of invoices for this member. + $statements = $BillingSupport->getStatementsByRefDest( $this->memberId ); + $transactions = false; + $account_data = false; + $balance_due = false; + $hasBillingAccount = false; + // echo '
$statements: ' . print_r( $statements, true ) . '
'; + if ( $statements ) { + $transactions = $statements['transactions']; + $account_data = $statements['account_data']; + $balance_due = $statements['balance_due']; + $hasBillingAccount = true; + } + // echo '
$account_data: ' . print_r( $account_data, true ) . '
'; + + // Compile template data + $templateData = array( + 'accountId' => $accountId, + 'option' => $option, + 'fromMemberMenu' => ( defined('GLM_MEMBERS_BILLING_MEMBER_MENU' ) ? true: false ), + 'lockedToMember' => $lockedToMember, + 'invoiceId' => $invoiceId, + 'memberId' => $this->memberId, + 'haveMember' => $haveMember, + 'haveAccount' => $haveAccount, + 'memberData' => $memberData, + 'memberName' => $memberName, + 'account' => $account, + 'transactions' => $transactions, + 'account_data' => $account_data, + 'balance_due' => $balance_due, + 'transaction_types' => $this->config['transaction_type'], + 'invoiceHtml' => $invoiceHtml, + 'billing_settings' => $this->config['billing_settings'], + 'management' => $management, + 'messages' => $messages, + // 'invoices' => $invoices, + 'paymentSuccess' => $paymentSuccess, + 'paymentError' => $paymentError, + 'hasBillingAccount' => $hasBillingAccount, + 'member_invoice' => $member_invoice, + 'payable_types' => $payable_types, + 'account_status' => $account_status, + ); + + // Return status, any suggested view, and any data to controller. + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'front/billing/'.$view.'.html', + 'data' => $templateData + ); + + } + + +} diff --git a/models/front/billing/renew.php b/models/front/billing/renew.php index 012e401..a0989f6 100644 --- a/models/front/billing/renew.php +++ b/models/front/billing/renew.php @@ -36,10 +36,10 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling /** * Billing ID * - * @var $memberID + * @var $memberId * @access public */ - public $memberID = false; + public $memberId = false; /** * Constructor @@ -89,7 +89,7 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling { // Initialize Variables Here $fromMemberMenu = false; - $this->memberID = false; + $this->memberId = false; $memberData = false; $memberName = false; $haveMember = false; @@ -127,34 +127,40 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling // Call in the support class $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config ); - // Check if the user is logged in. - if ( isset( $this->config['loggedInUser'] ) - && isset( $this->config['loggedInUser']['contactUser'] ) - && isset( $this->config['loggedInUser']['contactUser']['ref_dest'] ) - ) { - $this->memberID = $this->config['loggedInUser']['contactUser']['ref_dest']; - } elseif ( $unregistered ) { - $option = 'renew'; - } else { - $option = 'noaccount'; + if ( isset( $_REQUEST['member'] ) && $memberId = filter_var( $_REQUEST['member'], FILTER_VALIDATE_INT ) ) { + $this->memberId = $memberId; } - // Check if there's a logged in user who is locked to their own entity. - $lockedToMember = apply_filters('glm_members_locked_to_member_id', false); + if ( !$this->memberId ) { + // Check if the user is logged in. + if ( isset( $this->config['loggedInUser'] ) + && isset( $this->config['loggedInUser']['contactUser'] ) + && isset( $this->config['loggedInUser']['contactUser']['ref_dest'] ) + ) { + $this->memberId = $this->config['loggedInUser']['contactUser']['ref_dest']; + } elseif ( $unregistered ) { + $option = 'renew'; + } else { + $option = 'noaccount'; + } - if ($lockedToMember) { - $memberID = $lockedToMember; - $this->memberID = $memberID; - $lockedToMember = $memberID; - $lockedWhereT = 'T.ref_type = '.$this->config['ref_type_numb']['Member'].' AND T.ref_dest = '.$memberID; - $lockedWhere = 'ref_type = '.$this->config['ref_type_numb']['Member'].' AND ref_dest = '.$memberID; + // Check if there's a logged in user who is locked to their own entity. + $lockedToMember = apply_filters('glm_members_locked_to_member_id', false); + + if ($lockedToMember) { + $memberId = $lockedToMember; + $this->memberId = $memberId; + $lockedToMember = $memberId; + $lockedWhereT = 'T.ref_type = '.$this->config['ref_type_numb']['Member'].' AND T.ref_dest = '.$memberId; + $lockedWhere = 'ref_type = '.$this->config['ref_type_numb']['Member'].' AND ref_dest = '.$memberId; + } } require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataMembers.php'; $this->Members = new GlmDataMembers( $this->wpdb, $this->config ); - if ( $this->memberID ) { - $memberData = $this->Members->getEntry( $this->memberID ); + if ( $this->memberId ) { + $memberData = $this->Members->getEntry( $this->memberId ); } if ( isset( $memberData ) && is_array( $memberData ) && $memberData['id'] > 0 ) { @@ -168,14 +174,14 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling $Accounts = new GlmDataAccounts( $this->wpdb, $this->config ); - if ( isset( $memberID ) && $memberID ) { + if ( isset( $memberId ) && $memberId ) { require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php'; $accountID = $this->wpdb->get_var( $this->wpdb->prepare( "SELECT id FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts WHERE ref_dest = %d", - $this->memberID + $this->memberId ) ); if ( isset( $accountID ) && $accountID ) { @@ -205,14 +211,14 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling $payable_types = $BillingSupport->getAllPayableInvoiceTypes(); // echo '
$payable_types: ' . print_r( $payable_types, true ) . '
'; - $member_invoice_id = $BillingSupport->getMembersInvoiceTypeByRefDest( $this->memberID ); + $member_invoice_id = $BillingSupport->getMembersInvoiceTypeByRefDest( $this->memberId ); if ( $member_invoice_id ) { $member_invoice = $BillingSupport->getInvoiceTypeById( $member_invoice_id ); } if ( $this->config['settings']['allow_employees'] ) { // Get a list of this accounts employees. If they have any. - $employees = $BillingSupport->getListOfAccountEmployees( $this->memberID ); + $employees = $BillingSupport->getListOfAccountEmployees( $this->memberId ); } // Load DataClass for Management. @@ -250,15 +256,19 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling ); } - $member_invoice_id = $BillingSupport->getMembersInvoiceTypeByRefDest( $this->memberID ); + $member_invoice_id = $BillingSupport->getMembersInvoiceTypeByRefDest( $this->memberId ); + echo '
$this->memberId: ' . print_r( $this->memberId, true ) . '
'; + echo '
$member_invoice_id: ' . print_r( $member_invoice_id, true ) . '
'; if ( $member_invoice_id ) { $member_invoice = $BillingSupport->getInvoiceTypeById( $member_invoice_id ); } else { - $error = true; + $error = true; + $paymentError = true; + trigger_error( 'member_invoice_id not found', E_USER_NOTICE ); } if ( $this->config['settings']['allow_employees'] ) { - $employees = $BillingSupport->getListOfAccountEmployees( $this->memberID ); + $employees = $BillingSupport->getListOfAccountEmployees( $this->memberId ); } $invoice_data = array( @@ -301,13 +311,18 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling // Create the invoice for this member. $invoice_id = $BillingSupport->createMemberInvoiceWithEmployees( $invoice_data ); if ( !$invoice_id ) { - $error = true; + $error = true; + $paymentError = true; + trigger_error( 'invoice_id not found', E_USER_NOTICE ); } // Now that the invoice is created. Do payment Processing. // If there's any errors then re-show the form. if ( $error ) { + $paymentError = true; + trigger_error( 'error', E_USER_NOTICE ); + // Remove the invoice created. if ( $invoice_id ) { $BillingSupport->removeInvoiceById( $invoice_id ); @@ -318,14 +333,14 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling // Get list of payable invoice_types $payable_types = $BillingSupport->getAllPayableInvoiceTypes(); - $member_invoice_id = $BillingSupport->getMembersInvoiceTypeByRefDest( $this->memberID ); + $member_invoice_id = $BillingSupport->getMembersInvoiceTypeByRefDest( $this->memberId ); if ( $member_invoice_id ) { $member_invoice = $BillingSupport->getInvoiceTypeById( $member_invoice_id ); } if ( $this->config['settings']['allow_employees'] ) { // Get a list of this accounts employees. If they have any. - $employees = $BillingSupport->getListOfAccountEmployees( $this->memberID ); + $employees = $BillingSupport->getListOfAccountEmployees( $this->memberId ); } // Load DataClass for Management. @@ -362,14 +377,14 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling // Get list of payable invoice_types $payable_types = $BillingSupport->getAllPayableInvoiceTypes(); - $member_invoice_id = $BillingSupport->getMembersInvoiceTypeByRefDest( $this->memberID ); + $member_invoice_id = $BillingSupport->getMembersInvoiceTypeByRefDest( $this->memberId ); if ( $member_invoice_id ) { $member_invoice = $BillingSupport->getInvoiceTypeById( $member_invoice_id ); } if ( $this->config['settings']['allow_employees'] ) { // Get a list of this accounts employees. If they have any. - $employees = $BillingSupport->getListOfAccountEmployees( $this->memberID ); + $employees = $BillingSupport->getListOfAccountEmployees( $this->memberId ); } // Load DataClass for Management. @@ -437,7 +452,7 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling } // Get the list of invoices for this member. - $statements = $BillingSupport->getStatementsByRefDest( $this->memberID ); + $statements = $BillingSupport->getStatementsByRefDest( $this->memberId ); $transactions = false; $account_data = false; $balance_due = false; @@ -458,7 +473,7 @@ class GlmMembersFront_billing_renew // extends GlmDataBilling 'fromMemberMenu' => ( defined('GLM_MEMBERS_BILLING_MEMBER_MENU' ) ? true: false ), 'lockedToMember' => $lockedToMember, // 'numberPending' => $numberPending, - 'memberID' => $this->memberID, + 'memberId' => $this->memberId, 'haveMember' => $haveMember, 'haveAccount' => $haveAccount, 'memberData' => $memberData, diff --git a/setup/shortcodes.php b/setup/shortcodes.php index 3ab442d..b58f4ad 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -95,7 +95,16 @@ $glmMembersBillingShortcodes = array( 'attributes' => array( 'member_id' => false, 'template' => false, - 'unregistered' => false, + ), + ), + 'glm-members-billing-payment-form' => array( + 'plugin' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, + 'menu' => 'billing', + 'action' => 'paymentForm', + 'table' => false, + 'attributes' => array( + 'member_id' => false, + 'template' => false, ), ), 'glm-members-billing-become-member-form' => array( @@ -119,7 +128,13 @@ $glmMembersBillingShortcodesDescription = ' Displays a Membership Renewal Form. -ShortcodeAttributeDescription + + [glm-members-billing-payment-form] +   + + Displays an Online Payment Form. + + [glm-members-billing-become-member-form]   diff --git a/setup/validActions.php b/setup/validActions.php index 18c2061..940eb8f 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -105,6 +105,7 @@ $glmMembersBillingAddOnValidActions = array( 'frontActions' => array( 'billing' => array( 'renew' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, + 'paymentForm' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, 'becomeMember' => GLM_MEMBERS_BILLING_PLUGIN_SLUG, ), ) diff --git a/views/admin/billing/exportReportModal.html b/views/admin/billing/exportReportModal.html new file mode 100644 index 0000000..7601dbf --- /dev/null +++ b/views/admin/billing/exportReportModal.html @@ -0,0 +1,58 @@ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Show Active:
Show Pending:
Show Overdue:
Show Archived:
Show Expired:
Date Range Search: + From Date:
+
+ To Date:
+
+
Name Search: + + +
Fields to export: + + + + + + + +
Check All / Uncheck All
+ ID
+ Transaction Time
+ {$terms.term_member_cap} Name
+ Invoice Amount
+ Payment Amount
+ +
+
Export to: + Export to Spreadsheet (CSV)
+
+ Cancel + +
+
+ diff --git a/views/admin/billing/header.html b/views/admin/billing/header.html index 26b4ef3..7dd924c 100644 --- a/views/admin/billing/header.html +++ b/views/admin/billing/header.html @@ -10,5 +10,6 @@ Reports {/if} Logs + Settings
diff --git a/views/admin/billing/reports.html b/views/admin/billing/reports.html index 1783ce7..05acae7 100644 --- a/views/admin/billing/reports.html +++ b/views/admin/billing/reports.html @@ -1,6 +1,9 @@ {include file='admin/billing/header.html'}

Invoicing

{include file='admin/billing/reportsSubHeader.html'} + +
Report Export
+
@@ -67,8 +70,8 @@

Total found: {$totalAccounts}

{* Paging *} {if $paging} - - + + {/if}
{if isset( $accounts ) && !empty( $accounts )} @@ -145,8 +148,8 @@ {/if} {* Paging *} {if $paging} - - + + {/if}
{if $option == 'reportGenerator'} @@ -155,6 +158,9 @@
Total Payments: {$totalPayments}
{/if} + +{include file='admin/billing/exportReportModal.html'} + {include file='admin/footer.html'} diff --git a/views/front/billing/paymentForm.html b/views/front/billing/paymentForm.html new file mode 100644 index 0000000..9874a4b --- /dev/null +++ b/views/front/billing/paymentForm.html @@ -0,0 +1,173 @@ + +

Online Payment Form

+
+ + {if $paymentSuccess}Payment Completed{/if} + {if $paymentError}Error With Payment{/if} + + {if $messages} + {foreach $messages as $message} +
{$message}
+ {/foreach} + {/if} + +
+ + + + + + + + {if $member_invoice} +
+
+ Membership Class +
+
+ {if $settings.allow_membership_choice} + {foreach $payable_types as $type} + + {/foreach} + {else} + + {$member_invoice.name} {$member_invoice.amount} + {/if} +
+
+ {else} +
+
+ Invoice # +
+
+ +
+
+
+
+ Membership Class +
+
+ {if $settings.allow_membership_choice} + {foreach $payable_types as $type} + + {/foreach} + {/if} +
+
+ {/if} + +
+
+ Total Due +
+
+
+
+
+
+ + {* Include the Payment Form template *} + {include file='common/billing/paymentForm.html'} + + + +
+
+ + + + diff --git a/views/front/billing/paymentFormProcess.html b/views/front/billing/paymentFormProcess.html new file mode 100644 index 0000000..251f6da --- /dev/null +++ b/views/front/billing/paymentFormProcess.html @@ -0,0 +1,5 @@ + +{foreach $messages as $message} +{$message}
+{/foreach} + diff --git a/views/front/billing/renew.html b/views/front/billing/renew.html index 56ac6e5..62675da 100644 --- a/views/front/billing/renew.html +++ b/views/front/billing/renew.html @@ -13,7 +13,7 @@
- +