Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
1905 chandransh 1
<HTML>
2
<HEAD>
3
<TITLE>Saholic.com: Redirecting to EBS Payment Page</TITLE>
4
</HEAD>
5
<script language="JavaScript">
6
function validate(){
7
 
8
	var frm = document.frmTransaction;
9
	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]');
10
	var aName = Array();
11
	aName['account_id'] = 'Account ID';
12
	aName['reference_no'] = 'Reference No';
13
	aName['description'] = 'Description';
14
	aName['name'] = 'First Name';
15
	aName['name_2'] = 'Last Name';
16
	aName['address'] = 'Address 1';
17
	aName['city'] = 'City';
18
	aName['state'] = 'State';
19
	aName['postal_code'] = 'Post Code';
20
	aName['country'] = 'Country';
21
	aName['email'] = 'Email';
22
 
23
	for(var i = 0; i < frm.elements.length ; i++){
24
 
25
		if(!optFields.inArray(frm.elements[i].name)){
26
			if(frm.elements[i].value.length == 0){
27
				alert("Invalid input for " + aName[frm.elements[i].name]);
28
				frm.elements[i].focus();
29
				return false;
30
			}
31
 
32
			if(frm.elements[i].name == 'email]'){
33
				if(!validateEmail(frm.elements[i].value)){
34
					alert("Invalid input for " + aName[frm.elements[i].name]);
35
					frm.elements[i].focus();
36
					return false;
37
				}		
38
			}
39
			if(frm.elements[i].name == 'reference_no]'){
40
				var d = new Date();
41
				frm.elements[i].value = d.getTime();
42
			}
43
		}
44
	}  
45
	return true;
46
}
47
function validateEmail(email) {
48
    //Validating the email field
49
    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,}))$/;
50
	//"
51
    if (! email.match(re)) {
52
        return (false);
53
    }
54
    return(true);
55
}
56
 
57
 
58
Array.prototype.inArray = function (value)
59
// Returns true if the passed value is found in the
60
// array.  Returns false if it is not.
61
{
62
    var i;
63
    for (i=0; i < this.length; i++) {
64
        // Matches identical (===), not just similar (==).
65
        if (this[i] === value) {
66
            return true;
67
        }
68
    }
69
    return false;
70
};
71
 
72
</script>
73
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 >
74
	<div style="display:none">
75
	 <form  method="post" action="https://secure.ebs.in/pg/ma/sale/pay/" name="frmTransaction" id="frmTransaction" onSubmit="return validate()">	 
76
           <!-- Account Id -->
2159 chandransh 77
           <input name="account_id" type="hidden" value="$action.getAccountId()" />
1905 chandransh 78
 
79
           <!-- Transaction Details -->
2159 chandransh 80
           <input name="reference_no" type="hidden" value="$action.getId()" />
81
 
82
		   <input name="amount" type="hidden" value="$action.getAmount()" />
1905 chandransh 83
 
2159 chandransh 84
           <input name="description" type="hidden" value="$action.getDescription()" />
85
 
86
		   <input name="payment_option" type="hidden" value="$action.getPaymentOption()"/>
87
 
1905 chandransh 88
		   #set($billingAddress=$action.getBillingDetails())
89
           <!-- Billing Address -->
90
 
2159 chandransh 91
           <input name="name" type="hidden" value="$billingAddress.getName()" /></td>
1905 chandransh 92
 
2159 chandransh 93
           <input name="address" type="hidden" value="$billingAddress.getAddress()" />
1905 chandransh 94
 
2159 chandransh 95
           <input name="city" type="hidden" value="$billingAddress.getCity()" />
1905 chandransh 96
 
2159 chandransh 97
           <input name="state" type="hidden" value="$billingAddress.getState()" />
1905 chandransh 98
 
2159 chandransh 99
           <input name="postal_code" type="hidden" value="$billingAddress.getPostalCode()" />
1905 chandransh 100
 
2159 chandransh 101
		   <input name="country" type="hidden" value="IND"/>
1905 chandransh 102
 
2159 chandransh 103
           <input name="email" type="hidden" value="$billingAddress.getEmail()" />
1905 chandransh 104
 
2159 chandransh 105
		   <input name="phone" type="hidden" value="$billingAddress.getPhone()" />
1905 chandransh 106
 
107
           <!-- Delivery Address -->
108
 
2159 chandransh 109
           <input name="ship_name" type="hidden" value="$billingAddress.getName()" /></td>
1905 chandransh 110
 
2159 chandransh 111
           <input name="ship_address" type="hidden" value="$billingAddress.getAddress()" />
1905 chandransh 112
 
2159 chandransh 113
           <input name="ship_city" type="hidden" value="$billingAddress.getCity()" />
1905 chandransh 114
 
2159 chandransh 115
           <input name="ship_state" type="hidden" value="$billingAddress.getState()" />
1905 chandransh 116
 
2159 chandransh 117
           <input name="ship_postal_code" type="hidden" value="$billingAddress.getPostalCode()" />
1905 chandransh 118
 
2159 chandransh 119
		   <input name="ship_country" type="hidden" value="IND"/>
1905 chandransh 120
 
2159 chandransh 121
           <input name="ship_phone" type="hidden" value="$billingAddress.getPhone()" />
1905 chandransh 122
 
2159 chandransh 123
           <input name="return_url" type="hidden" value="$action.getReturnUrl()" />
124
		   <input name="mode" value="$action.getMode()"/>
125
           <input name="submitted" value="Submit" type="submit" />&nbsp; 
126
           <input value="Reset" type="reset" />
1905 chandransh 127
      </form>
128
    </div>
129
 
130
    #include ( "templates/commonjsfiles.vm" )
131
    <script type="text/javascript">
132
      $(function() {
133
	      $('form[name="frmTransaction"]').submit();
134
      });
135
    </script>
136
  </body>
137
</html>