示例#1
0
                $return = array();
                $return['error'] = 'This serial number has already been registered.';
            }
        }
    } else {
        $return['error'] = 'Serial number has already been added to your registry.';
    }
} else {
    if ($method === 'AMSLookup') {
        // Do not run the AMS Lookup function if "same_session" object exists and the data matches
        if (isset($_SESSION['registration']['same_session'])) {
            $r_account = sameSessionCheck($data);
        }
        // Only call the AMS Customer lookup function if R account does not already exist in the session
        if (!isset($r_account)) {
            $return = __amsCustomerLookup($data);
        } else {
            // R account already available in the session
            $return = $r_account;
        }
    } else {
        if ($method === 'Register') {
            // Pass blank R account if not available in the session
            if (empty($_SESSION['registration']['customer']['r_account'])) {
                // No R account - create the R account prior to submitting registration
                $miele_api_customer = new MieleApi($GLOBALS['miele_api_schema']['ASW']['CreateCustomer']);
                $miele_api_customer->add_qs_param('comp', getAswComp());
                $miele_api_customer->set_post_data(aswCustomer($_SESSION['registration']['customer']));
                $miele_api_customer_data = $miele_api_customer->get_data();
                if (isset($miele_api_customer_data['aswCustomerNumber'])) {
                    $_SESSION['registration']['customer']['r_account'] = $miele_api_customer_data['aswCustomerNumber'];
示例#2
0
 // Establish the registration variables
 $_SESSION['registration'] = array();
 $customer = array();
 $products = array();
 $today = date_create();
 // POSTed data
 $data = $_POST;
 // Customer properties - key matching from center sale application
 $customer_properties = array('customer_account' => 'r_account', 'first_name' => 'firstname', 'last_name' => 'lastname', 'address_1' => 'street_address', 'address_2' => 'street_address_2', 'address_3' => 'address_3', 'city' => 'city', 'state' => 'state', 'zip' => 'zip', 'zip4' => 'zip4', 'email' => 'email', 'phone_1' => 'phone');
 // Store customer data
 foreach ($customer_properties as $key => $value) {
     $customer[$value] = isset($data[$key]) ? $data[$key] : '';
 }
 // Unset customer account (sundry account passed from Center Sales Application)
 // Perform AMS lookup
 $ams_lookup = __amsCustomerLookup($customer);
 $customer['r_account'] = isset($ams_lookup['r_account']) ? $ams_lookup['r_account'] : '';
 // Validate Serial Number
 $product = validateSn($data['scan_serial_number']);
 if (isset($product['serial_number'])) {
     $product['date_of_purchase'] = date_format($today, 'm/d/Y');
     $product['uploaded_file'] = '';
     $product['order_number'] = $data['order_number'];
     array_push($products, $product);
 } else {
     $error = 'Invalid serial number ' . $data['scan_serial_number'] . '. Please contact Miele IT.';
 }
 if (!isset($error)) {
     // Set registration data
     $registration = array('customer' => $customer, 'products' => $products);
     $_SESSION['registration'] = $registration;