ext/bestitamazonpay4oxid_payment.php
public function setPrimaryAmazonUserData()
    {
        $oUtils = $this->_getContainer()->getUtils();
        $sShopSecureHomeUrl = $this->_getContainer()->getConfig()->getShopSecureHomeUrl();

        //Get primary user data from Amazon
        $oData = $this->_getContainer()->getClient()->getOrderReferenceDetails();
        $oOrderReferenceDetail = isset($oData->GetOrderReferenceDetailsResult->OrderReferenceDetails)
            ? $oData->GetOrderReferenceDetailsResult->OrderReferenceDetails : null;

        if ($oOrderReferenceDetail === null
            || isset($oOrderReferenceDetail->Destination->PhysicalDestination) === false
        ) {
            $oUtils->redirect($sShopSecureHomeUrl.'cl=user&fnc=cleanAmazonPay', false);
            return;
        }

        //Creating and(or) logging user
        $sStatus = (string)$oOrderReferenceDetail->OrderReferenceStatus->State;

        if ($sStatus === 'Draft') {
            //Manage primary user data
            $oAmazonData = $oOrderReferenceDetail->Destination->PhysicalDestination;
            $this->_managePrimaryUserData($oAmazonData);

            //Recalculate basket to get shipping price for created user
            $this->_getContainer()->getSession()->getBasket()->onUpdate();

            //Redirect with registered user or new shipping address to payment page
            $oUtils->redirect($sShopSecureHomeUrl.'cl=payment', false);
            return;
        }

        $oUtils->redirect($sShopSecureHomeUrl.'cl=user&fnc=cleanAmazonPay', false);
    }
public function setPrimaryAmazonUserData()
    {
        $oUtils = $this->_getContainer()->getUtils();
        $sShopSecureHomeUrl = $this->_getContainer()->getConfig()->getShopSecureHomeUrl();

        //Get primary user data from Amazon
        $oData = $this->_getContainer()->getClient()->getOrderReferenceDetails();
        $oOrderReferenceDetail = isset($oData->GetOrderReferenceDetailsResult->OrderReferenceDetails)
            ? $oData->GetOrderReferenceDetailsResult->OrderReferenceDetails : null;

        if ($oOrderReferenceDetail === null
            || isset($oOrderReferenceDetail->Destination->PhysicalDestination) === false
        ) {
            $oUtils->redirect($sShopSecureHomeUrl.'cl=user&fnc=cleanAmazonPay', false);
            return;
        }

        //Creating and(or) logging user
        $sStatus = (string)$oOrderReferenceDetail->OrderReferenceStatus->State;

        if ($sStatus === 'Draft') {
            //Manage primary user data
            $oAmazonData = $oOrderReferenceDetail->Destination->PhysicalDestination;
            $this->_managePrimaryUserData($oAmazonData);

            //Recalculate basket to get shipping price for created user
            $this->_getContainer()->getSession()->getBasket()->onUpdate();

            //Redirect with registered user or new shipping address to payment page
            $oUtils->redirect($sShopSecureHomeUrl.'cl=payment', false);
            return;
        }

        $oUtils->redirect($sShopSecureHomeUrl.'cl=user&fnc=cleanAmazonPay', false);
    }
public function setPrimaryAmazonUserData ( ) { $ oUtils = $ this -> _getContainer ( ) -> getUtils ( ) ; $ sShopSecureHomeUrl = $ this -> _getContainer ( ) -> getConfig ( ) -> getShopSecureHomeUrl ( ) ; //Get primary user data from Amazon $ oData = $ this -> _getContainer ( ) -> getClient ( ) -> getOrderReferenceDetails ( ) ; $ oOrderReferenceDetail = isset ( $ oData -> GetOrderReferenceDetailsResult -> OrderReferenceDetails ) ? $ oData -> GetOrderReferenceDetailsResult -> OrderReferenceDetails : null ; if ( $ oOrderReferenceDetail === null || isset ( $ oOrderReferenceDetail -> Destination -> PhysicalDestination ) === false ) { $ oUtils -> redirect ( $ sShopSecureHomeUrl . 'cl=user&fnc=cleanAmazonPay' , false ) ; return ; } //Creating and(or) logging user $ sStatus = ( string ) $ oOrderReferenceDetail -> OrderReferenceStatus -> State ; if ( $ sStatus === 'Draft' ) { //Manage primary user data $ oAmazonData = $ oOrderReferenceDetail -> Destination -> PhysicalDestination ; $ this -> _managePrimaryUserData ( $ oAmazonData ) ; //Recalculate basket to get shipping price for created user $ this -> _getContainer ( ) -> getSession ( ) -> getBasket ( ) -> onUpdate ( ) ; //Redirect with registered user or new shipping address to payment page $ oUtils -> redirect ( $ sShopSecureHomeUrl . 'cl=payment' , false ) ; return ; } $ oUtils -> redirect ( $ sShopSecureHomeUrl . 'cl=user&fnc=cleanAmazonPay' , false ) ; }
Get's primary user details and logins user if one is not logged in
Add's new address if user is logged in.
@throws Exception
Get s primary user details and logins user if one is not logged in Add s new address if user is logged in .