Going through and removing php notices when I find them.
Payment Form is now saving the payment and transactions and is working
with Authorize.net.
Need to replace the select for the member accounts on the add new
invoice page with autocomplete.
}
}
}
+ public function createPayment( $account, $payment )
+ {
+ // Insert the payment
+ $this->wpdb->insert(
+ GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'payments',
+ array(
+ 'transaction_time' => date('Y-m-d H:i:s'),
+ 'account' => $account,
+ 'amount' => $payment,
+ 'payment_method' => '',
+ 'payment_data' => '',
+ ),
+ array(
+ '%s',
+ '%d',
+ '%s',
+ '%s',
+ '%s',
+ )
+ );
+ return $this->wpdb->insert_id;
+ }
/**
* markInvoiceAsPaid
'required' => true,
),
+ // Billing First Name
+ 'billing_fname' => array(
+ 'field' => 'billing_fname',
+ 'type' => 'text',
+ 'use' => 'a',
+ 'required' => true,
+ ),
+
+ // Billing Last Name
+ 'billing_lname' => array(
+ 'field' => 'billing_lname',
+ 'type' => 'text',
+ 'use' => 'a',
+ 'required' => true,
+ ),
+
// Billing Address 1
'billing_addr1' => array(
'field' => 'billing_addr1',
'type' => 'text',
'use' => 'a',
- 'required' => false,
+ 'required' => true,
),
// Billing Address 2
'field' => 'billing_city',
'type' => 'text',
'use' => 'a',
- 'required' => false,
+ 'required' => true,
),
// Billing State
'billing_state' => array(
'field' => 'billing_state',
- 'type' => 'text',
+ 'type' => 'list',
+ 'list' => $this->config['states'],
+ 'default' => $this->config['settings']['default_state'],
'use' => 'a',
- 'required' => false,
+ 'required' => true,
),
// Billing Zip
'field' => 'billing_zip',
'type' => 'text',
'use' => 'a',
- 'required' => false,
+ 'required' => true,
),
// Billing Phone
send_date_when_numb['Before'] = 10
send_date_when_numb['After'] = 20
+
+; Credit Cards - Use as Bitmap Index or List
+;
+credit_card[1] = 'Visa'
+credit_card[2] = 'MasterCard'
+credit_card[3] = 'American Express'
+credit_card[4] = 'Discover'
+credit_card[5] = 'Diners Club'
+
+credit_card_numb['Visa'] = 1
+credit_card_numb['MasterCard'] = 2
+credit_card_numb['American Express'] = 3
+credit_card_numb['Discover'] = 4
+credit_card_numb['Diners Club'] = 5
+
+credit_card_match[1] = '/^4[0-9]{12}(?:[0-9]{3})?$/'
+credit_card_match[2] = '/^([51|52|53|54|55]{2})([0-9]{14})$/'
+credit_card_match[3] = '/^([34|37]{2})([0-9]{13})$/'
+credit_card_match[4] = '/^([6011]{4})([0-9]{12})$/'
+credit_card_match[5] = '/^([30|36|38]{2})([0-9]{12})$/'
+
+
+;
+; Card Processing Methods - Use as Bitmap Index or List
+;
+proc_method[1] = 'By Merchant'
+proc_method[2] = 'Authorize.net'
+proc_method[3] = 'Merchant Solutions'
+proc_method[98] = 'Test - Card Always Good'
+proc_method[99] = 'Test by Card Number'
+
+proc_method_numb['Merchant'] = 1
+proc_method_numb['Authorize.net'] = 2
+proc_method_numb['MerchantSolutions'] = 3
+proc_method_numb['TestAlwaysGood'] = 4
+proc_method_numb['TestByCardNumber'] = 5
+
+proc_dir[1] = 'ByMerchant'
+proc_dir[2] = 'Authorize.Net'
+proc_dir[3] = 'MerchantSolutions'
+proc_dir[98] = 'TestGood'
+proc_dir[99] = 'TestByCardNumber'
+
+;
+; Card processing test modes
+;
+proc_test_mode[1] = 'Local Transaction Approval Test'
+proc_test_mode[2] = 'Local Transaction Decline Test'
+proc_test_mode[3] = 'On-Line Transaction Test'
+proc_test_mode[99] = 'Production Mode'
+
+proc_test_mode_numb['Local Approval Test'] = 1
+proc_test_mode_numb['Local Decline Test'] = 2
+proc_test_mode_numb['On-Line Test'] = 3
+proc_test_mode_numb['Production Mode'] = 0
+
+;
+; Card processor result codes
+;
+proc_result[1] = 'Card approved'
+proc_result[2] = 'Bad data supplied to credit card processor'
+proc_result[3] = 'Communications failure with credit card processor'
+proc_result[4] = 'Bad response from the credit card processor'
+proc_result[5] = 'Credit card processor says transaction is not valid'
+proc_result[6] = 'Merchant account is not recognized by the credit card processor'
+proc_result[7] = 'Credit card has been declined'
+
+proc_result_numb['Approved'] = 1
+proc_result_numb['BadData'] = 2
+proc_result_numb['CommFailure'] = 3
+proc_result_numb['BadResponse'] = 4
+proc_result_numb['NotValid'] = 5
+proc_result_numb['BadAccount'] = 6
+proc_result_numb['Declined'] = 7
+
+; Submission Status - Use as list only
+;
+submission_status[0] = 'CART'
+submission_status[10] = 'COMPLETE'
+submission_status[20] = 'UNPAID'
+submission_status[30] = 'CC_PEND'
+submission_status[40] = 'CC_DECL'
+submission_status[50] = 'PAYMENT_PEND'
+submission_status[60] = 'ON ARRIVAL'
+submission_status[70] = 'ADMIN HOLD'
+submission_status[80] = 'FAILED'
+submission_status[99] = 'CANCELED'
+
+submission_status_numb['CART'] = 0
+submission_status_numb['COMPLETE'] = 10
+submission_status_numb['UNPAID'] = 20
+submission_status_numb['CC_PEND'] = 30
+submission_status_numb['CC_DECL'] = 40
+submission_status_numb['PAYMENT_PEND'] = 50
+submission_status_numb['ON_ARRIVAL'] = 60
+submission_status_numb['ADMIN_HOLD'] = 70
+submission_status_numb['FAILED'] = 80
+submission_status_numb['CANCELED'] = 99
+
+;
#billing-invoice-form input[name^="line_item_qty"] {
width: 50px;
}
+.glm-admin-table th {
+ white-space: nowrap;
+}
// Parameters related to the Main GLM Member DB plugin - Depending on what's going on these may already defined by the main plugin
$pluginsPath = str_replace(GLM_MEMBERS_BILLING_PLUGIN_SLUG, '', GLM_MEMBERS_BILLING_PLUGIN_PATH);
define('GLM_MEMBERS_BILLING_MAIN_PLUGIN_PATH', $pluginsPath.'/glm-member-db');
-define('GLM_MEMBERS_BILLING_PLUGIN_LIB_PATH', GLM_MEMBERS_BILLING_MAIN_PLUGIN_PATH.'/lib');
+define('GLM_MEMBERS_BILLING_PLUGIN_LIB_PATH', GLM_MEMBERS_BILLING_PLUGIN_PATH.'/lib');
* version from this plugin.
*/
define('GLM_MEMBERS_BILLING_PLUGIN_VERSION', '0.0.1');
-define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.9');
+define('GLM_MEMBERS_BILLING_PLUGIN_DB_VERSION', '0.0.10');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
define('GLM_MEMBERS_BILLING_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0');
$sale->zip = $contact['zip'];
$sale->country = $contact['country'];
$sale->invoice_num = substr($payment['invoice'], -20); // Only use last 20 chars
- $sale->description = $payment['name'].' - Event Tickets';
+ $sale->description = $payment['name'].' - Billing';
$sale->email = $contact['email'];
$sale->email_customer = $this->account['conf'];
$sale->phone = $contact['phone'];
$invoiceHtml = '';
$fromDate = '';
$toDate = '';
+ $annFromDate = '';
+ $annToDate = '';
// Get any provided option
if (isset($_REQUEST['option'])) {
/**
* $pending = array( start, limit, returned, last, list = array...)
*/
- // echo '<pre>$pending: ' . print_r( $pending, true ) . '</pre>';
- $numberPending = $pending['returned'];
+ $numberPending = ( isset( $pending['returned'] ) ? $pending['returned'] : 0 );
// Get the number of over due invoices
$overDueWhere = 'T.paid <> true AND due_date > NOW()';
public function modelAction($actionData = false)
{
- $option = 'list';
- $this->invoice_id = false;
- $haveInvoices = false;
- $invoiceUpdated = false;
- $invoiceUpdateError = false;
- $invoiceAdded = false;
- $invoiceAddError = false;
- $view = 'invoices';
- $fromDate = false;
- $toDate = false;
- $filterArchived = false;
- $filterPending = false;
- $filterFeatured = false;
- $invoiceDeleted = false;
- $invoiceDeleteError = false;
- $invoiceInsertError = false;
- $numbDisplayed = false;
- $lastDisplayed = false;
- $paging = true;
- $prevStart = false;
- $nextStart = false;
- $start = 1;
- $limit = 20; // Set to the number of listings per page
- $invTypes = array();
- $invoiceTypes = false;
- $invoiceTypeJSON = '';
- $accounts = false;
- $nonAccountMembers = false;
- $invoiceHtml = '';
- $fromDate = '';
- $toDate = '';
+ $option = 'list';
+ $this->invoice_id = false;
+ $haveInvoices = false;
+ $invoiceUpdated = false;
+ $invoiceUpdateError = false;
+ $invoiceAdded = false;
+ $invoiceAddError = false;
+ $view = 'invoices';
+ $fromDate = false;
+ $toDate = false;
+ $filterArchived = false;
+ $filterPending = false;
+ $filterFeatured = false;
+ $invoiceDeleted = false;
+ $invoiceDeleteError = false;
+ $invoiceInsertError = false;
+ $numbDisplayed = false;
+ $lastDisplayed = false;
+ $paging = true;
+ $prevStart = false;
+ $nextStart = false;
+ $start = 1;
+ $limit = 20; // Set to the number of listings per page
+ $invTypes = array();
+ $invoiceTypes = false;
+ $invoiceTypeJSON = '';
+ $accounts = false;
+ $nonAccountMembers = false;
+ $invoiceHtml = '';
+ $fromDate = '';
+ $toDate = '';
+ $invoices = false;
+ $fromMemberMenu = false;
+ $filterAccounts = '';
// Get any provided option
if (isset($_REQUEST['option'])) {
// Need to get the accounts
$Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
$accounts = $Accounts->getList();
+ // echo '<pre>$accounts: ' . print_r( $accounts, true ) . '</pre>';
$where_params = array( 'true' );
&& $filterAccounts = filter_var( $_REQUEST['filterAccounts'], FILTER_VALIDATE_INT )
) {
$accounts[$filterAccounts]['selected'] = true;
- $where_params[] = "T.account = $filterAccounts";
+ $where_params[] = "T.account = $filterAccounts";
}
// Build the $where from $where_params array.
'invoiceHtml' => $invoiceHtml,
'fromDate' => $fromDate,
'toDate' => $toDate,
+ 'fromMemberMenu' => $fromMemberMenu,
+ 'filterAccounts' => $filterAccounts,
);
// Return status, any suggested view, and any data to controller
*/
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.'/data/dataPayments.php';
require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/billingSupport.php';
// Load Billing data abstract
$account_data = false;
$balance_due = false;
$invoiceHtml = false;
+ $management = false;
+ $messages = array();
+ $invoices = false;
// For lockedToMember.
$lockedToMember = false;
break;
case 'createPayment':
- echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
+ // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
$view = 'paymentProcess';
- echo '<pre>$this->config: ' . print_r( $this->config, true ) . '</pre>';
+ // echo '<pre>$this->config: ' . print_r( $this->config, true ) . '</pre>';
// Execute selected payment method
- switch ($payMethod) {
- // Credit Card
- case $this->config['payment_method_numb']['CreditCard']:
+ // Get the selected credit card processor type
+ $ccProcessor = $this->config['billing_settings']['proc_methods'];
- // Get the selected credit card processor type
- $ccProcessor = $this->config['settings']['reg_proc_methods'];
+ // Setup the required account information for the selected payment processor
+ switch ($ccProcessor) {
- // Setup the required account information for the selected payment processor
- switch ($ccProcessor) {
+ case $this->config['proc_method_numb']['Authorize.net']:
- case $this->config['proc_method_numb']['Authorize.net']:
-
- // Get account data
- $account = array(
- 'login' => $this->config['settings']['reg_authorize_net_login'],
- 'key' => $this->config['settings']['reg_authorize_net_key'],
- 'test' => $this->config['settings']['reg_authorize_net_test'],
- 'conf' => $this->config['settings']['reg_authorize_net_conf'],
- 'email' => $this->config['settings']['reg_authorize_net_merchant_email']
- );
-
- break;
+ // Get account data
+ $account = array(
+ 'login' => $this->config['billing_settings']['authorize_net_login'],
+ 'key' => $this->config['billing_settings']['authorize_net_key'],
+ 'test' => $this->config['billing_settings']['authorize_net_test'],
+ 'conf' => $this->config['billing_settings']['authorize_net_conf'],
+ 'email' => $this->config['billing_settings']['authorize_net_merchant_email']
+ );
- case $this->config['proc_method_numb']['MerchantSolutions']:
+ break;
- // Get account data
- $account = array(
- 'acctid' => $this->config['settings']['reg_merchant_solutions_acctid'],
- 'merchantpin' => $this->config['settings']['reg_merchant_solutions_merchantpin'],
- 'test' => $this->config['settings']['reg_merchant_solutions_test'],
- 'conf' => $this->config['settings']['reg_merchant_solutions_conf'],
- 'email' => $this->config['settings']['reg_merchant_solutions_merchant_email']
- );
+ case $this->config['proc_method_numb']['MerchantSolutions']:
- break;
+ // Get account data
+ $account = array(
+ 'acctid' => $this->config['billing_settings']['merchant_solutions_acctid'],
+ 'merchantpin' => $this->config['billing_settings']['merchant_solutions_merchantpin'],
+ 'test' => $this->config['billing_settings']['merchant_solutions_test'],
+ 'conf' => $this->config['billing_settings']['merchant_solutions_conf'],
+ 'email' => $this->config['billing_settings']['merchant_solutions_merchant_email']
+ );
- // These don't require account data
- case $this->config['proc_method_numb']['Merchant']:
- case $this->config['proc_method_numb']['TestAlwaysGood']:
- case $this->config['proc_method_numb']['TestByCardNumber']:
- default:
- $account = array();
- break;
+ break;
- }
+ // These don't require account data
+ case $this->config['proc_method_numb']['Merchant']:
+ case $this->config['proc_method_numb']['TestAlwaysGood']:
+ case $this->config['proc_method_numb']['TestByCardNumber']:
+ default:
+ $account = array();
+ break;
- // Get the credit card input
- $cardData = array(
- 'cc_type' => filter_input(INPUT_POST, 'cc_type', FILTER_SANITIZE_NUMBER_INT),
- 'cc_name' => filter_input(INPUT_POST, 'cc_name', FILTER_SANITIZE_STRING),
- 'cc_numb' => filter_input(INPUT_POST, 'cc_numb', FILTER_SANITIZE_NUMBER_INT),
- 'cc_exp' => filter_input(INPUT_POST, 'cc_exp', FILTER_SANITIZE_STRING),
- 'cc_cvv' => filter_input(INPUT_POST, 'cc_cvv', FILTER_SANITIZE_NUMBER_INT)
- );
+ }
- // Check all credit card input
- if (
- $cardData['cc_type'] && $cardData['cc_type'] > 0 &&
- $cardData['cc_name'] && $cardData['cc_name'] != '' &&
- $cardData['cc_numb'] && $cardData['cc_numb'] > 0 &&
- $cardData['cc_exp'] && $cardData['cc_exp'] != '' &&
- $cardData['cc_cvv'] && $cardData['cc_cvv'] > 0
- ) {
+ // echo '<pre>$account: ' . print_r( $account, true ) . '</pre>';
+ // Get the credit card input
+ $cardData = filter_var_array(
+ $_REQUEST,
+ array(
+ 'cc_type' => FILTER_SANITIZE_STRING,
+ 'cc_name' => FILTER_SANITIZE_STRING,
+ 'cc_numb' => FILTER_SANITIZE_NUMBER_INT,
+ 'cc_exp' => FILTER_SANITIZE_STRING,
+ 'cc_cvv' => FILTER_SANITIZE_NUMBER_INT,
+ )
+ );
- if (!isset($this->config['credit_card_match'][$cardData['cc_type']]) ||
- !preg_match($this->config['credit_card_match'][$cardData['cc_type']], $cardData['cc_numb'])
- ) {
- $messages[] = 'The credit card number you entered does not match the selected type of credit card.';
- }
+ $paymentData = filter_var_array(
+ $_REQUEST,
+ array(
+ 'account_id' => FILTER_SANITIZE_NUMBER_INT,
+ 'invoice_id' => FILTER_SANITIZE_NUMBER_INT,
+ 'member' => FILTER_SANITIZE_NUMBER_INT,
+ 'amount' => array(
+ 'filter' => FILTER_SANITIZE_NUMBER_FLOAT,
+ 'flags' => FILTER_FLAG_ALLOW_FRACTION,
+ ),
+ 'billing_addr1' => FILTER_SANITIZE_STRING,
+ 'billing_addr2' => FILTER_SANITIZE_STRING,
+ 'billing_city' => FILTER_SANITIZE_STRING,
+ 'billing_state' => FILTER_SANITIZE_STRING,
+ 'billing_zip' => FILTER_SANITIZE_STRING,
+ 'billing_phone' => FILTER_SANITIZE_STRING,
+ )
+ );
- } else {
- $messages[] = 'You did not supply all required credit card information.';
- }
+ // Add billing information to billing array
+ $billing = array(
+ 'fname' => $paymentData['billing_fname'],
+ 'lname' => $paymentData['billing_lname'],
+ 'addr1' => $paymentData['billing_addr1'],
+ 'addr2' => $paymentData['billing_addr2'],
+ 'city' => $paymentData['billing_city'],
+ 'state' => $paymentData['billing_state'],
+ 'zip' => $paymentData['billing_zip'],
+ 'phone' => $paymentData['bill_phone'],
+ 'email' => $paymentData['email']
+ );
+ // echo '<pre>$cardData: ' . print_r( $cardData, true ) . '</pre>';
+ $cardMatch = $this->config['credit_card_match'];
+ // echo '<pre>$cardMatch: ' . print_r( $cardMatch, true ) . '</pre>';
+ // echo '<pre>$paymentData: ' . print_r( $paymentData, true ) . '</pre>';
+ // exit;
+
+ // Check all credit card input
+ if (
+ $cardData['cc_type'] && $cardData['cc_type'] > 0 &&
+ $cardData['cc_name'] && $cardData['cc_name'] != '' &&
+ $cardData['cc_numb'] && $cardData['cc_numb'] > 0 &&
+ $cardData['cc_exp'] && $cardData['cc_exp'] != '' &&
+ $cardData['cc_cvv'] && $cardData['cc_cvv'] > 0
+ ) {
+
+ if (!isset($this->config['credit_card_match'][$cardData['cc_type']]) ||
+ !preg_match($this->config['credit_card_match'][$cardData['cc_type']], $cardData['cc_numb'])
+ ) {
+ $messages[] = 'The credit card number you entered does not match the selected type of credit card.';
+ }
- if (count($messages) == 0) {
-
- // Determine the directory of the payment processor to load and instatiate it.
- if ($ccProcessor && isset($this->config['proc_dir'][$ccProcessor])) {
- require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_LIB_PATH.'/paymentProcessors/'.$this->config['proc_dir'][$ccProcessor].'/paymentGateway.php';
- $CcProcessor = new PaymentGateway($account);
- }
-
- $payment = array(
- 'name' => $this->config['settings']['reg_org_name'], // Name of venue
- 'charge' => $this->cart['totalCharges'], // Total charges
- 'cctype' => $cardData['cc_type'], // Card Type
- 'ccname' => $cardData['cc_name'], // Name on Card
- 'ccnumb' => $cardData['cc_numb'], // Card Number
- 'ccexp' => $cardData['cc_exp'], // Expiration Date
- 'cccode' => $cardData['cc_cvv'], // CCV - security code
- 'invoice' => 'reg-'.$_SESSION['glm_reg_cart_id'] // Invoice # is "reg-" plus cart ID
- );
-
- // Now try to run the card processor
- $ccResult = $CcProcessor->processPayment($payment, $billing);
-
- // If successful submission - say we're complete
- if (is_array($ccResult) && isset($ccResult['status']) && $ccResult['status'] == 1) {
-
- $cartStatus = $this->config['submission_status_numb']['COMPLETE'];
-
- // Store Credit Card information
- $cc_numb_store = '....'.substr($payment['ccnumb'], -4);
- $reqData = array_merge(
- $reqData,
- array(
- 'cc_type' => $payment['cctype'],
- 'cc_name' => $payment['ccname'],
- 'cc_numb' => $cc_numb_store,
- 'cc_exp' => $payment['ccexp'],
- 'cc_conf' => $ccConfirmation,
- )
- );
- $reqFormat = array_merge(
- $reqFormat,
- array(
- '%d',
- '%s',
- '%s',
- '%s',
- '%s',
- )
- );
-
- }
+ } else {
+ $messages[] = 'You did not supply all required credit card information.';
+ }
- }
+ if (count($messages) == 0) {
- break;
+ // Determine the directory of the payment processor to load and instatiate it.
+ if ($ccProcessor && isset($this->config['proc_dir'][$ccProcessor])) {
+ require_once GLM_MEMBERS_BILLING_PLUGIN_LIB_PATH.'/paymentProcessors/'.$this->config['proc_dir'][$ccProcessor].'/paymentGateway.php';
+ $CcProcessor = new PaymentGateway($account);
+ }
- // Pay Pal
- // case $this->config['payment_method_numb']['PayPal']:
- // break;
+ $payment = array(
+ 'name' => $this->config['settings']['company_name'], // Company Name
+ 'charge' => $paymentData['amount'], // Total charges
+ 'cctype' => $cardData['cc_type'], // Card Type
+ 'ccname' => $cardData['cc_name'], // Name on Card
+ 'ccnumb' => $cardData['cc_numb'], // Card Number
+ 'ccexp' => $cardData['cc_exp'], // Expiration Date
+ 'cccode' => $cardData['cc_cvv'], // CCV - security code
+ 'invoice' => 'billing-'.$paymentData['invoice_id'] // Invoice # is "reg-" plus cart ID
+ );
+
+ // Now try to run the card processor
+ $ccResult = $CcProcessor->processPayment($payment, $billing);
+ // echo '<pre>ccResult: ' . print_r( $ccResult, true ) . '</pre>';
+
+ // If successful submission - say we're complete
+ if (is_array($ccResult) && isset($ccResult['status']) && $ccResult['status'] == 1) {
+ // Need to record the payment
+
+ // Support class
+ $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
+
+ // Set transaction_time to current time.
+ $_REQUEST['transaction_time'] = date('Y-m-d H:i:s');
+ // Create new payment.
+ $payment_id = $BillingSupport->createPayment( $paymentData['account_id'], $paymentData['amount'] );
+ // Record the payment.
+ $BillingSupport->recordPayment( $payment_id, $paymentData['account_id'], $paymentData['amount'] );
+
+ $messages[] = $ccResult['statusText'];
+ $messages[] = $ccResult['description'];
- // Payment Method unknown
- default:
- $payMethod = false;
- $messages[] = "I'm sorry, we couldn't tell which payment method you wanted to use. Please select one under \"Payment Information\" below.";
- break;
+ }
}
+ // echo '<pre>$messages: ' . print_r( $messages, true ) . '</pre>';
+
break;
case 'makepayment':
+ // Load DataClass for accounts.
require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php';
$Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
+ // 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.
$accountID = $this->wpdb->get_var(
$this->memberID
)
);
- $account = $Accounts->getEntry( $accountID );
+ $account = $Accounts->editEntry( $accountID );
+
+ // Support class
+ $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
+
+ // Get unpaid invoices
+ $invoices = $BillingSupport->getUnPaidInvoicesByAccount( $account['fieldData']['id'] );
+ // echo '<pre>$invoices: ' . print_r( $invoices, true ) . '</pre>';
+ if ( !empty( $invoices ) ) {
+ foreach ( $invoices as &$invoice ) {
+ $invoice['due_date'] = date( 'n/d/Y', strtotime( $invoice['due_date'] ) );
+ }
+ }
+ $cc_accepts = $this->config['billing_settings']['cc_accepts'];
+ // echo '<pre>$cc_accepts: ' . print_r( $cc_accepts, true ) . '</pre>';
// Set the file name for the view file.
$view = 'makePayment';
// echo '<pre>$account: ' . print_r( $account, true ) . '</pre>';
- // Set this to CreditCard
- $payMethod = $this->config['payment_method_numb']['CreditCard'];
-
-
-
break;
case 'list':
- $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config);
+ $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
$view = 'statements';
// Get the list of invoices for this member.
$statements = $BillingSupport->getStatementsByRefDest( $this->memberID );
'balance_due' => $balance_due,
'transaction_types' => $this->config['transaction_type'],
'invoiceHtml' => $invoiceHtml,
+ 'billing_settings' => $this->config['billing_settings'],
+ 'management' => $management,
+ 'messages' => $messages,
+ 'invoices' => $invoices,
);
// Return status, any suggested view, and any data to controller.
--- /dev/null
+-- Gaslight Media Billing Module
+-- File Created: 11/08/2017
+-- Database Version: 0.0.3
+-- Database Creation Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+--
+-- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
+--
+
+-- Billing Accounts
+CREATE TABLE {prefix}accounts (
+ id INT NOT NULL AUTO_INCREMENT,
+ ref_dest INT NOT NULL, -- reference to member id
+ ref_name TINYTEXT NOT NULL, -- Name of reference member
+ billing_fname TINYTEXT NULL, -- Billing First Name
+ billing_lname TINYTEXT NULL, -- Billing Last Name
+ billing_addr1 TINYTEXT NULL, -- Billing Address 1
+ billing_addr2 TINYTEXT NULL, -- Billing Address 2
+ billing_city TINYTEXT NULL, -- Billing City
+ billing_state TINYTEXT NULL, -- Billing State
+ billing_zip TINYTEXT NULL, -- Billing Zip
+ billing_phone TINYTEXT NULL, -- Billing Phone
+ anniversary_date DATE NOT NULL, -- anniversary date - used for main invoice generation
+ renewal_date DATE NULL, -- renewal date of account
+ payment_data TEXT NULL, -- stored payment data
+ email TINYTEXT NULL, -- billing email
+ PRIMARY KEY (id)
+);
+
+----
+
+-- transactions
+CREATE TABLE {prefix}transactions (
+ id INT NOT NULL AUTO_INCREMENT,
+ type INT NOT NULL, -- type of transaction (payment,invoice,etc)
+ type_id INT NOT NULL, -- reference to type id
+ account INT NOT NULL, -- reference to account id
+ transaction_time DATETIME NOT NULL, -- datetime for the transaction
+ current_invoice_total DECIMAL(8, 2) NOT NULL, -- invoice total
+ current_payment_total DECIMAL(8, 2) NOT NULL, -- payment total
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Invoices
+CREATE TABLE {prefix}invoices (
+ id INT NOT NULL AUTO_INCREMENT,
+ transaction_time DATETIME NOT NULL, -- datetime for the invoice
+ account INT NOT NULL, -- ref to account id
+ amount_total DECIMAL(8, 2) NOT NULL, -- total amount for invoice
+ balance DECIMAL(8, 2) NOT NULL, -- balance for this invoice
+ due_date DATE NOT NULL, -- Due date for this invoice
+ paid BOOLEAN DEFAULT '0', -- true/false if invoice is paid
+ notes TINYTEXT, -- notes for this invoice
+ recurring BOOLEAN DEFAULT '0', -- true/false if recurring
+ recurrence INT NULL DEFAULT 0, -- recurrence type
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Line Item Types
+CREATE TABLE {prefix}invoice_types (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TINYTEXT NOT NULL, -- name
+ parent INT NOT NULL DEFAULT 0, -- 0 if top level otherwise ref to another line_item_type as it's parent
+ amount DECIMAL(8,2) NOT NULL DEFAULT '0.00', -- amount
+ recurring BOOLEAN DEFAULT '0', -- true/false if recurring
+ recurrence INT NULL DEFAULT 0, -- recurrence type
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Line Items
+CREATE TABLE {prefix}line_items (
+ id INT NOT NULL AUTO_INCREMENT,
+ invoice INT NOT NULL, -- reference to invoice
+ line_item_type INT NOT NULL, -- reference to line item type
+ name TEXT NOT NULL, -- line item name
+ amount DECIMAL(8,2) DEFAULT '0.00', -- line item amount per item
+ quantity INT DEFAULT 1, -- quantity
+ total DECIMAL(8,2) DEFAULT '0.00', -- line item total
+ recurring BOOLEAN DEFAULT '0', -- true/false if recurring
+ recurrence INT NULL DEFAULT 0, -- recurrence type
+ PRIMARY KEY (id)
+);
+
+----
+
+-- payments
+CREATE TABLE {prefix}payments (
+ id INT NOT NULL AUTO_INCREMENT,
+ transaction_time DATETIME NOT NULL, -- datetime of payment
+ account INT NOT NULL, -- ref to account table
+ amount DECIMAL(8, 2) NOT NULL, -- payment amount
+ payment_method TINYTEXT NOT NULL, -- payment method
+ payment_data TINYTEXT NULL, -- additional payment info
+ PRIMARY KEY (id)
+);
+
+----
+
+-- pdfs
+CREATE TABLE {prefix}pdfs (
+ id INT NOT NULL AUTO_INCREMENT,
+ ref_type INT NOT NULL, -- reference type
+ ref_dest INT NOT NULL, -- reference types id
+ pdf MEDIUMTEXT NOT NULL, -- saved pdf
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Notification Types
+CREATE TABLE {prefix}notification_types (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TINYTEXT NOT NULL, -- name
+ from_header TINYTEXT NOT NULL, -- from headers
+ replyto TINYTEXT NULL, -- reply-to headers
+ subject TINYTEXT NOT NULL, -- Subject
+ message TEXT NOT NULL, -- Message
+ send_by_date BOOLEAN NULL DEFAULT '0', -- true/false send by date based on due date
+ send_by_action BOOLEAN NULL DEFAULT '0', -- send notice based on an action
+ send_action INT NULL DEFAULT 0, -- (create invoice or receive payment)
+ send_date_number INT NULL DEFAULT 0, -- number to apply to send by date
+ send_date_period INT NULL DEFAULT 0, -- (days,weeks,months,years)
+ send_date_when INT NULL DEFAULT 0, -- (before or after)
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Notifications
+CREATE TABLE {prefix}notifications (
+ id INT NOT NULL AUTO_INCREMENT,
+ notification_type INT NOT NULL, -- ref to notification type
+ account INT NOT NULL, -- ref to account
+ from_replyto TINYTEXT NOT NULL, -- from reply-to header
+ subject TEXT NOT NULL, -- subject
+ message TEXT NOT NULL, -- message
+ date_sent DATETIME NOT NULL, -- Date the notice was sent
+ email_sent TINYTEXT NOT NULL, -- email used
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Notification Queue
+CREATE TABLE {prefix}notification_queue (
+ id INT NOT NULL AUTO_INCREMENT,
+ notification_type INT NOT NULL, -- ref to notification type
+ account INT NOT NULL, -- ref to account
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Gateway Settings
+CREATE TABLE {prefix}gateway_settings (
+ id INT NOT NULL AUTO_INCREMENT,
+ name TEXT NOT NULL,
+ login_id TINYTEXT NOT NULL,
+ transaction_key TINYTEXT NOT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Invoice Payments
+CREATE TABLE {prefix}invoice_payments (
+ id INT NOT NULL AUTO_INCREMENT,
+ invoice INT NOT NULL, -- reference to invoice id
+ payment INT NOT NULL, -- reference to payment id
+ amount DECIMAL(8, 2) NOT NULL, -- payment amount
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Settings
+CREATE TABLE {prefix}settings (
+ id INT NOT NULL AUTO_INCREMENT,
+ company_logo TINYTEXT NULL,
+ company_logo_height INT NULL,
+ company_name TINYTEXT NULL,
+ company_name2 TINYTEXT NULL,
+ company_addr1 TINYTEXT NULL,
+ company_addr2 TINYTEXT NULL,
+ company_city TINYTEXT NULL,
+ company_state TINYTEXT NULL,
+ company_zip TINYTEXT NULL,
+ company_phone TINYTEXT NULL,
+ company_email TINYTEXT NULL,
+ company_url TINYTEXT NULL,
+ payment_terms TEXT NULL,
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Set default billing Settings entry
+INSERT INTO {prefix}settings
+ ( id )
+ VALUES
+ ( 1 );
+
+----
+
+-- Management
+CREATE TABLE {prefix}management (
+ id INT NOT NULL AUTO_INCREMENT,
+ payment_methods SMALLINT NULL, -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
+ proc_methods SMALLINT NULL, -- Credit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
+ cc_accepts SMALLINT NULL, -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
+ -- Authorize.net Credentials
+ authorize_net_login TINYTEXT NULL,
+ authorize_net_key TINYTEXT NULL,
+ authorize_net_test TINYINT NULL, -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
+ authorize_net_conf BOOLEAN NULL, -- Flag to send payment confirmation Email from Authorize.net
+ authorize_net_merchant_email TINYTEXT NULL, -- E-Mail Authorize.net will send copy of confirmation E-Mail
+ -- Merchant Solutions Credentials
+ merchant_solutions_acctid TINYTEXT NULL, -- Merchant Solutions credentials
+ merchant_solutions_merchantpin TINYTEXT NULL,
+ merchant_solutions_test TINYINT NULL, -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
+ merchant_solutions_conf BOOLEAN NULL, -- Flag to send payment confirmation Email
+ merchant_solutions_merchant_email TINYTEXT NULL, -- Merchant Solutions will send copy of confirmation E-Mail
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Set default billing Management entry
+INSERT INTO {prefix}management
+ ( id )
+ VALUES
+ ( 1 );
+++ /dev/null
--- Gaslight Media Billing Module
--- File Created: 11/08/2017
--- Database Version: 0.0.3
--- Database Creation Script
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
---
--- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
---
-
--- Billing Accounts
-CREATE TABLE {prefix}accounts (
- id INT NOT NULL AUTO_INCREMENT,
- ref_dest INT NOT NULL, -- reference to member id
- ref_name TINYTEXT NOT NULL, -- Name of reference member
- billing_addr1 TINYTEXT NULL, -- Billing Address 1
- billing_addr2 TINYTEXT NULL, -- Billing Address 2
- billing_city TINYTEXT NULL, -- Billing City
- billing_state TINYTEXT NULL, -- Billing State
- billing_zip TINYTEXT NULL, -- Billing Zip
- billing_phone TINYTEXT NULL, -- Billing Phone
- anniversary_date DATE NOT NULL, -- anniversary date - used for main invoice generation
- renewal_date DATE NULL, -- renewal date of account
- payment_data TEXT NULL, -- stored payment data
- email TINYTEXT NULL, -- billing email
- PRIMARY KEY (id)
-);
-
-----
-
--- transactions
-CREATE TABLE {prefix}transactions (
- id INT NOT NULL AUTO_INCREMENT,
- type INT NOT NULL, -- type of transaction (payment,invoice,etc)
- type_id INT NOT NULL, -- reference to type id
- account INT NOT NULL, -- reference to account id
- transaction_time DATETIME NOT NULL, -- datetime for the transaction
- current_invoice_total DECIMAL(8, 2) NOT NULL, -- invoice total
- current_payment_total DECIMAL(8, 2) NOT NULL, -- payment total
- PRIMARY KEY (id)
-);
-
-----
-
--- Invoices
-CREATE TABLE {prefix}invoices (
- id INT NOT NULL AUTO_INCREMENT,
- transaction_time DATETIME NOT NULL, -- datetime for the invoice
- account INT NOT NULL, -- ref to account id
- amount_total DECIMAL(8, 2) NOT NULL, -- total amount for invoice
- balance DECIMAL(8, 2) NOT NULL, -- balance for this invoice
- due_date DATE NOT NULL, -- Due date for this invoice
- paid BOOLEAN DEFAULT '0', -- true/false if invoice is paid
- notes TINYTEXT, -- notes for this invoice
- recurring BOOLEAN DEFAULT '0', -- true/false if recurring
- recurrence INT NULL DEFAULT 0, -- recurrence type
- PRIMARY KEY (id)
-);
-
-----
-
--- Line Item Types
-CREATE TABLE {prefix}invoice_types (
- id INT NOT NULL AUTO_INCREMENT,
- name TINYTEXT NOT NULL, -- name
- parent INT NOT NULL DEFAULT 0, -- 0 if top level otherwise ref to another line_item_type as it's parent
- amount DECIMAL(8,2) NOT NULL DEFAULT '0.00', -- amount
- recurring BOOLEAN DEFAULT '0', -- true/false if recurring
- recurrence INT NULL DEFAULT 0, -- recurrence type
- PRIMARY KEY (id)
-);
-
-----
-
--- Line Items
-CREATE TABLE {prefix}line_items (
- id INT NOT NULL AUTO_INCREMENT,
- invoice INT NOT NULL, -- reference to invoice
- line_item_type INT NOT NULL, -- reference to line item type
- name TEXT NOT NULL, -- line item name
- amount DECIMAL(8,2) DEFAULT '0.00', -- line item amount per item
- quantity INT DEFAULT 1, -- quantity
- total DECIMAL(8,2) DEFAULT '0.00', -- line item total
- recurring BOOLEAN DEFAULT '0', -- true/false if recurring
- recurrence INT NULL DEFAULT 0, -- recurrence type
- PRIMARY KEY (id)
-);
-
-----
-
--- payments
-CREATE TABLE {prefix}payments (
- id INT NOT NULL AUTO_INCREMENT,
- transaction_time DATETIME NOT NULL, -- datetime of payment
- account INT NOT NULL, -- ref to account table
- amount DECIMAL(8, 2) NOT NULL, -- payment amount
- payment_method TINYTEXT NOT NULL, -- payment method
- payment_data TINYTEXT NULL, -- additional payment info
- PRIMARY KEY (id)
-);
-
-----
-
--- pdfs
-CREATE TABLE {prefix}pdfs (
- id INT NOT NULL AUTO_INCREMENT,
- ref_type INT NOT NULL, -- reference type
- ref_dest INT NOT NULL, -- reference types id
- pdf MEDIUMTEXT NOT NULL, -- saved pdf
- PRIMARY KEY (id)
-);
-
-----
-
--- Notification Types
-CREATE TABLE {prefix}notification_types (
- id INT NOT NULL AUTO_INCREMENT,
- name TINYTEXT NOT NULL, -- name
- from_header TINYTEXT NOT NULL, -- from headers
- replyto TINYTEXT NULL, -- reply-to headers
- subject TINYTEXT NOT NULL, -- Subject
- message TEXT NOT NULL, -- Message
- send_by_date BOOLEAN NULL DEFAULT '0', -- true/false send by date based on due date
- send_by_action BOOLEAN NULL DEFAULT '0', -- send notice based on an action
- send_action INT NULL DEFAULT 0, -- (create invoice or receive payment)
- send_date_number INT NULL DEFAULT 0, -- number to apply to send by date
- send_date_period INT NULL DEFAULT 0, -- (days,weeks,months,years)
- send_date_when INT NULL DEFAULT 0, -- (before or after)
- PRIMARY KEY (id)
-);
-
-----
-
--- Notifications
-CREATE TABLE {prefix}notifications (
- id INT NOT NULL AUTO_INCREMENT,
- notification_type INT NOT NULL, -- ref to notification type
- account INT NOT NULL, -- ref to account
- from_replyto TINYTEXT NOT NULL, -- from reply-to header
- subject TEXT NOT NULL, -- subject
- message TEXT NOT NULL, -- message
- date_sent DATETIME NOT NULL, -- Date the notice was sent
- email_sent TINYTEXT NOT NULL, -- email used
- PRIMARY KEY (id)
-);
-
-----
-
--- Notification Queue
-CREATE TABLE {prefix}notification_queue (
- id INT NOT NULL AUTO_INCREMENT,
- notification_type INT NOT NULL, -- ref to notification type
- account INT NOT NULL, -- ref to account
- PRIMARY KEY (id)
-);
-
-----
-
--- Gateway Settings
-CREATE TABLE {prefix}gateway_settings (
- id INT NOT NULL AUTO_INCREMENT,
- name TEXT NOT NULL,
- login_id TINYTEXT NOT NULL,
- transaction_key TINYTEXT NOT NULL,
- PRIMARY KEY (id)
-);
-
-----
-
--- Invoice Payments
-CREATE TABLE {prefix}invoice_payments (
- id INT NOT NULL AUTO_INCREMENT,
- invoice INT NOT NULL, -- reference to invoice id
- payment INT NOT NULL, -- reference to payment id
- amount DECIMAL(8, 2) NOT NULL, -- payment amount
- PRIMARY KEY (id)
-);
-
-----
-
--- Settings
-CREATE TABLE {prefix}settings (
- id INT NOT NULL AUTO_INCREMENT,
- company_logo TINYTEXT NULL,
- company_logo_height INT NULL,
- company_name TINYTEXT NULL,
- company_name2 TINYTEXT NULL,
- company_addr1 TINYTEXT NULL,
- company_addr2 TINYTEXT NULL,
- company_city TINYTEXT NULL,
- company_state TINYTEXT NULL,
- company_zip TINYTEXT NULL,
- company_phone TINYTEXT NULL,
- company_email TINYTEXT NULL,
- company_url TINYTEXT NULL,
- payment_terms TEXT NULL,
- PRIMARY KEY (id)
-);
-
-----
-
--- Set default billing Settings entry
-INSERT INTO {prefix}settings
- ( id )
- VALUES
- ( 1 );
-
-----
-
--- Management
-CREATE TABLE {prefix}management (
- id INT NOT NULL AUTO_INCREMENT,
- payment_methods SMALLINT NULL, -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
- proc_methods SMALLINT NULL, -- Credit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
- cc_accepts SMALLINT NULL, -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
- -- Authorize.net Credentials
- authorize_net_login TINYTEXT NULL,
- authorize_net_key TINYTEXT NULL,
- authorize_net_test TINYINT NULL, -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
- authorize_net_conf BOOLEAN NULL, -- Flag to send payment confirmation Email from Authorize.net
- authorize_net_merchant_email TINYTEXT NULL, -- E-Mail Authorize.net will send copy of confirmation E-Mail
- -- Merchant Solutions Credentials
- merchant_solutions_acctid TINYTEXT NULL, -- Merchant Solutions credentials
- merchant_solutions_merchantpin TINYTEXT NULL,
- merchant_solutions_test TINYINT NULL, -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
- merchant_solutions_conf BOOLEAN NULL, -- Flag to send payment confirmation Email
- merchant_solutions_merchant_email TINYTEXT NULL, -- Merchant Solutions will send copy of confirmation E-Mail
- PRIMARY KEY (id)
-);
-
-----
-
--- Set default billing Management entry
-INSERT INTO {prefix}management
- ( id )
- VALUES
- ( 1 );
'0.0.7' => array('version' => '0.0.7', 'tables' => 13),
'0.0.8' => array('version' => '0.0.8', 'tables' => 14),
'0.0.9' => array('version' => '0.0.9', 'tables' => 14),
+ '0.0.10' => array('version' => '0.0.10', 'tables' => 14),
);
--- /dev/null
+-- Gaslight Media Billing Database
+-- File Created: 03/06/2018
+-- Database Version: 0.0.10
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- Add billing_fname field to the accounts table
+ALTER TABLE {prefix}accounts ADD billing_fname TINYTEXT NULL;
+
+----
+
+-- Add billing_lname field to the accounts table
+ALTER TABLE {prefix}accounts ADD billing_lname TINYTEXT NULL;
</td>
</tr>
+ <tr>
+ <th {if $account.fieldRequired.billing_fname} class="glm-required"}{/if}>Billing First Name</th>
+ <td {if $account.fieldFail.billing_fname}class="glm-form-bad-input" data-tabid="glm-billing-fname"{/if}>
+ <input type="text" name="billing_fname" value="{$account.fieldData.billing_fname}" class="glm-form-text-input-medium">
+ {if $account.fieldFail.billing_fname}<p>{$account.fieldFail.billing_fname}</p>{/if}<br>
+ </td>
+ </tr>
+
+ <tr>
+ <th {if $account.fieldRequired.billing_lname} class="glm-required"}{/if}>Billing Last Name</th>
+ <td {if $account.fieldFail.billing_lname}class="glm-form-bad-input" data-tabid="glm-billing-lname"{/if}>
+ <input type="text" name="billing_lname" value="{$account.fieldData.billing_lname}" class="glm-form-text-input-medium">
+ {if $account.fieldFail.billing_lname}<p>{$account.fieldFail.billing_lname}</p>{/if}<br>
+ </td>
+ </tr>
+
<tr>
<th {if $account.fieldRequired.billing_addr1} class="glm-required"}{/if}>Billing Address 1</th>
<td {if $account.fieldFail.billing_addr1}class="glm-form-bad-input" data-tabid="glm-billing-addr1"{/if}>
<tr>
<th {if $account.fieldRequired.billing_state} class="glm-required"}{/if}>Billing State</th>
<td {if $account.fieldFail.billing_state}class="glm-form-bad-input" data-tabid="glm-billing-state"{/if}>
- <input type="text" name="billing_state" value="{$account.fieldData.billing_state}" class="glm-form-text-input-medium">
+ <select name="billing_state">
+ <option value=""></option>
+ {foreach $account.fieldData.billing_state.list as $s}
+ <option value="{$s.value}"{if $account.fieldData.billing_state.value == $s.value} selected="selected"{/if}>
+ {$s.name}
+ </option>
+ {/foreach}
+ </select>
{if $account.fieldFail.billing_state}<p>{$account.fieldFail.billing_state}</p>{/if}<br>
</td>
</tr>
Billing Account
</div>
<div class="glm-columns glm-small-12 glm-large-9">
+ <input type="hidden" name="account" />
<select id="member-account" name="account" required>
<option value="">Select an Account</option>
{foreach $accounts as $account}
<script>
jQuery(document).ready(function($){
+ // List of Billing Accounts.
var availableAccounts = [
{foreach $accounts as $m}
{ label: "{$m.ref_name|unescape:'html'|replace:'"':''}", value: "{$m.ref_name|unescape:'html'|replace:'"':''}", id: '{$m.id}' },
{/foreach}
];
+
+ // List of Members with no Accounts.
var availableNonAccountMembers = [
{foreach $nonAccountMembers as $m}
{ label: "{$m.name|unescape:'html'|replace:'"':''}", value: "{$m.name|unescape:'html'|replace:'"':''}", id: '{$m.id}' },
</span>
<span class="glm-nowrap">
<b>Member Account: </b>
- <select id="filterAccounts" name="filterAccounts">
- <option value="">Select Account</option>
- {foreach from=$accounts item=account}
- <option value="{$account.id}"{if $account.selected} selected{/if}>
- {$account.ref_dest.name}
- </option>
- {/foreach}
- </select>
+ <input id="member-account" type="hidden" name="filterAccounts" value="{$filterAccounts}">
+ <input id="account_name" name="searchName" value="" />
+ </span>
+ <span class="glm-nowrap">
+ <input type="submit" value="Submit">
</span>
<p>
</div>
<script type="text/javascript">
jQuery(document).ready(function($) {
- // Date Input
- $('.glm-date-input').datepicker();
+ // Date Input
+ $('.glm-date-input').datepicker();
+
+ var availableAccounts = [
+ {foreach $accounts as $m}
+ { label: "{$m.ref_name|unescape:'html'|replace:'"':''}", value: "{$m.ref_name|unescape:'html'|replace:'"':''}", id: '{$m.id}' },
+ {/foreach}
+ ]
+
+ $('#account_name').autocomplete({
+ source: availableAccounts,
+ select: function( event, ui ){
+ $('#member-account').val( ui.item.id );
+ },
+ });
+
+ {if $filterAccounts}
+ {$selected = 0}
+ {foreach $accounts as $m}
+ {if $m.id == $filterAccounts}
+ {$selected = $m.ref_name|unescape:'html'|replace:'"':''}
+ {/if}
+ {/foreach}
+ $('#account_name').autocomplete().val('{$selected}');
+ {/if}
});
</script>
{include file='admin/member/header.html'}
{include file='admin/billing/memberBillingSubHeader.html'}
-<div id="billing-payment-form">
+<div id="billing-payment-form" style="max-width:750px;">
<form action="{$thisUrl}?page={$thisPage}&glm_action=billing&option=makePayment" method="post">
<input type="hidden" name="page" value="{$thisPage}">
<input type="hidden" name="glm_action" value="billing">
<input type="hidden" name="option" value="createPayment">
<input type="hidden" name="member" value="{$memberID}">
+ <input type="hidden" name="account_id" value="{$account.fieldData.id}">
<div class="glm-row">
- <div class="glm-columns glm-small-12 glm-large-8">
+ <div class="glm-columns glm-small-12 glm-large-12 glm-hidden">
<div class="glm-row">
- <div class="glm-columns glm-small-12 glm-required"> Select Invoice </div>
<div class="glm-columns glm-small-12">
- Need to list unpaid invoices here...
+ <h2>Billing Information</h2>
</div>
</div>
<div class="glm-row">
- <div class="glm-columns glm-small-12 glm-required"> Amount </div>
- <div class="glm-columns glm-small-12">
- <input type="number" name="amount" step="0.01" min="0.01" required />
+ <div class="glm-columns glm-small-12 glm-medium-3{if $account.fieldRequired.billing_fname} glm-required{/if}"> Billing First Name </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-small" type="text" name="billing_fname" value="{$account.fieldData.billing_fname}" required />
</div>
</div>
<div class="glm-row">
- <div class="glm-columns glm-small-12 glm-required"> Billing Address 1 </div>
- <div class="glm-columns glm-small-12">
- <input type="text" name="billing_addr1" value="{$account.billing_addr1}" required />
+ <div class="glm-columns glm-small-12 glm-medium-3{if $account.fieldRequired.billing_lname} glm-required{/if}"> Billing Last Name </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-small" type="text" name="billing_lname" value="{$account.fieldData.billing_lname}" required />
</div>
</div>
+
<div class="glm-row">
- <div class="glm-columns glm-small-12"> Billing Address 2 </div>
- <div class="glm-columns glm-small-12">
- <input type="text" name="billing_addr2" value="{$account.billing_addr2}" />
+ <div class="glm-columns glm-small-12 glm-medium-3{if $account.fieldRequired.billing_addr1} glm-required{/if}"> Billing Address 1 </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-medium" type="text" name="billing_addr1" value="{$account.fieldData.billing_addr1}" required />
</div>
</div>
<div class="glm-row">
- <div class="glm-columns glm-small-12 glm-required"> Billing City </div>
- <div class="glm-columns glm-small-12">
- <input type="text" name="billing_city" value="{$account.billing_city}" required />
+ <div class="glm-columns glm-small-12 glm-medium-3{if $account.fieldRequired.billing_addr2} glm-required{/if}"> Billing Address 2 </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-medium" type="text" name="billing_addr2" value="{$account.fieldData.billing_addr2}" />
</div>
</div>
<div class="glm-row">
- <div class="glm-columns glm-small-12 glm-required"> Billing State </div>
- <div class="glm-columns glm-small-12">
- <input type="text" name="billing_address" value="{$account.billing_state}" required />
+ <div class="glm-columns glm-small-12 glm-medium-3{if $account.fieldRequired.billing_city} glm-required{/if}"> Billing City </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-medium" type="text" name="billing_city" value="{$account.fieldData.billing_city}" required />
+ </div>
+ </div>
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-medium-3{if $account.fieldRequired.billing_state} glm-required{/if}"> Billing State </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <select name="billing_state">
+ <option value=""></option>
+ {foreach $account.fieldData.billing_state.list as $s}
+ <option value="{$s.value}"{if $account.fieldData.billing_state.value == $s.value} selected="selected"{/if}>
+ {$s.name}
+ </option>
+ {/foreach}
+ </select>
+ </div>
+ </div>
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-medium-3{if $account.fieldRequired.billing_zip} glm-required{/if}"> Billing Zip </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-small" type="text" name="billing_zip" value="{$account.fieldData.billing_zip}" required />
</div>
</div>
<div class="glm-row">
- <div class="glm-columns glm-small-12 glm-required"> Billing Zip </div>
+ <div class="glm-columns glm-small-12 glm-medium-3{if $account.fieldRequired.email} glm-required{/if}"> Billing Email </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-small" type="text" name="email" value="{$account.fieldData.email}" required />
+ </div>
+ </div>
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-medium-3{if $account.fieldRequired.billing_phone} glm-required{/if}"> Billing Phone </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-small" type="text" name="billing_phone" value="{$account.fieldData.billing_phone}" required />
+ </div>
+ </div>
+
+ </div>
+ {if $invoices}
+ <div class="glm-columns glm-small-12 glm-large-12">
+ <div class="glm-row">
<div class="glm-columns glm-small-12">
- <input type="text" name="billing_zip" value="{$account.billing_zip}" required />
+ <h2>Payment Information</h2>
</div>
</div>
<div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-medium-3 glm-required"> Select Invoice </div>
<div class="glm-columns glm-small-12 glm-large-8">
+ <select name="invoice_id" required>
+ <option value=""></option>
+ {if $invoices}
+ {foreach $invoices as $invoice}
+ <option value="{$invoice.id}">${$invoice.amount_total} Due {$invoice.due_date}</option>
+ {/foreach}
+ {/if}
+ </select>
+ </div>
+ </div>
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-medium-3 glm-required"> Amount </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-small" type="number" name="amount" step="0.01" min="0.01" required />
+ </div>
+ </div>
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-medium-3 glm-required"> Name on Card </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-medium" type="text" name="cc_name" required>
+ </div>
+ </div>
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-medium-3 glm-required"> Card Type </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <select name="cc_type" required>
+ <option value=""></option>
+ {foreach $management.cc_accepts.names as $cardId => $cardName}
+ <option value="{$cardId}">{$cardName}</option>
+ {/foreach}
+ </select>
+ </div>
+ </div>
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-medium-3 glm-required"> Card Number </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-small" type="text" placeholder="Numbers Only" name="cc_numb" required>
+ </div>
+ </div>
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-medium-3 glm-required"> Card Expiration </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-small" type="text" placeholder="MM/YY" name="cc_exp" required>
+ </div>
+ </div>
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-medium-3 glm-required"> C V V </div>
+ <div class="glm-columns glm-small-12 glm-medium-8">
+ <input class="glm-form-text-input-small" type="text" placeholder="3 or 4 digit security code on back of card" name="cc_cvv" required>
+ </div>
+ </div>
+
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-medium-8">
<input class="button button-primary" type="submit" value="Make Payment">
</div>
</div>
</div>
+ {else}
+ You don't have any unpaid invoices!
+ {/if}
</div>
</form>
{include file='admin/member/header.html'}
{include file='admin/billing/memberBillingSubHeader.html'}
-Payment process here !!
+{if $messages}
+ {foreach $messages as $message}
+ {$message} <br>
+ {/foreach}
+{/if}
+
{include file='admin/footer.html'}