Subversion Repositories SmartDukaan

Rev

Rev 1905 | Rev 2163 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<HTML>
<HEAD>
<TITLE>Saholic.com: Redirecting to EBS Payment Page</TITLE>
</HEAD>
<script language="JavaScript">
function validate(){
        
        var frm = document.frmTransaction;
        var optFields = Array('description[delivery_address_2]','description[delivery_state]','description[delivery_telephone]','description[delivery_fax]', 'description[billing_address_2]','description[billing_state]', 'description[billing_telephone]','description[billing_fax]');
        var aName = Array();
        aName['account_id'] = 'Account ID';
        aName['reference_no'] = 'Reference No';
        aName['description'] = 'Description';
        aName['name'] = 'First Name';
        aName['name_2'] = 'Last Name';
        aName['address'] = 'Address 1';
        aName['city'] = 'City';
        aName['state'] = 'State';
        aName['postal_code'] = 'Post Code';
        aName['country'] = 'Country';
        aName['email'] = 'Email';

        for(var i = 0; i < frm.elements.length ; i++){
                
                if(!optFields.inArray(frm.elements[i].name)){
                        if(frm.elements[i].value.length == 0){
                                alert("Invalid input for " + aName[frm.elements[i].name]);
                                frm.elements[i].focus();
                                return false;
                        }
                        
                        if(frm.elements[i].name == 'email]'){
                                if(!validateEmail(frm.elements[i].value)){
                                        alert("Invalid input for " + aName[frm.elements[i].name]);
                                        frm.elements[i].focus();
                                        return false;
                                }               
                        }
                        if(frm.elements[i].name == 'reference_no]'){
                                var d = new Date();
                                frm.elements[i].value = d.getTime();
                        }
                }
        }  
        return true;
}
function validateEmail(email) {
    //Validating the email field
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
        //"
    if (! email.match(re)) {
        return (false);
    }
    return(true);
}


Array.prototype.inArray = function (value)
// Returns true if the passed value is found in the
// array.  Returns false if it is not.
{
    var i;
    for (i=0; i < this.length; i++) {
        // Matches identical (===), not just similar (==).
        if (this[i] === value) {
            return true;
        }
    }
    return false;
};

</script>
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 >
        <div style="display:none">
         <form  method="post" action="https://secure.ebs.in/pg/ma/sale/pay/" name="frmTransaction" id="frmTransaction" onSubmit="return validate()">     
           <!-- Account Id -->
           <input name="account_id" type="text" value="$action.getAccountId()" />

           <!-- Transaction Details -->
           <input name="reference_no" type="text" value="$action.getId()" />
           <input name="amount" type="text" value="$action.getAmount()" />

           <input name="description" type="text" value="$action.getDescription()" />
                   #set($billingAddress=$action.getBillingDetails())
           <!-- Billing Address -->

           <input name="name" type="text" value="$billingAddress.getName()" /></td>
       
           <input name="address" type="text" value="$billingAddress.getAddress()" />

           <input name="city" type="text" value="$billingAddress.getCity()" />
 
           <input name="state" type="text" value="$billingAddress.getState()" />

           <input name="postal_code" type="text" value="$billingAddress.getPostalCode()" />

           <select name="country">
                         <option value="IND" selected="selected">India</option>
                   </select>

           <input name="email" type="text" value="$billingAddress.getEmail()" />

                   <input name="phone" type="text" value="$billingAddress.getPhone()" />
                
           <!-- Delivery Address -->

           <input name="ship_name" type="text" value="$billingAddress.getName()" /></td>
       
           <input name="ship_address" type="text" value="$billingAddress.getAddress()" />

           <input name="ship_city" type="text" value="$billingAddress.getCity()" />

           <input name="ship_state" type="text" value="$billingAddress.getState()" />

           <input name="ship_postal_code" type="text" value="$billingAddress.getPostalCode()" />

            <select name="ship_country">
                                <option value="IND" selected="selected">India</option>
                        </select>
            
            <input name="ship_phone" type="text" value="$billingAddress.getPhone()" />

            <input name="return_url" type="text" size="60" value="$action.getReturnUrl()" />
                        <select name="mode" >
                                <option value="$action.getMode()">$action.getMode()</option>
                        </select>
            <input name="submitted" value="Submit" type="submit" />&nbsp; 
            <input value="Reset" type="reset" />
      </form>
    </div>

    #include ( "templates/commonjsfiles.vm" )
    <script type="text/javascript">
      $(function() {
              $('form[name="frmTransaction"]').submit();
      });
    </script>
  </body>
</html>