File: /home/petsclubcc/shop/modules/amazonpay/controllers/front/ipn.php
<?php
/**
* 2007-2021 patworx.de
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade AmazonPay to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author patworx multimedia GmbH <service@patworx.de>
* @copyright 2007-2021 patworx multimedia GmbH
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
class AmazonpayIpnModuleFrontController extends ModuleFrontController
{
/**
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
public function postProcess()
{
$ipnHandler = new AmazonPayIPNHandler();
if ($ipnHandler->isValid()) {
if ($ipnHandler->notHandledYet()) {
if ($ipnHandler->getData(AmazonPayDefinitions::IPN_NOTIFICATION_TYPE) == 'STATE_CHANGE') {
$ipnHandler->createIPNRecord();
switch (Tools::strtolower($ipnHandler->getData(AmazonPayDefinitions::IPN_OBJECT_TYPE))) {
case 'refund':
$ipnHandler->handleRefund();
break;
case 'charge':
$ipnHandler->handleCharge();
break;
}
}
}
}
exit();
}
}