http://api.1shoppingcart.com/index.php?title=OneShopNotificationListener.php&feed=atom&action=history
OneShopNotificationListener.php - Revision history
2024-03-28T10:51:55Z
Revision history for this page on the wiki
MediaWiki 1.17.0
http://api.1shoppingcart.com/index.php?title=OneShopNotificationListener.php&diff=206&oldid=prev
Chrisn at 14:12, 29 May 2008
2008-05-29T14:12:17Z
<p></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 14:12, 29 May 2008</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 3:</td>
<td colspan="2" class="diff-lineno">Line 3:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     include('../Library/OneShopAPI.php');</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     include('../Library/OneShopAPI.php');</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>     #TODO: Add your Merchant <del class="diffchange diffchange-inline">Id </del>as <del class="diffchange diffchange-inline">first parameter </del>and Merchant Key as <del class="diffchange diffchange-inline">second parameter    </del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>     # TODO: Add your Merchant <ins class="diffchange diffchange-inline">ID </ins>as <ins class="diffchange diffchange-inline">the First Parameter, </ins>and <ins class="diffchange diffchange-inline">your </ins>Merchant Key as <ins class="diffchange diffchange-inline">Second Parameter.</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     $API = new OneShopAPI("","","https://www.mcssl.com");</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     $API = new OneShopAPI("","","https://www.mcssl.com");</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>      </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>      </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     $requestBodyXML = new DOMDocument();</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     $requestBodyXML = new DOMDocument();</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>     #Load the request body into XML and check that the result has been parsed into XML</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>     # Load the request body into XML and check that the result has been parsed into XML <ins class="diffchange diffchange-inline">  </ins></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del class="diffchange diffchange-inline">    </del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     if ($requestBodyXML->loadXML($HTTP_RAW_POST_DATA) == true)</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     if ($requestBodyXML->loadXML($HTTP_RAW_POST_DATA) == true)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     {</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     {</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">        #TODO: Verify syntax to get the node name of the domdocument</del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         $notificationType = $requestBodyXML->documentElement->nodeName;   </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         $notificationType = $requestBodyXML->documentElement->nodeName;   </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         $tokenNode = $requestBodyXML->getElementsByTagName('Token')->item(0)->nodeValue;   </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         $tokenNode = $requestBodyXML->getElementsByTagName('Token')->item(0)->nodeValue;   </div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 24:</td>
<td colspan="2" class="diff-lineno">Line 22:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>              </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>              </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             default:</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             default:</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>                 #May have other types of notifications in the future</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>                 # May have other types of notifications in the future</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             break;</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             break;</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         }</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         }</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 32:</td>
<td colspan="2" class="diff-lineno">Line 30:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         if ($apiResultXML->loadXML($apiResult)==true)</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         if ($apiResultXML->loadXML($apiResult)==true)</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         {             </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         {             </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>             #Check if the API returned an error</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>             # Check if the API returned an error</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             $apiSuccess = $apiResultXML->getElementsByTagName('Response')->item(0)->getAttribute('success');</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             $apiSuccess = $apiResultXML->getElementsByTagName('Response')->item(0)->getAttribute('success');</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>            </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>            </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>           if ($apiSuccess == 'true')</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>           if ($apiSuccess == 'true')</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             {</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             {</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>                 #TODO: Do something with the <del class="diffchange diffchange-inline">apiResultXML                          </del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>                 # TODO: Do something <ins class="diffchange diffchange-inline">useful </ins>with the <ins class="diffchange diffchange-inline">XML                        </ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             }</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             else</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             else</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             {</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             {</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del class="diffchange diffchange-inline">                </del>#TODO: <del class="diffchange diffchange-inline">Alert or log that </del>the <del class="diffchange diffchange-inline">API </del>returned <del class="diffchange diffchange-inline">a success of false </del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline"> </ins># TODO: <ins class="diffchange diffchange-inline">Do something with </ins>the <ins class="diffchange diffchange-inline">error </ins>returned <ins class="diffchange diffchange-inline">by the API</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             }</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>             }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         }</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         else</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         else</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         {</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         {</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>             #TODO: Do something with the <del class="diffchange diffchange-inline">xmlErr </del>to either notify or log that the XML could not be parsed             </div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>             # TODO: Do something with the <ins class="diffchange diffchange-inline">xml error </ins>to either notify or log that the XML could not be parsed             </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         }</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     }</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     else</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     else</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     {</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     {</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>         #TODO: Do something with the <del class="diffchange diffchange-inline">xmlErr </del>to either notify or log that the XML could not be parsed </div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>         # TODO: Do something with the <ins class="diffchange diffchange-inline">xml error </ins>to either notify or log that the XML could not be parsed </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     }             </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     }             </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>?></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>?></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div></pre></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div></pre></div></td></tr>
</table>
Chrisn
http://api.1shoppingcart.com/index.php?title=OneShopNotificationListener.php&diff=188&oldid=prev
Chrisn at 20:36, 28 May 2008
2008-05-28T20:36:30Z
<p></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 20:36, 28 May 2008</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 2:</td>
<td colspan="2" class="diff-lineno">Line 2:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><?php</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div><?php</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     include('../Library/OneShopAPI.php');</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     include('../Library/OneShopAPI.php');</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>      </div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div> </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>     $API = new OneShopAPI("<del class="diffchange diffchange-inline">118303</del>","<del class="diffchange diffchange-inline">0</del>","https://www.mcssl.com");</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>     <ins class="diffchange diffchange-inline">#TODO: Add your Merchant Id as first parameter and Merchant Key as second parameter    </ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>     $API = new OneShopAPI("","","https://www.mcssl.com");</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>      </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>      </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     $requestBodyXML = new DOMDocument();</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     $requestBodyXML = new DOMDocument();</div></td></tr>
</table>
Chrisn
http://api.1shoppingcart.com/index.php?title=OneShopNotificationListener.php&diff=106&oldid=prev
Chrisn at 20:00, 26 May 2008
2008-05-26T20:00:10Z
<p></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 20:00, 26 May 2008</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 3:</td>
<td colspan="2" class="diff-lineno">Line 3:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     include('../Library/OneShopAPI.php');</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     include('../Library/OneShopAPI.php');</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>      </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>      </div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>     $API = new OneShopAPI("<del class="diffchange diffchange-inline">80086</del>","<del class="diffchange diffchange-inline">dfd9e90384e842d18c4ef74ed08a4673</del>","<del class="diffchange diffchange-inline">http</del>://<del class="diffchange diffchange-inline">localhost</del>");</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>     $API = new OneShopAPI("<ins class="diffchange diffchange-inline">118303</ins>","<ins class="diffchange diffchange-inline">0</ins>","<ins class="diffchange diffchange-inline">https</ins>://<ins class="diffchange diffchange-inline">www.mcssl.com</ins>");</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>      </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>      </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     $requestBodyXML = new DOMDocument();</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     $requestBodyXML = new DOMDocument();</div></td></tr>
</table>
Chrisn
http://api.1shoppingcart.com/index.php?title=OneShopNotificationListener.php&diff=99&oldid=prev
Chrisn: New page: <pre> <?php include('../Library/OneShopAPI.php'); $API = new OneShopAPI("80086","dfd9e90384e842d18c4ef74ed08a4673","http://localhost"); $requestBodyXML = new DOMDocum...
2008-05-26T19:44:06Z
<p>New page: <pre> <?php include('../Library/OneShopAPI.php'); $API = new OneShopAPI("80086","dfd9e90384e842d18c4ef74ed08a4673","http://localhost"); $requestBodyXML = new DOMDocum...</p>
<p><b>New page</b></p><div><pre><br />
<?php<br />
include('../Library/OneShopAPI.php');<br />
<br />
$API = new OneShopAPI("80086","dfd9e90384e842d18c4ef74ed08a4673","http://localhost");<br />
<br />
$requestBodyXML = new DOMDocument();<br />
<br />
#Load the request body into XML and check that the result has been parsed into XML<br />
<br />
if ($requestBodyXML->loadXML($HTTP_RAW_POST_DATA) == true)<br />
{<br />
#TODO: Verify syntax to get the node name of the domdocument<br />
$notificationType = $requestBodyXML->documentElement->nodeName; <br />
$tokenNode = $requestBodyXML->getElementsByTagName('Token')->item(0)->nodeValue; <br />
switch ($notificationType)<br />
{ <br />
case "NewOrder":<br />
<br />
$apiResult = $API->GetOrderById($tokenNode); <br />
<br />
break;<br />
<br />
default:<br />
#May have other types of notifications in the future<br />
break;<br />
}<br />
<br />
$apiResultXML = new DOMDocument(); <br />
<br />
if ($apiResultXML->loadXML($apiResult)==true)<br />
{ <br />
#Check if the API returned an error<br />
$apiSuccess = $apiResultXML->getElementsByTagName('Response')->item(0)->getAttribute('success');<br />
<br />
if ($apiSuccess == 'true')<br />
{<br />
#TODO: Do something with the apiResultXML <br />
}<br />
else<br />
{<br />
#TODO: Alert or log that the API returned a success of false <br />
}<br />
}<br />
else<br />
{<br />
#TODO: Do something with the xmlErr to either notify or log that the XML could not be parsed <br />
}<br />
}<br />
else<br />
{<br />
#TODO: Do something with the xmlErr to either notify or log that the XML could not be parsed <br />
} <br />
?><br />
</pre></div>
Chrisn