65 |
} |
= |
65 |
} |
66 |
?> |
|
66 |
?> |
67 |
|
|
67 |
|
68 |
<form action="<?php echo $GLOBALS['rootRel'];?>admin/modules/<?php echo $_GET['module']; ?>/<?php echo $_GET['folder']; ?>/index.php?module=<?php echo $_GET['module']; ?>&folder=<?php echo $_GET['folder']; ?>" method="post" enctype="multipart/form-data"> |
|
68 |
<form action="<?php echo $GLOBALS['rootRel'];?>admin/modules/<?php echo $_GET['module']; ?>/<?php echo $_GET['folder']; ?>/index.php?module=<?php echo $_GET['module']; ?>&folder=<?php echo $_GET['folder']; ?>" method="post" enctype="multipart/form-data"> |
69 |
<table border="0" cellspacing="0" cellpadding="3" class="mainTable"> |
|
69 |
<table border="0" cellspacing="0" cellpadding="3" class="mainTable"> |
70 |
<tr> |
|
70 |
<tr> |
71 |
<td colspan="5" class="tdTitle">Configuration Settings </td> |
<> |
71 |
<td colspan="10" class="tdTitle">Configuration Settings </td> |
72 |
</tr> |
= |
72 |
</tr> |
73 |
<tr> |
|
73 |
<tr> |
74 |
<td align="left" class="tdText"><strong>Status:</strong></td> |
|
74 |
<td align="left" class="tdText"><strong>Status:</strong></td> |
75 |
<td class="tdText" colspan="4"> |
<> |
75 |
<td class="tdText" colspan="9"> |
76 |
<?php |
|
|
|
77 |
if($module['testspassed']==1) |
|
|
|
78 |
{ ?> |
|
|
|
79 |
<select name="module[status]"> |
|
76 |
<select name="module[status]"> |
80 |
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option> |
= |
77 |
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option> |
81 |
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option> |
|
78 |
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option> |
82 |
</select> |
|
79 |
</select> |
83 |
<strong><-- Do not enable until USPS has switched you to <u>Live</u>.</strong></td> <?php |
<> |
|
|
84 |
} else { ?> |
|
|
|
85 |
<strong>Disabled</strong> |
|
|
|
86 |
<-- You <strong>MUST</strong> Submit USPS Tests Below to Enable.</td> <?php |
|
|
|
87 |
} |
|
|
|
88 |
?> |
|
80 |
</td> |
89 |
</tr> |
= |
81 |
</tr> |
90 |
<!-- ### Removed by Sir William Test Mode No Longer Necessary ### |
|
82 |
<!-- ### Removed by Sir William Test Mode No Longer Necessary ### |
91 |
<tr> |
|
83 |
<tr> |
92 |
<td align="left" class="tdText"><strong>Test Mode:</strong></td> |
|
84 |
<td align="left" class="tdText"><strong>Test Mode:</strong></td> |
93 |
<td class="tdText"><select name="module[test]"> |
|
85 |
<td class="tdText"><select name="module[test]"> |
94 |
<option value="1" <!?php if($module['test']==1) echo "selected='selected'"; ?>>Enabled</option> |
|
86 |
<option value="1" <!?php if($module['test']==1) echo "selected='selected'"; ?>>Enabled</option> |
|
105 |
<option value="1" <?php if($module['debug']==1) echo "selected='selected'"; ?>>Enabled</option> |
= |
97 |
<option value="1" <?php if($module['debug']==1) echo "selected='selected'"; ?>>Enabled</option> |
106 |
<option value="0" <?php if($module['debug']==0) echo "selected='selected'"; ?>>Disabled</option> |
|
98 |
<option value="0" <?php if($module['debug']==0) echo "selected='selected'"; ?>>Disabled</option> |
107 |
</select></td> |
|
99 |
</select></td> |
108 |
<td class="tdText"> </td> |
|
100 |
<td class="tdText"> </td> |
109 |
<td class="tdText"> </td> |
|
101 |
<td class="tdText"> </td> |
110 |
<td class="tdText"> </td> |
|
102 |
<td class="tdText"> </td> |
|
|
-+ |
103 |
<td class="tdText"> </td> |
|
|
|
104 |
<td class="tdText"> </td> |
|
|
|
105 |
<td class="tdText"> </td> |
|
|
|
106 |
<td class="tdText"> </td> |
|
|
|
107 |
<td class="tdText"> </td> |
111 |
</tr> |
= |
108 |
</tr> |
112 |
<tr> |
|
109 |
<tr> |
113 |
<td class="tdText"><strong>Service Type</strong></td> |
|
110 |
<td class="tdText"><strong>Service Type</strong></td> |
114 |
<td class="tdText"><strong>Status</strong></td> |
|
111 |
<td class="tdText"><strong>Status</strong></td> |
115 |
<td class="tdText"><strong>Package Size</strong></td> |
|
112 |
<td class="tdText"><strong>Package Size</strong></td> |
116 |
<td class="tdText"><strong>Container Types</strong></td> |
<> |
113 |
<td class="tdText"><strong>Container/Mail Types</strong></td> |
117 |
<td class="tdText"><strong>Weight Limit</strong></td> |
= |
114 |
<td class="tdText"><strong>Weight Limit</strong></td> |
|
|
-+ |
115 |
<td class="tdText"><strong>Machinable</strong></td> |
|
|
|
116 |
<td class="tdText"><strong>Length<br /> |
|
|
|
117 |
</strong>(Rectangular & Non Rectangular)</td> |
|
|
|
118 |
<td class="tdText"><strong>Width<br /> |
|
|
|
119 |
</strong>(Rectangular & Non Rectangular)</td> |
|
|
|
120 |
<td class="tdText"><strong>Height<br /> |
|
|
|
121 |
</strong>(Rectangular & Non Rectangular)</td> |
|
|
|
122 |
<td class="tdText"><strong>Girth <br /> |
|
|
|
123 |
</strong>(Non Rectangular Only) </td> |
118 |
</tr> |
= |
124 |
</tr> |
119 |
<tr> |
|
125 |
<tr> |
120 |
<td class="tdText">Express Mail </td> |
|
126 |
<td class="tdText">Express Mail </td> |
121 |
<td valign="top" class="tdText"> |
|
127 |
<td valign="top" class="tdText"> |
122 |
<select name="module[serviceExpress]"> |
|
128 |
<select name="module[serviceExpress]"> |
123 |
<option value="1" <?php if($module['serviceExpress']==1) echo "selected='selected'"; ?>>Enabled</option> |
|
129 |
<option value="1" <?php if($module['serviceExpress']==1) echo "selected='selected'"; ?>>Enabled</option> |
|
126 |
<td valign="top" class="tdText"> |
= |
132 |
<td valign="top" class="tdText"> |
127 |
<select name="module[expressSize]"> |
|
133 |
<select name="module[expressSize]"> |
128 |
<option value="REGULAR" <?php if($module['expressSize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
|
134 |
<option value="REGULAR" <?php if($module['expressSize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
129 |
<option value="LARGE" <?php if($module['expressSize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
|
135 |
<option value="LARGE" <?php if($module['expressSize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
130 |
</select> </td> |
|
136 |
</select> </td> |
131 |
<td valign="top" class="tdText"> |
|
137 |
<td valign="top" class="tdText"> |
|
|
-+ |
138 |
|
132 |
<select name="module[expressContainer]"> |
= |
139 |
<select name="module[expressContainer]"> |
133 |
<option value="Flat Rate Envelope" <?php if($module['expressContainer']=="Flat Rate Envelope") echo "selected='selected'"; ?>>Flat Rate Envelope</option> |
|
140 |
<option value="Flat Rate Envelope" <?php if($module['expressContainer']=="Flat Rate Envelope") echo "selected='selected'"; ?>>Flat Rate Envelope</option> |
|
|
<> |
141 |
<option value="Variable" <?php if($module['expressContainer']=="Variable") echo "selected='selected'"; ?>>Variable</option> |
134 |
</select> </td> |
|
142 |
</select></td> |
135 |
<td valign="top" class="tdText">70 lbs.</td> |
= |
143 |
<td valign="top" class="tdText">70 lbs.</td> |
|
|
-+ |
144 |
<td valign="top" class="tdText">N/A</td> |
|
|
|
145 |
<td valign="top" class="tdText"> </td> |
|
|
|
146 |
<td valign="top" class="tdText"> </td> |
|
|
|
147 |
<td valign="top" class="tdText"> </td> |
|
|
|
148 |
<td valign="top" class="tdText"> </td> |
136 |
</tr> |
= |
149 |
</tr> |
137 |
<tr> |
|
150 |
<tr> |
138 |
<td class="tdText">First Class</td> |
|
151 |
<td class="tdText">First Class</td> |
139 |
<td valign="top" class="tdText"> |
|
152 |
<td valign="top" class="tdText"> |
140 |
<select name="module[serviceFirstClass]"> |
|
153 |
<select name="module[serviceFirstClass]"> |
141 |
<option value="1" <?php if($module['serviceFirstClass']==1) echo "selected='selected'"; ?>>Enabled</option> |
|
154 |
<option value="1" <?php if($module['serviceFirstClass']==1) echo "selected='selected'"; ?>>Enabled</option> |
142 |
<option value="0" <?php if($module['serviceFirstClass']==0) echo "selected='selected'"; ?>>Disabled</option> |
|
155 |
<option value="0" <?php if($module['serviceFirstClass']==0) echo "selected='selected'"; ?>>Disabled</option> |
143 |
</select> </td> |
|
156 |
</select> </td> |
144 |
<td valign="top" class="tdText"><select name="module[FirstClassSize]"> |
<> |
157 |
<td valign="top" class="tdText"> |
|
|
|
158 |
<!-- |
|
|
|
159 |
<select name="module[FirstClassSize]"> |
145 |
<option value="REGULAR" <?php if($module['FirstClassSize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
= |
160 |
<option value="REGULAR" <?php if($module['FirstClassSize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
146 |
<option value="LARGE" <?php if($module['FirstClassSize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
|
161 |
<option value="LARGE" <?php if($module['FirstClassSize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
147 |
</select></td> |
<> |
162 |
</select> |
|
|
|
163 |
--> |
|
|
|
164 |
N/A</td> |
148 |
<td valign="top" class="tdText">N/A</td> |
|
165 |
<td valign="top" class="tdText"> |
|
|
|
166 |
|
|
|
|
167 |
<select name="module[FirstClassMailType]"> |
|
|
|
168 |
<option value="LETTER" <?php if($module['FirstClassMailType']=="LETTER") echo "selected='selected'"; ?>>Letter</option> |
|
|
|
169 |
<option value="FLAT" <?php if($module['FirstClassMailType']=="FLAT") echo "selected='selected'"; ?>>Flat</option> |
|
|
|
170 |
<option value="PARCEL" <?php if($module['FirstClassMailType']=="PARCEL") echo "selected='selected'"; ?>>Parcel</option> |
|
|
|
171 |
</select> </td> |
149 |
<td valign="top" class="tdText">13 oz.</td> |
= |
172 |
<td valign="top" class="tdText">13 oz.</td> |
|
|
-+ |
173 |
<td valign="top" class="tdText"> |
|
|
|
174 |
<select name="module[FirstClassMachineable]"> |
|
|
|
175 |
<option value="TRUE" <?php if($module['FirstClassMachineable']=="TRUE") echo "selected='selected'"; ?>>True</option> |
|
|
|
176 |
<option value="FALSE" <?php if($module['FirstClassMachineable']=="FALSE") echo "selected='selected'"; ?>>False</option> |
|
|
|
177 |
</select></td> |
|
|
|
178 |
<td valign="top" class="tdText"> </td> |
|
|
|
179 |
<td valign="top" class="tdText"> </td> |
|
|
|
180 |
<td valign="top" class="tdText"> </td> |
|
|
|
181 |
<td valign="top" class="tdText"> </td> |
150 |
</tr> |
= |
182 |
</tr> |
151 |
<tr> |
|
183 |
<tr> |
152 |
<td class="tdText">Priority Mail </td> |
|
184 |
<td class="tdText">Priority Mail </td> |
153 |
<td valign="top" class="tdText"> |
|
185 |
<td valign="top" class="tdText"> |
154 |
<select name="module[servicePriority]"> |
|
186 |
<select name="module[servicePriority]"> |
155 |
<option value="1" <?php if($module['servicePriority']==1) echo "selected='selected'"; ?>>Enabled</option> |
|
187 |
<option value="1" <?php if($module['servicePriority']==1) echo "selected='selected'"; ?>>Enabled</option> |
156 |
<option value="0" <?php if($module['servicePriority']==0) echo "selected='selected'"; ?>>Disabled</option> |
|
188 |
<option value="0" <?php if($module['servicePriority']==0) echo "selected='selected'"; ?>>Disabled</option> |
157 |
</select> </td> |
|
189 |
</select> </td> |
158 |
<td valign="top" class="tdText"><select name="module[prioritySize]"> |
|
190 |
<td valign="top" class="tdText"><select name="module[prioritySize]"> |
159 |
<option value="REGULAR" <?php if($module['prioritySize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
|
191 |
<option value="REGULAR" <?php if($module['prioritySize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
160 |
<option value="LARGE" <?php if($module['prioritySize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
|
192 |
<option value="LARGE" <?php if($module['prioritySize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
161 |
</select></td> |
|
193 |
</select></td> |
162 |
<td valign="top" class="tdText"><select name="module[priorityContainer]"> |
<> |
194 |
<td valign="top" class="tdText"> |
|
|
|
195 |
|
|
|
|
196 |
<select name="module[priorityContainer]"> |
|
|
|
197 |
<option value="Variable" <?php if($module['priorityContainer']=="Variable") echo "selected='selected'"; ?>>Variable Rate</option> |
|
|
|
198 |
<option value="RECTANGULAR" <?php if($module['priorityContainer']=="RECTANGULAR") echo "selected='selected'"; ?>>Rectangular</option> |
|
|
|
199 |
<option value="NONRECTANGULAR" <?php if($module['priorityContainer']=="NONRECTANGULAR") echo "selected='selected'"; ?>>Non Rectangular</option> |
163 |
<option value="Flat Rate Envelope" <?php if($module['priorityContainer']=="Flat Rate Envelope") echo "selected='selected'"; ?>>Flat Rate Envelope</option> |
|
200 |
<option value="Flat Rate Envelope" <?php if($module['priorityContainer']=="Flat Rate Envelope") echo "selected='selected'"; ?> >Flat Rate Envelope</option> |
164 |
<option value="Flat Rate Box" <?php if($module['priorityContainer']=="Flat Rate Box") echo "selected='selected'"; ?>>Flat Rate Box</option> |
= |
201 |
<option value="Flat Rate Box" <?php if($module['priorityContainer']=="Flat Rate Box") echo "selected='selected'"; ?>>Flat Rate Box</option> |
165 |
</select> </td> |
<> |
202 |
</select> </td> |
166 |
<td valign="top" class="tdText">70 lbs.</td> |
= |
203 |
<td valign="top" class="tdText">70 lbs.</td> |
|
|
-+ |
204 |
<td valign="top" class="tdText">N/A</td> |
|
|
|
205 |
<td valign="top" class="tdText"><input name="module[priorityLength]" type="text" size="5" value="<?php echo $module['priorityLength'];?>" /></td> |
|
|
|
206 |
<td valign="top" class="tdText"><input name="module[priorityWidth]" type="text" size="5" value="<?php echo $module['priorityWidth'];?>" /></td> |
|
|
|
207 |
<td valign="top" class="tdText"><input name="module[priorityHeight]" type="text" size="5" value="<?php echo $module['priorityHeight'];?>" /></td> |
|
|
|
208 |
<td valign="top" class="tdText"><input name="module[priorityGirth]" type="text" size="5" value="<?php echo $module['priorityGirth'];?>" /></td> |
167 |
</tr> |
= |
209 |
</tr> |
168 |
<tr> |
|
210 |
<tr> |
169 |
<td class="tdText">Parcel Post (Machinable) </td> |
<> |
211 |
<td class="tdText">Parcel Post </td> |
170 |
<td valign="top" class="tdText"> |
= |
212 |
<td valign="top" class="tdText"> |
171 |
<select name="module[serviceParcelM]"> |
<> |
213 |
<select name="module[serviceParcel]"> |
172 |
<option value="1" <?php if($module['serviceParcelM']==1) echo "selected='selected'"; ?>>Enabled</option> |
|
214 |
<option value="1" <?php if($module['serviceParcel']==1) echo "selected='selected'"; ?>>Enabled</option> |
173 |
<option value="0" <?php if($module['serviceParcelM']==0) echo "selected='selected'"; ?>>Disabled</option> |
|
215 |
<option value="0" <?php if($module['serviceParcel']==0) echo "selected='selected'"; ?>>Disabled</option> |
174 |
</select> </td> |
= |
216 |
</select> </td> |
175 |
<td valign="top" class="tdText"><select name="module[parcelMSize]"> |
<> |
217 |
<td valign="top" class="tdText"><select name="module[parcelSize]"> |
176 |
<option value="REGULAR" <?php if($module['parcelMSize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
|
218 |
<option value="REGULAR" <?php if($module['parcelSize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
177 |
<option value="LARGE" <?php if($module['parcelMSize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
|
219 |
<option value="LARGE" <?php if($module['parcelSize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
178 |
<option value="OVERSIZE" <?php if($module['parcelMSize']=="OVERSIZE") echo "selected='selected'"; ?>>Oversize</option> |
|
220 |
<option value="OVERSIZE" <?php if($module['parcelSize']=="OVERSIZE") echo "selected='selected'"; ?>>Oversize</option> |
179 |
</select></td> |
= |
221 |
</select></td> |
180 |
<td valign="top" class="tdText">N/A</td> |
|
222 |
<td valign="top" class="tdText">N/A</td> |
181 |
<td valign="top" class="tdText">70 lbs.</td> |
|
223 |
<td valign="top" class="tdText">70 lbs.</td> |
182 |
</tr> |
<> |
|
|
183 |
<tr> |
|
|
|
184 |
<td class="tdText">Parcel Post (Non-Machinable) </td> |
|
|
|
185 |
<td valign="top" class="tdText"><select name="module[serviceParcelNM]"> |
|
224 |
<td valign="top" class="tdText"><select name="module[parcelMachineable]"> |
186 |
<option value="1" <?php if($module['serviceParcelNM']==1) echo "selected='selected'"; ?>>Enabled</option> |
|
225 |
<option value="TRUE" <?php if($module['parcelMachineable']=="TRUE") echo "selected='selected'"; ?>>True</option> |
187 |
<option value="0" <?php if($module['serviceParcelNM']==0) echo "selected='selected'"; ?>>Disabled</option> |
|
226 |
<option value="FALSE" <?php if($module['parcelMachineable']=="FALSE") echo "selected='selected'"; ?>>False</option> |
188 |
</select></td> |
= |
227 |
</select></td> |
189 |
<td valign="top" class="tdText"><select name="module[parcelNMSize]"> |
<> |
228 |
<td valign="top" class="tdText"> </td> |
190 |
<option value="REGULAR" <?php if($module['parcelNMSize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
|
229 |
<td valign="top" class="tdText"> </td> |
191 |
<option value="LARGE" <?php if($module['parcelNMSize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
|
|
|
192 |
<option value="OVERSIZE" <?php if($module['parcelNMSize']=="OVERSIZE") echo "selected='selected'"; ?>>Oversize</option> |
|
|
|
193 |
</select></td> |
|
|
|
194 |
<td valign="top" class="tdText">N/A</td> |
|
230 |
<td valign="top" class="tdText"> </td> |
195 |
<td valign="top" class="tdText">70 lbs.</td> |
|
231 |
<td valign="top" class="tdText"> </td> |
196 |
</tr> |
= |
232 |
</tr> |
197 |
<tr> |
|
233 |
<tr> |
198 |
<td class="tdText">BPM (Bound Printed Matter)</td> |
|
234 |
<td class="tdText">BPM (Bound Printed Matter)</td> |
199 |
<td valign="top" class="tdText"> |
|
235 |
<td valign="top" class="tdText"> |
200 |
<select name="module[serviceBPM]"> |
|
236 |
<select name="module[serviceBPM]"> |
201 |
<option value="1" <?php if($module['serviceBPM']==1) echo "selected='selected'"; ?>>Enabled</option> |
|
237 |
<option value="1" <?php if($module['serviceBPM']==1) echo "selected='selected'"; ?>>Enabled</option> |
|
204 |
<td valign="top" class="tdText"><select name="module[BPMSize]"> |
= |
240 |
<td valign="top" class="tdText"><select name="module[BPMSize]"> |
205 |
<option value="REGULAR" <?php if($module['BPMSize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
|
241 |
<option value="REGULAR" <?php if($module['BPMSize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
206 |
<option value="LARGE" <?php if($module['BPMSize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
|
242 |
<option value="LARGE" <?php if($module['BPMSize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
207 |
</select></td> |
|
243 |
</select></td> |
208 |
<td valign="top" class="tdText">N/A</td> |
|
244 |
<td valign="top" class="tdText">N/A</td> |
209 |
<td valign="top" class="tdText">15 lbs.</td> |
|
245 |
<td valign="top" class="tdText">15 lbs.</td> |
|
|
-+ |
246 |
<td valign="top" class="tdText">N/A</td> |
|
|
|
247 |
<td valign="top" class="tdText"> </td> |
|
|
|
248 |
<td valign="top" class="tdText"> </td> |
|
|
|
249 |
<td valign="top" class="tdText"> </td> |
|
|
|
250 |
<td valign="top" class="tdText"> </td> |
210 |
</tr> |
= |
251 |
</tr> |
211 |
<tr> |
|
252 |
<tr> |
212 |
<td class="tdText">Library</td> |
|
253 |
<td class="tdText">Library</td> |
213 |
<td valign="top" class="tdText"> |
|
254 |
<td valign="top" class="tdText"> |
214 |
<select name="module[serviceLibrary]"> |
|
255 |
<select name="module[serviceLibrary]"> |
215 |
<option value="1" <?php if($module['serviceLibrary']==1) echo "selected='selected'"; ?>>Enabled</option> |
|
256 |
<option value="1" <?php if($module['serviceLibrary']==1) echo "selected='selected'"; ?>>Enabled</option> |
|
218 |
<td valign="top" class="tdText"><select name="module[LibrarySize]"> |
= |
259 |
<td valign="top" class="tdText"><select name="module[LibrarySize]"> |
219 |
<option value="REGULAR" <?php if($module['LibrarySize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
|
260 |
<option value="REGULAR" <?php if($module['LibrarySize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
220 |
<option value="LARGE" <?php if($module['LibrarySize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
|
261 |
<option value="LARGE" <?php if($module['LibrarySize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
221 |
</select></td> |
|
262 |
</select></td> |
222 |
<td valign="top" class="tdText">N/A</td> |
|
263 |
<td valign="top" class="tdText">N/A</td> |
223 |
<td valign="top" class="tdText">70 lbs.</td> |
|
264 |
<td valign="top" class="tdText">70 lbs.</td> |
|
|
-+ |
265 |
<td valign="top" class="tdText">N/A</td> |
|
|
|
266 |
<td valign="top" class="tdText"> </td> |
|
|
|
267 |
<td valign="top" class="tdText"> </td> |
|
|
|
268 |
<td valign="top" class="tdText"> </td> |
|
|
|
269 |
<td valign="top" class="tdText"> </td> |
224 |
</tr> |
= |
270 |
</tr> |
225 |
<tr> |
|
271 |
<tr> |
226 |
<td class="tdText">Media</td> |
|
272 |
<td class="tdText">Media</td> |
227 |
<td valign="top" class="tdText"> |
<> |
273 |
<td valign="top" class="tdText"><select name="module[serviceMedia]"> |
228 |
|
|
|
|
229 |
<select name="module[serviceMedia]"> |
|
|
|
230 |
<option value="1" <?php if($module['serviceMedia']==1) echo "selected='selected'"; ?>>Enabled</option> |
= |
274 |
<option value="1" <?php if($module['serviceMedia']==1) echo "selected='selected'"; ?>>Enabled</option> |
231 |
<option value="0" <?php if($module['serviceMedia']==0) echo "selected='selected'"; ?>>Disabled</option> |
|
275 |
<option value="0" <?php if($module['serviceMedia']==0) echo "selected='selected'"; ?>>Disabled</option> |
232 |
</select> </td> |
<> |
276 |
</select></td> |
233 |
<td valign="top" class="tdText"><select name="module[MediaSize]"> |
= |
277 |
<td valign="top" class="tdText"><select name="module[MediaSize]"> |
234 |
<option value="REGULAR" <?php if($module['MediaSize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
|
278 |
<option value="REGULAR" <?php if($module['MediaSize']=="REGULAR") echo "selected='selected'"; ?>>Regular</option> |
235 |
<option value="LARGE" <?php if($module['MediaSize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
|
279 |
<option value="LARGE" <?php if($module['MediaSize']=="LARGE") echo "selected='selected'"; ?>>Large</option> |
236 |
</select></td> |
|
280 |
</select></td> |
237 |
<td valign="top" class="tdText">N/A</td> |
|
281 |
<td valign="top" class="tdText">N/A</td> |
238 |
<td valign="top" class="tdText">70 lbs.</td> |
|
282 |
<td valign="top" class="tdText">70 lbs.</td> |
|
|
-+ |
283 |
<td valign="top" class="tdText">N/A</td> |
|
|
|
284 |
<td valign="top" class="tdText"> </td> |
|
|
|
285 |
<td valign="top" class="tdText"> </td> |
|
|
|
286 |
<td valign="top" class="tdText"> </td> |
|
|
|
287 |
<td valign="top" class="tdText"> </td> |
239 |
</tr> |
= |
288 |
</tr> |
240 |
<tr> |
|
289 |
<tr> |
241 |
<td class="tdText"><strong>Origin Zip Code:</strong><br /> </td> |
<> |
290 |
<td class="tdText"><strong>Origin Zip Code:</strong><br /> </td> |
242 |
<td valign="top" class="tdText"> |
|
291 |
<td valign="top" class="tdText"> |
243 |
<input type="text" name="module[ziporigin]" value="<?php echo $module['ziporigin']; ?>" class="textbox" /> </td> |
|
292 |
<input type="text" name="module[ziporigin]" value="<?php echo $module['ziporigin']; ?>" class="textbox" /> </td> |
244 |
<td valign="top" class="tdText"> </td> |
|
293 |
<td valign="top" class="tdText"> </td> |
245 |
<td valign="top" class="tdText"> </td> |
|
294 |
<td valign="top" class="tdText"> </td> |
246 |
<td valign="top" class="tdText"> </td> |
|
295 |
<td valign="top" class="tdText"> </td> |
|
|
|
296 |
<td valign="top" class="tdText"> </td> |
|
|
|
297 |
<td valign="top" class="tdText"> </td> |
|
|
|
298 |
<td valign="top" class="tdText"> </td> |
|
|
|
299 |
<td valign="top" class="tdText"> </td> |
|
|
|
300 |
<td valign="top" class="tdText"> </td> |
247 |
</tr> |
= |
301 |
</tr> |
248 |
<tr> |
|
302 |
<tr> |
249 |
<td class="tdText"><strong>USPS Username:</strong><br /> </td> |
|
303 |
<td class="tdText"><strong>USPS Username:</strong><br /> </td> |
250 |
<td valign="top" class="tdText"> |
|
304 |
<td valign="top" class="tdText"> |
251 |
<input type="text" name="module[username]" value="<?php echo $module['username']; ?>" class="textbox" /> </td> |
|
305 |
<input type="text" name="module[username]" value="<?php echo $module['username']; ?>" class="textbox" /> </td> |
252 |
<td valign="top" class="tdText"> </td> |
|
306 |
<td valign="top" class="tdText"> </td> |
253 |
<td valign="top" class="tdText"> </td> |
|
307 |
<td valign="top" class="tdText"> </td> |
254 |
<td valign="top" class="tdText"> </td> |
|
308 |
<td valign="top" class="tdText"> </td> |
|
|
<> |
309 |
<td valign="top" class="tdText"> </td> |
|
|
|
310 |
<td valign="top" class="tdText"> </td> |
|
|
|
311 |
<td valign="top" class="tdText"> </td> |
|
|
|
312 |
<td valign="top" class="tdText"> </td> |
|
|
|
313 |
<td valign="top" class="tdText"> </td> |
255 |
</tr> |
|
314 |
</tr> |
256 |
<tr><td align="left" class="tdText"><strong>USPS Password:</strong></td> |
= |
315 |
<tr><td align="left" class="tdText"><strong>USPS Password:</strong></td> |
257 |
<td class="tdText"><input type="text" name="module[password]" value="<?php echo $module['password']; ?>" class="textbox" /></td> |
|
316 |
<td class="tdText"><input type="text" name="module[password]" value="<?php echo $module['password']; ?>" class="textbox" /></td> |
258 |
<td class="tdText" colspan="3"> <-- Currently unused. Must simply be NOT empty.</td> |
<> |
317 |
<td class="tdText" colspan="8"> <-- Currently unused. Must simply be NOT empty.</td> |
259 |
</tr> |
= |
318 |
</tr> |
260 |
<tr> |
|
319 |
<tr> |
261 |
<td align="right" class="tdText"> </td> |
|
320 |
<td align="right" class="tdText"> </td> |
262 |
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td> |
|
321 |
<td class="tdText"><input type="submit" class="submit" value="Edit Config" /></td> |
263 |
<td class="tdText"> </td> |
|
322 |
<td class="tdText"> </td> |
264 |
<td class="tdText"> </td> |
|
323 |
<td class="tdText"> </td> |
265 |
<td class="tdText"> </td> |
|
324 |
<td class="tdText"> </td> |
|
|
<> |
325 |
<td class="tdText"> </td> |
|
|
|
326 |
<td class="tdText"> </td> |
|
|
|
327 |
<td class="tdText"> </td> |
|
|
|
328 |
<td class="tdText"> </td> |
|
|
|
329 |
<td class="tdText"> </td> |
266 |
</tr> |
|
330 |
</tr> |
267 |
</table> |
= |
331 |
</table> |
268 |
<p><strong>Notes:</strong><br /> |
<> |
332 |
<p><strong>Important Notes:</strong><br /> |
269 |
To get this shipping method to work you must first sign up for an account here <a href="http://www.uspswebtools.com/registration/">http://www.uspswebtools.com/registration/</a>. |
|
333 |
To get this shipping method to work you must first sign up for an account here <a href="http://www.uspswebtools.com/registration/" class="txtLink">http://www.uspswebtools.com/registration/</a>.</p> |
270 |
The live server will not work until you have had two specific successful transactions on the test server.</p> |
|
334 |
<p>After you have registered please email <a href="mailto:icustomercare@usps.com" class="txtLink">icustomercare@usps.com</a> or |
271 |
<p> <a href="./testSubmit.php?module=<?php echo $_GET['module']; ?>&folder=<?php echo $_GET['folder']; ?>" class="txtLink"><strong>Click Here To Submit USPS Tests</strong></a></p> |
|
335 |
call USPS on <strong>1-800-344-7779</strong> (7:00 AM to 11:00 PM EST daily) and ask them to activate your account so that it can access the "production server".</p> |
272 |
<p>Once those have been successful, email USPS at <a href="mailto:icustomercare@usps.com">icustomercare@usps.com</a> or |
|
|
|
273 |
call them at <strong>1-800-344-7779</strong> (7:00 AM to 11:00 PM EST daily) and they will activate your account to use the live server.</p> |
|
|
|
274 |
</form> |
= |
336 |
</form> |
275 |
<?php include("../../../includes/footer.inc.php"); ?> |
|
337 |
<?php include("../../../includes/footer.inc.php"); ?> |
5 |
|
= |
5 |
|
6 |
/* Demo code for the USPS class, which retrieves real-time shipping quotes for domestic and international shipments, directly from the United States Postal Service. You'll need cURL and DOMXML to use the class. IT DOES NOT WORK WITH PHP 5 */ |
|
6 |
/* Demo code for the USPS class, which retrieves real-time shipping quotes for domestic and international shipments, directly from the United States Postal Service. You'll need cURL and DOMXML to use the class. IT DOES NOT WORK WITH PHP 5 */ |
7 |
|
|
7 |
|
8 |
require "class.usps.php"; |
|
8 |
require "class.usps.php"; |
9 |
|
|
9 |
|
10 |
|
|
10 |
|
11 |
//Instantiate the class; the last parameter determines what kind of quote you would like (international packages or domestic packages). Use RateV2 for |
<> |
11 |
//Instantiate the class; the last parameter determines what kind of quote you would like (international packages or domestic packages). Use RateV3 for |
12 |
//domestic shipments and IntlRate for international. Bear in mind that the parameters given for add_package() differ depending on the API you choose. |
= |
12 |
//domestic shipments and IntlRate for international. Bear in mind that the parameters given for add_package() differ depending on the API you choose. |
13 |
//You cannot mix and match APIs! If you instantiate the class with RateV2, you must ONLY put domestic packages in your request. (Use the reset() method |
<> |
13 |
//You cannot mix and match APIs! If you instantiate the class with RateV3, you must ONLY put domestic packages in your request. (Use the reset() method |
14 |
//of the class if you want to clear everything, then set $usps->api to the new API you want to use.) Attempts to add packages that do not fit into |
= |
14 |
//of the class if you want to clear everything, then set $usps->api to the new API you want to use.) Attempts to add packages that do not fit into |
15 |
//the requirements of the current API will fail. |
|
15 |
//the requirements of the current API will fail. |
16 |
//echo $module['username']." - ".$module['password']; |
|
16 |
//echo $module['username']." - ".$module['password']; |
17 |
|
|
17 |
|
18 |
if($basket['delInf']['country']!==$config['siteCountry']) { |
|
18 |
if($basket['delInf']['country']!==$config['siteCountry']) { |
19 |
|
|
19 |
|
20 |
$api = "IntlRate"; |
|
20 |
$api = "IntlRate"; |
21 |
|
|
21 |
|
22 |
} else { |
|
22 |
} else { |
23 |
|
|
23 |
|
24 |
$api = "RateV2"; |
<> |
24 |
$api = "RateV3"; |
25 |
|
= |
25 |
|
26 |
} |
|
26 |
} |
27 |
|
|
27 |
|
28 |
//Add a package - create an array with the required parameters and send that to add_package. |
|
28 |
//Add a package - create an array with the required parameters and send that to add_package. |
29 |
//Domestic shipments require the following parameters: |
|
29 |
//Domestic shipments require the following parameters: |
30 |
//service - Parcel, Priority, Express, First Call, BPM, Library, Media, All |
|
30 |
//service - Parcel, Priority, Express, First Call, BPM, Library, Media, All |
|
71 |
} |
= |
71 |
} |
72 |
|
|
72 |
|
73 |
} |
|
73 |
} |
74 |
|
|
74 |
|
75 |
foreach($module as $moduleKey => $moduleValue){ |
|
75 |
foreach($module as $moduleKey => $moduleValue){ |
76 |
|
|
76 |
|
|
|
-+ |
77 |
|
77 |
if(ereg("service_",$moduleKey) && $moduleValue==1){ |
= |
78 |
if(ereg("service_",$moduleKey) && $moduleValue==1){ |
78 |
// ignore the variable fixes an upgrade issue since security audit |
|
79 |
// ignore the variable fixes an upgrade issue since security audit |
79 |
}elseif(ereg("service",$moduleKey) && $moduleValue==1){ |
|
80 |
}elseif(ereg("service",$moduleKey) && $moduleValue==1){ |
80 |
|
|
81 |
|
81 |
$moduleKey = str_replace("service","",$moduleKey); |
|
82 |
$moduleKey = str_replace("service","",$moduleKey); |
82 |
|
|
83 |
|
|
84 |
if($module["service".$moduleKey]==1){ |
= |
85 |
if($module["service".$moduleKey]==1){ |
85 |
|
|
86 |
|
86 |
switch($moduleKey) { |
|
87 |
switch($moduleKey) { |
87 |
|
|
88 |
|
88 |
case "Express": |
|
89 |
case "Express": |
89 |
$package = array( |
|
90 |
$package = array( |
90 |
'zip_origin' => $module['ziporigin'], |
+- |
|
|
91 |
'zip_dest' => $zip_dest, |
|
|
|
92 |
'pounds' => $lbs, |
|
|
|
93 |
'ounces' => $oz, |
|
|
|
94 |
'service' => 'EXPRESS', |
= |
91 |
'service' => 'EXPRESS', |
95 |
'size' => $module['expressSize'], |
|
92 |
'size' => $module['expressSize'], |
96 |
'container' => $module['expressContainer'], |
|
93 |
'container' => $module['expressContainer'], |
97 |
'country' => $countryName, |
+- |
|
|
98 |
'mail_type' => "Package" |
= |
94 |
'mail_type' => "Package" |
99 |
); |
|
95 |
); |
100 |
$overWeight = overWeight(70); |
|
96 |
$overWeight = overWeight(70); |
101 |
break; |
|
97 |
break; |
102 |
|
|
98 |
|
103 |
case "FirstClass": |
|
99 |
case "FirstClass": |
104 |
$package = array( |
|
100 |
$package = array( |
105 |
'zip_origin' => $module['ziporigin'], |
+- |
|
|
106 |
'zip_dest' => $zip_dest, |
|
|
|
107 |
'pounds' => $lbs, |
|
|
|
108 |
'ounces' => $oz, |
|
|
|
109 |
'service' => 'FIRST CLASS', |
= |
101 |
'service' => 'FIRST CLASS', |
110 |
'size' => $module['FirstClassSize'], |
|
102 |
'size' => $module['FirstClassSize'], |
111 |
'country' => $countryName, |
<> |
|
|
112 |
'mail_type' => "Package" |
|
103 |
'mail_type' => "Package", |
|
|
|
104 |
'first_class_mail_type' => $module['FirstClassMailType'], |
|
|
|
105 |
'machinable' => $module['FirstClassMachineable'] |
113 |
); |
= |
106 |
); |
114 |
$overWeight = overWeight(0.812); |
|
107 |
$overWeight = overWeight(0.812); |
115 |
break; |
|
108 |
break; |
116 |
|
|
109 |
|
117 |
case "Priority": |
|
110 |
case "Priority": |
118 |
$package = array( |
|
111 |
$package = array( |
119 |
'zip_origin' => $module['ziporigin'], |
+- |
|
|
120 |
'zip_dest' => $zip_dest, |
|
|
|
121 |
'pounds' => $lbs, |
|
|
|
122 |
'ounces' => $oz, |
|
|
|
123 |
'service' => 'PRIORITY', |
= |
112 |
'service' => 'PRIORITY', |
124 |
'size' => $module['prioritySize'], |
|
113 |
'size' => $module['prioritySize'], |
125 |
'container' => $module['priorityContainer'], |
|
114 |
'container' => $module['priorityContainer'], |
126 |
'country' => $countryName, |
<> |
|
|
127 |
'mail_type' => "Package" |
|
115 |
'mail_type' => "Package", |
128 |
); |
|
116 |
'width' => $module['priorityWidth'], |
129 |
$overWeight = overWeight(70); |
|
|
|
130 |
break; |
|
|
|
131 |
|
|
|
|
132 |
case "ParcelM": |
|
|
|
133 |
$package = array( |
|
|
|
134 |
'zip_origin' => $module['ziporigin'], |
|
117 |
'height' => $module['priorityHeight'], |
135 |
'zip_dest' => $zip_dest, |
|
|
|
136 |
'pounds' => $lbs, |
|
|
|
137 |
'ounces' => $oz, |
|
|
|
138 |
'service' => 'PARCEL', |
|
|
|
139 |
'size' => $module['parcelMSize'], |
|
118 |
'length' => $module['priorityLength'], |
140 |
'machinable' => 'TRUE', |
|
|
|
141 |
'country' => $countryName, |
|
119 |
'girth' => $module['priorityGirth'] |
142 |
'mail_type' => "Package" |
|
|
|
143 |
); |
= |
120 |
); |
144 |
$overWeight = overWeight(70); |
|
121 |
$overWeight = overWeight(70); |
145 |
break; |
|
122 |
break; |
146 |
|
|
123 |
|
147 |
case "ParcelNM": |
<> |
124 |
case "Parcel": |
148 |
$package = array( |
= |
125 |
$package = array( |
149 |
'zip_origin' => $module['ziporigin'], |
+- |
|
|
150 |
'zip_dest' => $zip_dest, |
|
|
|
151 |
'pounds' => $lbs, |
|
|
|
152 |
'ounces' => $oz, |
|
|
|
153 |
'service' => 'PARCEL', |
= |
126 |
'service' => 'PARCEL', |
154 |
'size' => $module['parcelNMSize'], |
<> |
127 |
'size' => $module['parcelSize'], |
155 |
'machinable' => 'FALSE', |
|
128 |
'machinable' => $module['parcelMachineable'], |
156 |
'country' => $countryName, |
|
|
|
157 |
'mail_type' => "Package" |
= |
129 |
'mail_type' => "Package" |
158 |
); |
|
130 |
); |
159 |
$overWeight = overWeight(70); |
|
131 |
$overWeight = overWeight(70); |
160 |
break; |
|
132 |
break; |
161 |
|
|
133 |
|
162 |
case "BPM": |
|
134 |
case "BPM": |
163 |
$package = array( |
|
135 |
$package = array( |
164 |
'zip_origin' => $module['ziporigin'], |
+- |
|
|
165 |
'zip_dest' => $zip_dest, |
|
|
|
166 |
'pounds' => $lbs, |
|
|
|
167 |
'ounces' => $oz, |
|
|
|
168 |
'service' => 'BPM', |
= |
136 |
'service' => 'BPM', |
169 |
'size' => $module['BPMSize'], |
|
137 |
'size' => $module['BPMSize'], |
170 |
'country' => $countryName, |
+- |
|
|
171 |
'mail_type' => "Package" |
= |
138 |
'mail_type' => "Package" |
172 |
); |
|
139 |
); |
173 |
$overWeight = overWeight(15); |
|
140 |
$overWeight = overWeight(15); |
174 |
break; |
|
141 |
break; |
175 |
|
|
142 |
|
176 |
case "Library": |
|
143 |
case "Library": |
177 |
$package = array( |
|
144 |
$package = array( |
178 |
'zip_origin' => $module['ziporigin'], |
+- |
|
|
179 |
'zip_dest' => $zip_dest, |
|
|
|
180 |
'pounds' => $lbs, |
|
|
|
181 |
'ounces' => $oz, |
|
|
|
182 |
'service' => 'LIBRARY', |
= |
145 |
'service' => 'LIBRARY', |
183 |
'size' => $module['LibrarySize'], |
|
146 |
'size' => $module['LibrarySize'], |
184 |
'country' => $countryName, |
+- |
|
|
185 |
'mail_type' => "Package" |
= |
147 |
'mail_type' => "Package" |
186 |
); |
|
148 |
); |
187 |
$overWeight = overWeight(70); |
|
149 |
$overWeight = overWeight(70); |
188 |
break; |
|
150 |
break; |
189 |
|
|
151 |
|
190 |
case "Media": |
|
152 |
case "Media": |
191 |
$package = array( |
|
153 |
$package = array( |
192 |
'zip_origin' => $module['ziporigin'], |
+- |
|
|
193 |
'zip_dest' => $zip_dest, |
|
|
|
194 |
'pounds' => $lbs, |
|
|
|
195 |
'ounces' => $oz, |
|
|
|
196 |
'service' => 'MEDIA', |
= |
154 |
'service' => 'MEDIA', |
197 |
'size' => $module['MediaSize'], |
|
155 |
'size' => $module['MediaSize'], |
198 |
'country' => $countryName, |
+- |
|
|
199 |
'mail_type' => "Package" |
= |
156 |
'mail_type' => "Package" |
200 |
); |
|
157 |
); |
201 |
$overWeight = overWeight(70); |
|
158 |
$overWeight = overWeight(70); |
202 |
break; |
|
159 |
break; |
203 |
|
|
160 |
|
204 |
} |
|
161 |
} |
|
|
<> |
162 |
$package['zip_origin'] = $module['ziporigin']; |
|
|
|
163 |
$package['zip_dest'] = $zip_dest; |
|
|
|
164 |
$package['pounds'] = $lbs; |
205 |
|
|
165 |
$package['ounces'] = $oz; |
|
|
|
166 |
$package['country'] = $countryName; |
|
|
|
167 |
$package['value'] = $subTotal; |
206 |
|
= |
168 |
|
207 |
if($overWeight==FALSE){ |
|
169 |
if($overWeight==FALSE){ |
208 |
|
|
170 |
|
209 |
$usps = new USPS($module['username'], $module['password'], $api); |
|
171 |
$usps = new USPS($module['username'], $module['password'], $api); |
210 |
|
|
172 |
|
211 |
if(!$usps->add_package($package) && $module['debug']==0) die("Failed to add the package"); |
|
173 |
if(!$usps->add_package($package) && $module['debug']==0) die("Failed to add the package"); |
|
260 |
//get_restrictions($package_id) - Gets other restrictions about shipments into that country |
= |
222 |
//get_restrictions($package_id) - Gets other restrictions about shipments into that country |
261 |
//get_observations($package_id) - Gets other, miscellaneous observations about shipments into that country |
|
223 |
//get_observations($package_id) - Gets other, miscellaneous observations about shipments into that country |
262 |
//get_areas_served($package_id) - Gets a list of the areas served within that country |
|
224 |
//get_areas_served($package_id) - Gets a list of the areas served within that country |
263 |
|
|
225 |
|
264 |
unset($moduleKey,$moduleValue); |
|
226 |
unset($moduleKey,$moduleValue); |
265 |
|
|
227 |
|
|
|
-+ |
228 |
if($api == "IntlRate") |
|
|
|
229 |
{ |
|
|
|
230 |
break; |
|
|
|
231 |
} |
|
|
|
232 |
|
266 |
} |
= |
233 |
} |
267 |
|
|
234 |
|
268 |
} |
|
235 |
} |
269 |
$shippingAvailable = TRUE; |
|
236 |
$shippingAvailable = TRUE; |
270 |
} |
|
237 |
} |
271 |
|
|
238 |
|
272 |
unset($module); |
|
239 |
unset($module); |
273 |
?> |
|
240 |
?> |
1 |
<?php |
= |
1 |
<?php |
2 |
class USPS |
<> |
2 |
class USPS { |
3 |
{ |
|
|
|
4 |
var $user_id; |
= |
3 |
var $user_id; |
5 |
var $password; |
|
4 |
var $password; |
6 |
var $api; |
|
5 |
var $api; |
7 |
var $request_xml; |
|
6 |
var $request_xml; |
8 |
var $package_index = 0; |
|
7 |
var $package_index = 0; |
9 |
var $current_result = array(); |
|
8 |
var $current_result = array(); |
|
229 |
|
= |
228 |
|
230 |
global $module; |
|
229 |
global $module; |
231 |
if($module['debug']==1) { echo $error; exit; } |
|
230 |
if($module['debug']==1) { echo $error; exit; } |
232 |
|
|
231 |
|
233 |
} |
|
232 |
} |
234 |
|
|
233 |
|
235 |
function USPS($user_id, $password, $api = 'RateV2') |
<> |
234 |
function USPS($user_id, $password, $api = 'RateV3') { |
236 |
{ |
|
|
|
237 |
if(empty($user_id) || empty($password)) { |
= |
235 |
if(empty($user_id) || empty($password)) { |
238 |
|
|
236 |
|
239 |
$this->debug("USPS ERROR: User ID or Password was empty. Please make sure this has been added correctly to the admin side of your store."); |
|
237 |
$this->debug("USPS ERROR: User ID or Password was empty. Please make sure this has been added correctly to the admin side of your store."); |
240 |
return false; |
|
238 |
return false; |
241 |
|
|
239 |
|
242 |
} else { |
|
240 |
} else { |
|
244 |
$this->password = $password; |
= |
242 |
$this->password = $password; |
245 |
$this->api = $api; |
|
243 |
$this->api = $api; |
246 |
$this->request_xml = '<' . $api . 'Request USERID="' . $user_id . '" PASSWORD="' . $password . '">'; |
|
244 |
$this->request_xml = '<' . $api . 'Request USERID="' . $user_id . '" PASSWORD="' . $password . '">'; |
247 |
} |
|
245 |
} |
248 |
} |
|
246 |
} |
249 |
|
|
247 |
|
250 |
function reset() |
<> |
248 |
function reset() { |
251 |
{ |
|
|
|
252 |
$this->api = ''; |
= |
249 |
$this->api = ''; |
253 |
$this->current_result = ''; |
|
250 |
$this->current_result = ''; |
254 |
$this->request_xml = ''; |
|
251 |
$this->request_xml = ''; |
255 |
$this->package_index = 0; |
|
252 |
$this->package_index = 0; |
256 |
} |
|
253 |
} |
257 |
|
|
254 |
|
258 |
function add_package($attribs = '') |
<> |
255 |
function add_package($attribs = '') { |
259 |
{ |
|
256 |
|
260 |
if(!is_array($attribs)) { |
= |
257 |
if(!is_array($attribs)) { |
261 |
$this->debug("USPS ERROR: Package array was empty."); |
|
258 |
$this->debug("USPS ERROR: Package array was empty."); |
262 |
return false; |
|
259 |
return false; |
263 |
} |
|
260 |
} |
264 |
|
|
261 |
|
265 |
//Check to make sure array has required values for API |
|
262 |
//Check to make sure array has required values for API |
266 |
if($this->api == 'RateV2') { |
<> |
263 |
if($this->api == 'RateV3') { |
267 |
|
= |
264 |
|
268 |
if(!$attribs['service'] || !$attribs['zip_origin'] || !$attribs['zip_dest'] || !$attribs['size']) { |
<> |
265 |
if(!$attribs['service'] || !$attribs['zip_origin'] || !$attribs['zip_dest'] || (!$attribs['size'] && strtolower($attribs['service'])!=="first class")) { |
269 |
|
= |
266 |
|
270 |
$this->debug("USPS ERROR: One of the following variables was empty. service = '".$attribs['service']."', zip_origin = '".$attribs['zip_origin']."', zip_dest = '".$attribs['zip_dest']."', size = '".$attribs['size']."'"); |
<> |
267 |
$this->debug("USPS ERROR: One of the following variables was empty. service = '".$attribs['service']."', zip_origin = '".$attribs['zip_origin']."', zip_dest = '".$attribs['zip_dest']."', size = '".$attribs['size']."'"); |
271 |
return false; |
|
268 |
return false; |
272 |
|
= |
269 |
|
273 |
} |
|
270 |
} |
274 |
|
<> |
271 |
|
275 |
} |
|
|
|
276 |
|
|
|
|
277 |
if($this->api == 'RateV2') |
|
|
|
278 |
{ |
|
|
|
279 |
//Check service type |
= |
272 |
//Check service type |
280 |
if(empty($attribs['service'])) { |
|
273 |
if(empty($attribs['service'])) { |
281 |
$this->debug("USPS ERROR: Service variable was empty."); |
|
274 |
$this->debug("USPS ERROR: Service variable was empty."); |
282 |
return false; |
|
275 |
return false; |
283 |
} else { |
|
276 |
} else { |
284 |
switch(strtolower($attribs['service'])) |
<> |
|
|
285 |
{ |
|
277 |
|
|
|
|
278 |
switch(strtolower($attribs['service'])){ |
286 |
case 'express': |
= |
279 |
case 'express': |
287 |
case 'first class': |
|
280 |
case 'first class': |
288 |
case 'priority': |
|
281 |
case 'priority': |
289 |
case 'parcel': |
|
282 |
case 'parcel': |
290 |
case 'bpm': |
|
283 |
case 'bpm': |
291 |
case 'library': |
|
284 |
case 'library': |
|
304 |
|
= |
297 |
|
305 |
//Check weight |
|
298 |
//Check weight |
306 |
if($attribs['pounds'] + $attribs['ounces'] == 0) { $this->debug("USPS ERROR: No weight set."); return false; } |
|
299 |
if($attribs['pounds'] + $attribs['ounces'] == 0) { $this->debug("USPS ERROR: No weight set."); return false; } |
307 |
|
|
300 |
|
308 |
|
|
301 |
|
309 |
//Check container for Express and Priority |
|
302 |
//Check container for Express and Priority |
|
|
<> |
303 |
|
310 |
if(strtolower($attribs['service']) == 'express' || strtolower($attribs['service']) == 'priority') |
|
304 |
if(strtolower($attribs['service']) == 'express' || strtolower($attribs['service']) == 'priority') { |
311 |
{ |
|
305 |
if(!isset($attribs['container'])) { |
312 |
if(!isset($attribs['container'])) { $this->debug("USPS ERROR: Container for express or priority post was not set."); return false; } |
|
306 |
$this->debug("USPS ERROR: Container for express or priority post was not set."); return false; |
313 |
else { |
|
307 |
} else { |
314 |
switch(strtolower($attribs['container'])) |
|
308 |
switch(strtoupper($attribs['container'])) { |
315 |
{ |
|
309 |
case 'VARIABLE': |
316 |
case 'flat rate envelope': |
|
310 |
case 'FLAT RATE BOX': |
|
|
|
311 |
case 'FLAT RATE ENVELOPE': |
317 |
case 'flat rate box': |
|
312 |
case 'RECTANGULAR': |
|
|
|
313 |
case 'NONRECTANGULAR': |
318 |
break; |
= |
314 |
break; |
319 |
default: |
|
315 |
default: |
320 |
$this->debug("USPS ERROR: Container not recognised."); |
<> |
316 |
$this->debug("USPS ERROR: Container not recognised for ".$attribs['service']."."); |
321 |
return false; |
= |
317 |
return false; |
322 |
} |
|
318 |
} |
323 |
} |
|
319 |
} |
324 |
} |
<> |
320 |
} |
325 |
|
|
321 |
|
326 |
//Check size |
= |
322 |
//Check size |
327 |
if(!$attribs['size']) return false; |
<> |
323 |
if(!$attribs['size']) { |
|
|
|
324 |
return false; |
328 |
else { |
|
325 |
} else { |
329 |
switch(strtolower($attribs['size'])) |
|
326 |
switch(strtolower($attribs['size'])){ |
330 |
{ |
|
|
|
331 |
case 'regular': |
= |
327 |
case 'regular': |
332 |
case 'large': |
|
328 |
case 'large': |
333 |
case 'oversize': |
|
329 |
case 'oversize': |
334 |
break; |
|
330 |
break; |
335 |
default: |
|
331 |
default: |
336 |
$this->debug("USPS ERROR: Size not recognised."); |
|
332 |
$this->debug("USPS ERROR: Size not recognised."); |
337 |
return false; |
|
333 |
return false; |
338 |
} |
|
334 |
} |
339 |
} |
|
335 |
} |
340 |
|
|
336 |
|
341 |
//Check machinable for parcel post |
<> |
|
|
342 |
if(strtolower($attribs['service']) == 'parcel') { |
|
|
|
343 |
if(empty($attribs['machinable'])) { $this->debug("USPS ERROR: Machinable variable for parcel service not set."); return false; } |
|
|
|
344 |
} |
|
|
|
345 |
|
|
|
|
346 |
//Add the package to the XML request |
= |
337 |
//Add the package to the XML request |
347 |
$this->request_xml .= '<Package ID="' . $this->package_index . '">'; |
|
338 |
$this->request_xml .= '<Package ID="' . $this->package_index . '">'; |
348 |
|
|
339 |
|
349 |
$this->package_index++; |
|
340 |
$this->package_index++; |
350 |
|
|
341 |
|
351 |
$this->request_xml .= '<Service>' . strtoupper($attribs['service']) . '</Service>'; |
|
342 |
$this->request_xml .= '<Service>' . strtoupper($attribs['service']) . '</Service>'; |
|
|
<> |
343 |
|
|
|
|
344 |
if(strtolower($attribs['service']) == 'first class') { |
|
|
|
345 |
$this->request_xml .= '<FirstClassMailType>' . $attribs['first_class_mail_type'] . '</FirstClassMailType>'; |
|
|
|
346 |
} |
352 |
$this->request_xml .= '<ZipOrigination>' . $attribs['zip_origin'] . '</ZipOrigination>'; |
|
347 |
$this->request_xml .= '<ZipOrigination>' . substr(trim($attribs['zip_origin']),0,5) . '</ZipOrigination>'; |
353 |
$this->request_xml .= '<ZipDestination>' . $attribs['zip_dest'] . '</ZipDestination>'; |
|
348 |
$this->request_xml .= '<ZipDestination>' . substr(trim($attribs['zip_dest']),0,5) . '</ZipDestination>'; |
354 |
$this->request_xml .= '<Pounds>' . $attribs['pounds'] . '</Pounds>'; |
= |
349 |
$this->request_xml .= '<Pounds>' . $attribs['pounds'] . '</Pounds>'; |
355 |
$this->request_xml .= '<Ounces>' . $attribs['ounces'] . '</Ounces>'; |
|
350 |
$this->request_xml .= '<Ounces>' . $attribs['ounces'] . '</Ounces>'; |
|
|
-+ |
351 |
$this->request_xml .= '<Container>' . strtoupper($attribs['container']) . '</Container>'; |
|
|
|
352 |
$this->request_xml .= '<Size>' . ucfirst(strtolower($attribs['size'])) . '</Size>'; |
356 |
|
= |
353 |
|
357 |
if(strtolower($attribs['service']) == 'express' || strtolower($attribs['service']) == 'priority') { |
<> |
354 |
if(strtolower($attribs['service']) == 'priority' && strtolower($attribs['size']) == 'large') { |
358 |
|
= |
355 |
|
|
|
<> |
356 |
$this->request_xml .= '<Width>' .$attribs['width']. '</Width>'; |
|
|
|
357 |
$this->request_xml .= '<Length>' .$attribs['length']. '</Length>'; |
|
|
|
358 |
$this->request_xml .= '<Height>' .$attribs['height']. '</Height>'; |
|
|
|
359 |
if(empty($attribs['width']) || empty($attribs['length']) || empty($attribs['height'])) { $this->debug("USPS ERROR: Width, length & height for nonrectangular or rectangular priority mail not set."); return false; } |
|
|
|
360 |
|
|
|
|
361 |
if($attribs['container'] == "NONRECTANGULAR") { |
359 |
$this->request_xml .= '<Container>' . $attribs['container'] . '</Container>'; |
|
362 |
$this->request_xml .= '<Girth>' .$attribs['girth']. '</Girth>'; |
|
|
|
363 |
if(empty($attribs['girth'])) { $this->debug("USPS ERROR: Girth for nonrectangular priority mail not set."); return false; } |
|
|
|
364 |
} |
360 |
|
= |
365 |
|
361 |
} |
|
366 |
} |
362 |
|
|
367 |
|
363 |
$this->request_xml .= '<Size>' . ucfirst(strtolower($attribs['size'])) . '</Size>'; |
<> |
368 |
if(strtolower($attribs['service']) == 'all' || strtolower($attribs['service']) == 'parcel' || (strtolower($attribs['service']) == 'first class' && $attribs['first_class_mail_type'] == 'LETTER') || strtolower($attribs['service']) == 'first class' && $attribs['first_class_mail_type'] == 'FLAT') { |
364 |
|
|
|
|
365 |
if(strtolower($attribs['service']) == 'parcel' || strtolower($attribs['service']) == 'all') { |
|
|
|
366 |
|
= |
369 |
|
|
|
-+ |
370 |
if(empty($attribs['machinable'])) { |
|
|
|
371 |
$this->debug("USPS ERROR: Machinable variable for parcel service not set."); return false; |
|
|
|
372 |
} |
367 |
$this->request_xml .= '<Machinable>' . $attribs['machinable'] . '</Machinable>'; |
= |
373 |
$this->request_xml .= '<Machinable>' . $attribs['machinable'] . '</Machinable>'; |
368 |
} |
|
374 |
} |
369 |
|
|
375 |
|
370 |
$this->request_xml .= '</Package>'; |
|
376 |
$this->request_xml .= '</Package>'; |
371 |
|
<> |
377 |
|
|
|
|
378 |
} elseif($this->api == 'IntlRate') { |
372 |
|
= |
379 |
|
373 |
|
<> |
380 |
if(!isset($attribs['pounds'])) { |
374 |
} |
|
381 |
$this->debug("USPS ERROR: International pounds not set."); |
375 |
|
|
382 |
return false; |
376 |
else if($this->api == 'IntlRate') |
|
|
|
377 |
{ |
|
383 |
} |
378 |
|
= |
384 |
|
379 |
//if(!$attribs['pounds']) { $this->debug("USPS ERROR: International pounds not set."); return false; } |
<> |
385 |
if(!isset($attribs['ounces'])) { |
380 |
//if(!$attribs['ounces']) { $this->debug("USPS ERROR: International ounces not set."); return false; } |
|
386 |
$this->debug("USPS ERROR: International ounces not set."); |
|
|
|
387 |
return false; |
|
|
|
388 |
} |
381 |
|
= |
389 |
|
382 |
if(!$attribs['mail_type']) { $this->debug("USPS ERROR: International mail type not set."); return false; } |
<> |
390 |
if(!$attribs['mail_type']) { |
|
|
|
391 |
$this->debug("USPS ERROR: International mail type not set."); |
|
|
|
392 |
return false; |
383 |
else { |
|
393 |
} else { |
384 |
switch(strtolower($attribs['mail_type'])) |
|
394 |
switch(strtolower($attribs['mail_type'])) { |
385 |
{ |
|
|
|
386 |
case 'package': |
= |
395 |
case 'package': |
387 |
case 'postcards or aerogrammes': |
|
396 |
case 'postcards or aerogrammes': |
388 |
case 'matter for the blind': |
|
397 |
case 'matter for the blind': |
389 |
case 'envelope': |
|
398 |
case 'envelope': |
390 |
break; |
|
399 |
break; |
391 |
default: |
|
400 |
default: |
392 |
$this->debug("USPS ERROR: Mail type not recognised."); |
|
401 |
$this->debug("USPS ERROR: Mail type not recognised."); |
393 |
return false; |
|
402 |
return false; |
394 |
} |
|
403 |
} |
395 |
} |
|
404 |
} |
396 |
|
|
405 |
|
397 |
if(!isset($attribs['country'])) { $this->debug("USPS ERROR: Country not set."); return false; } |
<> |
406 |
if(!isset($attribs['country'])) { |
|
|
|
407 |
$this->debug("USPS ERROR: Country not set."); |
|
|
|
408 |
return false; |
|
|
|
409 |
} |
398 |
if(!in_array($attribs['country'], $this->country_list)) { return false; } |
|
410 |
if(!in_array($attribs['country'], $this->country_list)) { |
|
|
|
411 |
return false; |
|
|
|
412 |
} |
399 |
|
= |
413 |
|
400 |
//Add the package to the XML request |
|
414 |
//Add the package to the XML request |
401 |
$this->request_xml .= '<Package ID="' . $this->package_index . '">'; |
|
415 |
$this->request_xml .= '<Package ID="' . $this->package_index . '">'; |
402 |
$this->package_index++; |
|
416 |
$this->package_index++; |
403 |
$this->request_xml .= '<Pounds>' . $attribs['pounds'] . '</Pounds>'; |
|
417 |
$this->request_xml .= '<Pounds>' . $attribs['pounds'] . '</Pounds>'; |
404 |
$this->request_xml .= '<Ounces>' . $attribs['ounces'] . '</Ounces>'; |
|
418 |
$this->request_xml .= '<Ounces>' . $attribs['ounces'] . '</Ounces>'; |
405 |
$this->request_xml .= '<MailType>' . $attribs['mail_type'] . '</MailType>'; |
|
419 |
$this->request_xml .= '<MailType>' . $attribs['mail_type'] . '</MailType>'; |
|
|
-+ |
420 |
$this->request_xml .= '<ValueOfContents>' .$attribs['value'] . '</ValueOfContents>'; |
406 |
$this->request_xml .= '<Country>' . $attribs['country'] . '</Country>'; |
= |
421 |
$this->request_xml .= '<Country>' . $attribs['country'] . '</Country>'; |
407 |
$this->request_xml .= '</Package>'; |
|
422 |
$this->request_xml .= '</Package>'; |
408 |
} |
|
423 |
} |
409 |
|
|
424 |
|
410 |
return true; |
|
425 |
return true; |
411 |
} |
|
426 |
} |
412 |
|
|
427 |
|
413 |
function submit_request() |
<> |
428 |
function submit_request() { |
414 |
{ |
|
|
|
415 |
global $module; |
= |
429 |
global $module; |
416 |
require_once("xmlize.inc.php"); |
|
430 |
require_once("xmlize.inc.php"); |
417 |
|
|
431 |
|
418 |
$this->request_xml .= '</' . $this->api . 'Request>'; |
|
432 |
$this->request_xml .= '</' . $this->api . 'Request>'; |
419 |
|
|
433 |
|
420 |
//Create a cURL instance and retrieve XML response |
|
434 |
//Create a cURL instance and retrieve XML response |
421 |
if(!is_callable("curl_exec")) die("USPS::submit_request: curl_exec is uncallable"); |
|
435 |
if(!is_callable("curl_exec")) die("USPS::submit_request: curl_exec is uncallable"); |
422 |
|
|
436 |
|
|
|
-+ |
437 |
/* |
423 |
if($module['test']==1){ |
= |
438 |
if($module['test']==1){ |
424 |
$USPSURL = "http://testing.shippingapis.com/ShippingAPITest.dll"; |
<> |
439 |
$USPSURL = "http://testing.shippingapis.com/ShippingAPI.dll"; |
|
|
|
440 |
//$USPSURL = "http://stg-production.shippingapis.com/shippingapi.dll"; |
425 |
} else { |
= |
441 |
} else { |
426 |
$USPSURL = "http://production.shippingapis.com/ShippingAPI.dll"; |
|
442 |
$USPSURL = "http://production.shippingapis.com/ShippingAPI.dll"; |
427 |
} |
|
443 |
} |
|
|
-+ |
444 |
*/ |
|
|
|
445 |
|
|
|
|
446 |
$USPSURL = "http://production.shippingapis.com/ShippingAPI.dll"; |
|
|
|
447 |
|
428 |
$ch = curl_init($USPSURL); |
= |
448 |
$ch = curl_init($USPSURL); |
429 |
curl_setopt($ch, CURLOPT_POST, 1); |
|
449 |
curl_setopt($ch, CURLOPT_POST, 1); |
430 |
curl_setopt($ch, CURLOPT_POSTFIELDS, "API=" . $this->api . "&XML=" . $this->request_xml); |
|
450 |
curl_setopt($ch, CURLOPT_POSTFIELDS, "API=" . $this->api . "&XML=" . $this->request_xml); |
431 |
curl_setopt($ch, CURLOPT_TIMEOUT, 60); |
|
451 |
curl_setopt($ch, CURLOPT_TIMEOUT, 60); |
432 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
452 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
433 |
|
|
453 |
|
434 |
$return_xml = curl_exec($ch); |
|
454 |
$return_xml = curl_exec($ch); |
435 |
|
|
455 |
|
436 |
if(eregi("Authorization failure",$return_xml)){ |
|
456 |
if(eregi("Authorization failure",$return_xml)){ |
437 |
|
|
457 |
|
438 |
echo "<strong>Authorization Error connecting to United States Postal Service Server:</strong> ".$USPSURL."<p>Please register at <a href='http://www.usps.com/webtools/'>http://www.usps.com/webtools/</a> and enter the correct username and password in the CubeCart control panel. You MUST have a successful test transaction before USPS will give you access to the live server.</p> |
<> |
458 |
echo "<strong>Authorization Error connecting to United States Postal Service Server:</strong> ".$USPSURL."<p>Please register at <a href='http://www.usps.com/webtools/'>http://www.usps.com/webtools/</a> and enter the correct username and password in the CubeCart control panel. Please also make sure that USPS has granted your account access to the 'production server'.</p> |
439 |
<p>Please go back and verify your login information. Remember, you must have your USPS issued username entered and <i>something</i> in the password box.</p>"; |
= |
459 |
<p>Please go back and verify your login information. Remember, you must have your USPS issued username entered and <i>something</i> in the password box.</p>"; |
440 |
exit; |
|
460 |
exit; |
441 |
|
|
461 |
|
442 |
} elseif(eregi("error",$return_xml)){ |
<> |
462 |
} elseif(eregi("error",$return_xml) && !eregi("Service not available.",$return_xml)){ |
443 |
|
= |
463 |
|
444 |
echo "<strong>Request XML:</strong><hr />".nl2br(htmlspecialchars($this->request_xml))."<hr />"; |
|
464 |
echo "<strong>Request XML:</strong><hr />".nl2br(htmlspecialchars($this->request_xml))."<hr />"; |
445 |
echo "<strong>Return XML:</strong><hr />".nl2br(htmlspecialchars($return_xml)); |
|
465 |
echo "<strong>Return XML:</strong><hr />".nl2br(htmlspecialchars($return_xml)); |
446 |
exit; |
<> |
466 |
//exit; |
447 |
|
= |
467 |
|
448 |
} |
|
468 |
} |
449 |
|
|
469 |
|
450 |
//The return XML will be parsed with XMLIZE into the $xml array |
|
470 |
//The return XML will be parsed with XMLIZE into the $xml array |
451 |
|
|
471 |
|
452 |
$xml = xmlize($return_xml); |
|
472 |
$xml = xmlize($return_xml); |
|
455 |
# print_r($xml); |
= |
475 |
# print_r($xml); |
456 |
# echo "\n</pre>\n"; |
|
476 |
# echo "\n</pre>\n"; |
457 |
# traverse_xmlize($xml, 'xml_'); |
|
477 |
# traverse_xmlize($xml, 'xml_'); |
458 |
# print '<pre>' . implode("", $GLOBALS['traverse_array']) . '</pre>'; |
|
478 |
# print '<pre>' . implode("", $GLOBALS['traverse_array']) . '</pre>'; |
459 |
|
|
479 |
|
460 |
|
|
480 |
|
461 |
if(isset($xml['RateV2Response'])) |
<> |
481 |
if(isset($xml['RateV3Response'])){ |
462 |
{ |
|
|
|
463 |
//Domestic return data needs to be parsed differently from international data |
= |
482 |
//Domestic return data needs to be parsed differently from international data |
464 |
|
|
483 |
|
465 |
$package_id = 0; |
|
484 |
$package_id = 0; |
466 |
|
|
485 |
|
467 |
if(isset($xml['RateV2Response']['#']['Package']['0']['#']['Error'])) |
<> |
486 |
if(isset($xml['RateV3Response']['#']['Package']['0']['#']['Error'])){ |
468 |
{ |
|
|
|
469 |
$x_errorDesc = $xml['RateV2Response']['#']['Package']['#']['Error']; |
|
487 |
$x_errorDesc = $xml['RateV3Response']['#']['Package']['#']['Error']; |
470 |
$this->current_result[$package_id]['Error']['Description'] = $x_errorDesc; |
= |
488 |
$this->current_result[$package_id]['Error']['Description'] = $x_errorDesc; |
471 |
} |
<> |
|
|
472 |
else if(isset($xml['RateV2Response']['#']['Package']['0']['#']['ZipOrigination'])) |
|
489 |
} elseif(isset($xml['RateV3Response']['#']['Package']['0']['#']['ZipOrigination'])) { |
473 |
{ |
|
|
|
474 |
$x_postage = $xml['RateV2Response']['#']['Package']['0']['#']['Postage']; |
|
490 |
$x_postage = $xml['RateV3Response']['#']['Package']['0']['#']['Postage']; |
475 |
|
= |
491 |
|
476 |
for($i=0; $i < count($x_postage); $i++) |
<> |
492 |
for($i=0; $i < count($x_postage); $i++) { |
477 |
{ |
|
|
|
478 |
$x_mailservice = $x_postage[$i]['#']['MailService']['0']['#']; |
= |
493 |
$x_mailservice = $x_postage[$i]['#']['MailService']['0']['#']; |
479 |
$x_rate = $x_postage[$i]['#']['Rate']['0']['#']; |
|
494 |
$x_rate = $x_postage[$i]['#']['Rate']['0']['#']; |
480 |
|
|
495 |
|
481 |
# echo "MailService = ".$x_mailservice."<br>"; |
|
496 |
# echo "MailService = ".$x_mailservice."<br>"; |
482 |
# echo "Rate = ".$x_rate."<br>"; |
|
497 |
# echo "Rate = ".$x_rate."<br>"; |
483 |
|
|
498 |
|
484 |
$this->current_result[$package_id]['Postage'][$x_mailservice] = $x_rate; |
|
499 |
$this->current_result[$package_id]['Postage'][$x_mailservice] = $x_rate; |
485 |
} |
|
500 |
} |
486 |
} |
|
501 |
} |
487 |
} |
<> |
|
|
488 |
|
|
|
|
489 |
else if(isset($xml['IntlRateResponse'])) |
|
502 |
} elseif(isset($xml['IntlRateResponse'])) { |
490 |
{ |
|
|
|
491 |
//This is international data, so parse it accordingly |
= |
503 |
//This is international data, so parse it accordingly |
492 |
|
|
504 |
|
493 |
$package_id = 0; |
|
505 |
$package_id = 0; |
494 |
|
|
506 |
|
495 |
if(isset($xml['IntlRateResponse']['#']['Package']['0']['#']['Error'])) |
<> |
507 |
if(isset($xml['IntlRateResponse']['#']['Package']['0']['#']['Error'])) { |
496 |
{ |
|
|
|
497 |
$x_errorDesc = $xml['IntlRateResponse']['#']['Package']['#']['Error']; |
= |
508 |
$x_errorDesc = $xml['IntlRateResponse']['#']['Package']['#']['Error']; |
498 |
$this->current_result[$package_id]['Error']['Description'] = $x_errorDesc; |
|
509 |
$this->current_result[$package_id]['Error']['Description'] = $x_errorDesc; |
499 |
} |
<> |
|
|
500 |
else if(isset($xml['IntlRateResponse'])) |
|
510 |
} elseif(isset($xml['IntlRateResponse'])) { |
501 |
{ |
|
|
|
502 |
$x_postage = $xml['IntlRateResponse']['#']['Package']['0']['#']['Service']; |
= |
511 |
$x_postage = $xml['IntlRateResponse']['#']['Package']['0']['#']['Service']; |
503 |
|
|
512 |
|
504 |
for($i=0; $i < count($x_postage); $i++) |
<> |
513 |
for($i=0; $i < count($x_postage); $i++) { |
505 |
{ |
|
|
|
506 |
$x_mailservice = $x_postage[$i]['#']['SvcDescription']['0']['#']; |
= |
514 |
$x_mailservice = $x_postage[$i]['#']['SvcDescription']['0']['#']; |
507 |
$x_rate = $x_postage[$i]['#']['Postage']['0']['#']; |
|
515 |
$x_rate = $x_postage[$i]['#']['Postage']['0']['#']; |
508 |
|
|
516 |
|
509 |
# echo "MailService = ".$x_mailservice."<br>"; |
|
517 |
# echo "MailService = ".$x_mailservice."<br>"; |
510 |
# echo "Rate = ".$x_rate."<br>"; |
|
518 |
# echo "Rate = ".$x_rate."<br>"; |
511 |
|
|
519 |
|
|
514 |
} |
= |
522 |
} |
515 |
} |
|
523 |
} |
516 |
|
|
524 |
|
517 |
return true; |
|
525 |
return true; |
518 |
} |
|
526 |
} |
519 |
|
|
527 |
|
520 |
function get_rates($package_id = 0) |
<> |
528 |
function get_rates($package_id = 0) { |
521 |
{ |
|
|
|
522 |
if($this->current_result[$package_id]['Error']) return $this->current_result[$package_id]['Error']['Description']; |
= |
529 |
if($this->current_result[$package_id]['Error']) return $this->current_result[$package_id]['Error']['Description']; |
523 |
|
|
530 |
|
524 |
# if($this->api == 'RateV2') |
<> |
531 |
# if($this->api == 'RateV3') { |
525 |
return $this->current_result[$package_id]['Postage']; |
= |
532 |
return $this->current_result[$package_id]['Postage']; |
526 |
# else if($this->api == 'IntlRate') |
<> |
533 |
# } elseif($this->api == 'IntlRate') { |
527 |
# { |
|
|
|
528 |
//SvcDescription and Postage |
= |
534 |
//SvcDescription and Postage |
529 |
# $result = array(); |
|
535 |
# $result = array(); |
530 |
|
|
536 |
|
531 |
# foreach($this->current_result[$package_id]['Service'] as $service) |
<> |
537 |
# foreach($this->current_result[$package_id]['Service'] as $service){ |
532 |
# { |
|
|
|
533 |
# $key = $service['SvcDescription']; |
= |
538 |
# $key = $service['SvcDescription']; |
534 |
# $result[$key] = $service['Postage']; |
|
539 |
# $result[$key] = $service['Postage']; |
535 |
# } |
|
540 |
# } |
536 |
|
|
541 |
|
537 |
return $result; |
|
542 |
return $result; |
538 |
# } |
|
543 |
# } |
539 |
# else return false; |
|
544 |
# else return false; |
540 |
} |
|
545 |
} |
541 |
|
|
546 |
|
542 |
function get_prohibitions($package_id) |
<> |
547 |
function get_prohibitions($package_id) { |
543 |
{ |
|
|
|
544 |
if($this->api == 'IntlRate') return $this->current_result[$package_id]['Prohibitions']; |
= |
548 |
if($this->api == 'IntlRate') return $this->current_result[$package_id]['Prohibitions']; |
545 |
else return false; |
|
549 |
else return false; |
546 |
} |
|
550 |
} |
547 |
|
|
551 |
|
548 |
function get_restrictions($package_id) |
<> |
552 |
function get_restrictions($package_id) { |
549 |
{ |
|
|
|
550 |
if($this->api == 'IntlRate') return $this->current_result[$package_id]['Restrictions']; |
= |
553 |
if($this->api == 'IntlRate') return $this->current_result[$package_id]['Restrictions']; |
551 |
else return false; |
|
554 |
else return false; |
552 |
} |
|
555 |
} |
553 |
|
|
556 |
|
554 |
function get_observations($package_id) |
<> |
557 |
function get_observations($package_id) { |
555 |
{ |
|
|
|
556 |
if($this->api == 'IntlRate') return $this->current_result[$package_id]['Observations']; |
= |
558 |
if($this->api == 'IntlRate') return $this->current_result[$package_id]['Observations']; |
557 |
else return false; |
|
559 |
else return false; |
558 |
} |
|
560 |
} |
559 |
|
|
561 |
|
560 |
function get_areas_served($package_id) |
<> |
562 |
function get_areas_served($package_id) { |
561 |
{ |
|
|
|
562 |
if($this->api == 'IntlRate') return $this->current_result[$package_id]['AreasServed']; |
= |
563 |
if($this->api == 'IntlRate') return $this->current_result[$package_id]['AreasServed']; |
563 |
else return false; |
|
564 |
else return false; |
564 |
} |
|
565 |
} |
565 |
|
|
566 |
|
566 |
function get_package_error($package_id) |
<> |
567 |
function get_package_error($package_id) { |
567 |
{ |
|
|
|
568 |
if($this->current_result[$package_id]['Error']) return $this->current_result[$package_id]['Error']; |
= |
568 |
if($this->current_result[$package_id]['Error']) return $this->current_result[$package_id]['Error']; |
569 |
} |
|
569 |
} |
570 |
} |
|
570 |
} |
571 |
|
|
571 |
|
572 |
?> |
|
572 |
?> |