ext/bestitamazonpay4oxid_oxcmp_basket.php
public function cleanAmazonPay($cancelOrderReference = false)
    {
        $oConfig = $this->_getContainer()->getConfig();

        if ($cancelOrderReference === true || (bool) $oConfig->getRequestParameter('cancelOrderReference')) {
            $this->_getContainer()->getClient()->cancelOrderReference(
                null,
                array('amazon_order_reference_id' => $this->_getContainer()
                    ->getSession()
                    ->getVariable('amazonOrderReferenceId')
                )
            );
        }

        //Clean all related variables with user data and amazon reference id
        $this->_getContainer()->getModule()->cleanAmazonPay();

        $sErrorCode = (string)$oConfig->getRequestParameter('bestitAmazonPay4OxidErrorCode');
        $sErrorMessage = (string)$oConfig->getRequestParameter('error');

        if ($sErrorCode === 'CurrencyUnsupported') {
            $sError = self::BESTITAMAZONPAY_ERROR_CURRENCY_UNSUPPORTED;
        } elseif ($sErrorCode == 'InvalidParameterValue'
            && (stripos($sErrorMessage, 'presentmentCurrency') !== false
                || stripos($sErrorMessage, 'currencyCode') !== false)
        ) {
            $sError = self::BESTITAMAZONPAY_ERROR_CURRENCY_UNSUPPORTED;
        } elseif ($sErrorMessage !== '') {
            // error message directly by amazon pay
            $sError = $sErrorMessage;
        } else {
            $sError = self::BESTITAMAZONPAY_ERROR_AMAZON_TERMINATED;
        }

        /** @var oxUserException $oEx */
        $oEx = $this->_getContainer()->getObjectFactory()->createOxidObject('oxUserException');
        $oEx->setMessage($sError);
        $this->_getContainer()->getUtilsView()->addErrorToDisplay($oEx, false, true);

        //Redirect to user step
        $this->_getContainer()->getUtils()->redirect($oConfig->getShopSecureHomeUrl().'cl=basket', false);
    }
public function cleanAmazonPay($cancelOrderReference = false)
    {
        $oConfig = $this->_getContainer()->getConfig();

        if ($cancelOrderReference === true || (bool) $oConfig->getRequestParameter('cancelOrderReference')) {
            $this->_getContainer()->getClient()->cancelOrderReference(
                null,
                array('amazon_order_reference_id' => $this->_getContainer()
                    ->getSession()
                    ->getVariable('amazonOrderReferenceId')
                )
            );
        }

        //Clean all related variables with user data and amazon reference id
        $this->_getContainer()->getModule()->cleanAmazonPay();

        $sErrorCode = (string)$oConfig->getRequestParameter('bestitAmazonPay4OxidErrorCode');
        $sErrorMessage = (string)$oConfig->getRequestParameter('error');

        if ($sErrorCode === 'CurrencyUnsupported') {
            $sError = self::BESTITAMAZONPAY_ERROR_CURRENCY_UNSUPPORTED;
        } elseif ($sErrorCode == 'InvalidParameterValue'
            && (stripos($sErrorMessage, 'presentmentCurrency') !== false
                || stripos($sErrorMessage, 'currencyCode') !== false)
        ) {
            $sError = self::BESTITAMAZONPAY_ERROR_CURRENCY_UNSUPPORTED;
        } elseif ($sErrorMessage !== '') {
            // error message directly by amazon pay
            $sError = $sErrorMessage;
        } else {
            $sError = self::BESTITAMAZONPAY_ERROR_AMAZON_TERMINATED;
        }

        /** @var oxUserException $oEx */
        $oEx = $this->_getContainer()->getObjectFactory()->createOxidObject('oxUserException');
        $oEx->setMessage($sError);
        $this->_getContainer()->getUtilsView()->addErrorToDisplay($oEx, false, true);

        //Redirect to user step
        $this->_getContainer()->getUtils()->redirect($oConfig->getShopSecureHomeUrl().'cl=basket', false);
    }
public function cleanAmazonPay ( $ cancelOrderReference = false ) { $ oConfig = $ this -> _getContainer ( ) -> getConfig ( ) ; if ( $ cancelOrderReference === true || ( bool ) $ oConfig -> getRequestParameter ( 'cancelOrderReference' ) ) { $ this -> _getContainer ( ) -> getClient ( ) -> cancelOrderReference ( null , array ( 'amazon_order_reference_id' => $ this -> _getContainer ( ) -> getSession ( ) -> getVariable ( 'amazonOrderReferenceId' ) ) ) ; } //Clean all related variables with user data and amazon reference id $ this -> _getContainer ( ) -> getModule ( ) -> cleanAmazonPay ( ) ; $ sErrorCode = ( string ) $ oConfig -> getRequestParameter ( 'bestitAmazonPay4OxidErrorCode' ) ; $ sErrorMessage = ( string ) $ oConfig -> getRequestParameter ( 'error' ) ; if ( $ sErrorCode === 'CurrencyUnsupported' ) { $ sError = self :: BESTITAMAZONPAY_ERROR_CURRENCY_UNSUPPORTED ; } elseif ( $ sErrorCode == 'InvalidParameterValue' && ( stripos ( $ sErrorMessage , 'presentmentCurrency' ) !== false || stripos ( $ sErrorMessage , 'currencyCode' ) !== false ) ) { $ sError = self :: BESTITAMAZONPAY_ERROR_CURRENCY_UNSUPPORTED ; } elseif ( $ sErrorMessage !== '' ) { // error message directly by amazon pay $ sError = $ sErrorMessage ; } else { $ sError = self :: BESTITAMAZONPAY_ERROR_AMAZON_TERMINATED ; } /** @var oxUserException $oEx */ $ oEx = $ this -> _getContainer ( ) -> getObjectFactory ( ) -> createOxidObject ( 'oxUserException' ) ; $ oEx -> setMessage ( $ sError ) ; $ this -> _getContainer ( ) -> getUtilsView ( ) -> addErrorToDisplay ( $ oEx , false , true ) ; //Redirect to user step $ this -> _getContainer ( ) -> getUtils ( ) -> redirect ( $ oConfig -> getShopSecureHomeUrl ( ) . 'cl=basket' , false ) ; }
Cleans Amazon pay as the selected one, including all related variables and values

@param bool $cancelOrderReference

@throws Exception
@throws oxConnectionException
@throws oxSystemComponentException
Cleans Amazon pay as the selected one including all related variables and values