| 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 -->
|
|
|
77 |
<input name="account_id" type="text" value="$action.getAccountId()" />
|
|
|
78 |
|
|
|
79 |
<!-- Transaction Details -->
|
|
|
80 |
<input name="reference_no" type="text" value="$action.getId()" />
|
|
|
81 |
<input name="amount" type="text" value="$action.getAmount()" />
|
|
|
82 |
|
|
|
83 |
<input name="description" type="text" value="Test Order Description" />
|
|
|
84 |
#set($billingAddress=$action.getBillingDetails())
|
|
|
85 |
<!-- Billing Address -->
|
|
|
86 |
|
|
|
87 |
<input name="name" type="text" value="$billingAddress.getName()" /></td>
|
|
|
88 |
|
|
|
89 |
<input name="address" type="text" value="$billingAddress.getAddress()" />
|
|
|
90 |
|
|
|
91 |
<input name="city" type="text" value="$billingAddress.getCity()" />
|
|
|
92 |
|
|
|
93 |
<input name="state" type="text" value="$billingAddress.getState()" />
|
|
|
94 |
|
|
|
95 |
<input name="postal_code" type="text" value="$billingAddress.getPostalCode()" />
|
|
|
96 |
|
|
|
97 |
<select name="country">
|
|
|
98 |
<option value="IND" selected="selected">India</option>
|
|
|
99 |
</select>
|
|
|
100 |
|
|
|
101 |
<input name="email" type="text" value="$billingAddress.getEmail()" />
|
|
|
102 |
|
|
|
103 |
<input name="phone" type="text" value="$billingAddress.getPhone()" />
|
|
|
104 |
|
|
|
105 |
<!-- Delivery Address -->
|
|
|
106 |
|
|
|
107 |
<input name="ship_name" type="text" value="$billingAddress.getName()" /></td>
|
|
|
108 |
|
|
|
109 |
<input name="ship_address" type="text" value="$billingAddress.getAddress()" />
|
|
|
110 |
|
|
|
111 |
<input name="ship_city" type="text" value="$billingAddress.getCity()" />
|
|
|
112 |
|
|
|
113 |
<input name="ship_state" type="text" value="$billingAddress.getState()" />
|
|
|
114 |
|
|
|
115 |
<input name="ship_postal_code" type="text" value="$billingAddress.getPostalCode()" />
|
|
|
116 |
|
|
|
117 |
<select name="ship_country">
|
|
|
118 |
<option value="IND" selected="selected">India</option>
|
|
|
119 |
</select>
|
|
|
120 |
|
|
|
121 |
<input name="ship_phone" type="text" value="$billingAddress.getPhone()" />
|
|
|
122 |
|
|
|
123 |
<input name="return_url" type="text" size="60" value="$action.getReturnUrl()" />
|
|
|
124 |
<select name="mode" >
|
|
|
125 |
<option value="$action.getMode()">$action.getMode()</option>
|
|
|
126 |
</select>
|
|
|
127 |
<input name="submitted" value="Submit" type="submit" />
|
|
|
128 |
<input value="Reset" type="reset" />
|
|
|
129 |
</table>
|
|
|
130 |
</form>
|
|
|
131 |
</div>
|
|
|
132 |
|
|
|
133 |
#include ( "templates/commonjsfiles.vm" )
|
|
|
134 |
<script type="text/javascript">
|
|
|
135 |
$(function() {
|
|
|
136 |
$('form[name="frmTransaction"]').submit();
|
|
|
137 |
});
|
|
|
138 |
</script>
|
|
|
139 |
</body>
|
|
|
140 |
</html>
|