// Set the file name for the view file.
$view = 'viewInvoice';
+ break;
+ case 'createPayment':
+
+ echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
+
+ $view = 'paymentProcess';
+
+ 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['settings']['reg_proc_methods'];
+
+ // Setup the required account information for the selected payment processor
+ switch ($ccProcessor) {
+
+ 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;
+
+ case $this->config['proc_method_numb']['MerchantSolutions']:
+
+ // 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']
+ );
+
+ 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
+ ) {
+
+
+ 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.';
+ }
+
+ } else {
+ $messages[] = 'You did not supply all required credit card information.';
+ }
+
+ 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',
+ )
+ );
+
+ }
+
+ }
+
+ break;
+
+ // Pay Pal
+ // case $this->config['payment_method_numb']['PayPal']:
+ // break;
+
+ // 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;
+
+ }
+ break;
+ case 'makepayment':
+
+ require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php';
+ $Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
+
+ // Need to see if there's an account for this member.
+ $accountID = $this->wpdb->get_var(
+ $this->wpdb->prepare(
+ "SELECT id
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ WHERE ref_dest = %d",
+ $this->memberID
+ )
+ );
+ $account = $Accounts->getEntry( $accountID );
+
+ // 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);
$view = 'statements';
// Get the list of invoices for this member.
- // echo '<pre>$this->memberID: ' . print_r( $this->memberID, true) . '</pre>';
- // echo '<pre>$memberData: ' . print_r( $memberData, true) . '</pre>';
$statements = $BillingSupport->getStatementsByRefDest( $this->memberID );
if ( $statements ) {
$transactions = $statements['transactions'];
$account_data = $statements['account_data'];
$balance_due = $statements['balance_due'];
}
- // echo '<pre>$statements: ' . print_r( $statements, true ) . '</pre>';
-
-
break;
}
// echo '<pre>$this->config: ' . print_r( $this->config, true ) . '</pre>';
--- /dev/null
+{include file='admin/member/header.html'}
+{include file='admin/billing/memberBillingSubHeader.html'}
+
+<div id="billing-payment-form">
+ <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}">
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-large-8">
+
+ <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...
+ </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>
+ </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>
+ </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>
+ </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>
+ </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>
+ </div>
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-required"> Billing Zip </div>
+ <div class="glm-columns glm-small-12">
+ <input type="text" name="billing_zip" value="{$account.billing_zip}" required />
+ </div>
+ </div>
+
+ <div class="glm-row">
+ <div class="glm-columns glm-small-12 glm-large-8">
+ <input class="button button-primary" type="submit" value="Make Payment">
+ </div>
+ </div>
+
+ </div>
+ </div>
+
+ </form>
+</div>
+
+{include file='admin/footer.html'}