lib/custom/src/MShop/Service/Provider/Payment/OmniPay.php
public function updateSync( \Psr\Http\Message\ServerRequestInterface $request, \Aimeos\MShop\Order\Item\Iface $order )
	{
		try
		{
			$provider = $this->getProvider();
			$base = $this->getOrderBase( $order->getBaseId() );

			$params = (array) $request->getAttributes() + (array) $request->getParsedBody() + (array) $request->getQueryParams();
			$params['transactionId'] = $order->getId();
			$params['transactionReference'] = $this->getTransactionReference( $base );
			$params['amount'] = $this->getAmount( $base->getPrice() );
			$params['currency'] = $base->getLocale()->getCurrencyId();
			$params['createCard'] = true;


			if( $this->getValue( 'authorize', false ) && $provider->supportsCompleteAuthorize() )
			{
				$response = $provider->completeAuthorize( $params )->send();
				$status = \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED;
			}
			elseif( $provider->supportsCompletePurchase() )
			{
				$response = $provider->completePurchase( $params )->send();
				$status = \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED;
			}
			else
			{
				return $order;
			}

			if( $response->getTransactionId() != $order->getId() ) {
				return $order;
			}

			if( method_exists( $response, 'isSuccessful' ) && $response->isSuccessful() )
			{
				$order->setPaymentStatus( $status );
			}
			elseif( method_exists( $response, 'isPending' ) && $response->isPending() )
			{
				$order->setPaymentStatus( \Aimeos\MShop\Order\Item\Base::PAY_PENDING );
			}
			elseif( method_exists( $response, 'isCancelled' ) && $response->isCancelled() )
			{
				$order->setPaymentStatus( \Aimeos\MShop\Order\Item\Base::PAY_CANCELED );
			}
			elseif( method_exists( $response, 'isRedirect' ) && $response->isRedirect() )
			{
				$url = $response->getRedirectUrl();
				throw new \Aimeos\MShop\Service\Exception( sprintf( 'Unexpected redirect: %1$s', $url ) );
			}
			else
			{
				$this->saveOrder( $order->setPaymentStatus( \Aimeos\MShop\Order\Item\Base::PAY_REFUSED ) );
				throw new \Aimeos\MShop\Service\Exception( $response->getMessage() );
			}

			$this->saveTransationRef( $base, $response->getTransactionReference() );
			$this->saveRepayData( $response, $base->getCustomerId() );
			$this->saveOrder( $order );
		}
		catch( \Exception $e )
		{
			throw new \Aimeos\MShop\Service\Exception( $e->getMessage() );
		}

		return $order;
	}
public function updateSync( \Psr\Http\Message\ServerRequestInterface $request, \Aimeos\MShop\Order\Item\Iface $order )
	{
		try
		{
			$provider = $this->getProvider();
			$base = $this->getOrderBase( $order->getBaseId() );

			$params = (array) $request->getAttributes() + (array) $request->getParsedBody() + (array) $request->getQueryParams();
			$params['transactionId'] = $order->getId();
			$params['transactionReference'] = $this->getTransactionReference( $base );
			$params['amount'] = $this->getAmount( $base->getPrice() );
			$params['currency'] = $base->getLocale()->getCurrencyId();
			$params['createCard'] = true;


			if( $this->getValue( 'authorize', false ) && $provider->supportsCompleteAuthorize() )
			{
				$response = $provider->completeAuthorize( $params )->send();
				$status = \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED;
			}
			elseif( $provider->supportsCompletePurchase() )
			{
				$response = $provider->completePurchase( $params )->send();
				$status = \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED;
			}
			else
			{
				return $order;
			}

			if( $response->getTransactionId() != $order->getId() ) {
				return $order;
			}

			if( method_exists( $response, 'isSuccessful' ) && $response->isSuccessful() )
			{
				$order->setPaymentStatus( $status );
			}
			elseif( method_exists( $response, 'isPending' ) && $response->isPending() )
			{
				$order->setPaymentStatus( \Aimeos\MShop\Order\Item\Base::PAY_PENDING );
			}
			elseif( method_exists( $response, 'isCancelled' ) && $response->isCancelled() )
			{
				$order->setPaymentStatus( \Aimeos\MShop\Order\Item\Base::PAY_CANCELED );
			}
			elseif( method_exists( $response, 'isRedirect' ) && $response->isRedirect() )
			{
				$url = $response->getRedirectUrl();
				throw new \Aimeos\MShop\Service\Exception( sprintf( 'Unexpected redirect: %1$s', $url ) );
			}
			else
			{
				$this->saveOrder( $order->setPaymentStatus( \Aimeos\MShop\Order\Item\Base::PAY_REFUSED ) );
				throw new \Aimeos\MShop\Service\Exception( $response->getMessage() );
			}

			$this->saveTransationRef( $base, $response->getTransactionReference() );
			$this->saveRepayData( $response, $base->getCustomerId() );
			$this->saveOrder( $order );
		}
		catch( \Exception $e )
		{
			throw new \Aimeos\MShop\Service\Exception( $e->getMessage() );
		}

		return $order;
	}
public function updateSync ( \ Psr \ Http \ Message \ ServerRequestInterface $ request , \ Aimeos \ MShop \ Order \ Item \ Iface $ order ) { try { $ provider = $ this -> getProvider ( ) ; $ base = $ this -> getOrderBase ( $ order -> getBaseId ( ) ) ; $ params = ( array ) $ request -> getAttributes ( ) + ( array ) $ request -> getParsedBody ( ) + ( array ) $ request -> getQueryParams ( ) ; $ params [ 'transactionId' ] = $ order -> getId ( ) ; $ params [ 'transactionReference' ] = $ this -> getTransactionReference ( $ base ) ; $ params [ 'amount' ] = $ this -> getAmount ( $ base -> getPrice ( ) ) ; $ params [ 'currency' ] = $ base -> getLocale ( ) -> getCurrencyId ( ) ; $ params [ 'createCard' ] = true ; if ( $ this -> getValue ( 'authorize' , false ) && $ provider -> supportsCompleteAuthorize ( ) ) { $ response = $ provider -> completeAuthorize ( $ params ) -> send ( ) ; $ status = \ Aimeos \ MShop \ Order \ Item \ Base :: PAY_AUTHORIZED ; } elseif ( $ provider -> supportsCompletePurchase ( ) ) { $ response = $ provider -> completePurchase ( $ params ) -> send ( ) ; $ status = \ Aimeos \ MShop \ Order \ Item \ Base :: PAY_RECEIVED ; } else { return $ order ; } if ( $ response -> getTransactionId ( ) != $ order -> getId ( ) ) { return $ order ; } if ( method_exists ( $ response , 'isSuccessful' ) && $ response -> isSuccessful ( ) ) { $ order -> setPaymentStatus ( $ status ) ; } elseif ( method_exists ( $ response , 'isPending' ) && $ response -> isPending ( ) ) { $ order -> setPaymentStatus ( \ Aimeos \ MShop \ Order \ Item \ Base :: PAY_PENDING ) ; } elseif ( method_exists ( $ response , 'isCancelled' ) && $ response -> isCancelled ( ) ) { $ order -> setPaymentStatus ( \ Aimeos \ MShop \ Order \ Item \ Base :: PAY_CANCELED ) ; } elseif ( method_exists ( $ response , 'isRedirect' ) && $ response -> isRedirect ( ) ) { $ url = $ response -> getRedirectUrl ( ) ; throw new \ Aimeos \ MShop \ Service \ Exception ( sprintf ( 'Unexpected redirect: %1$s' , $ url ) ) ; } else { $ this -> saveOrder ( $ order -> setPaymentStatus ( \ Aimeos \ MShop \ Order \ Item \ Base :: PAY_REFUSED ) ) ; throw new \ Aimeos \ MShop \ Service \ Exception ( $ response -> getMessage ( ) ) ; } $ this -> saveTransationRef ( $ base , $ response -> getTransactionReference ( ) ) ; $ this -> saveRepayData ( $ response , $ base -> getCustomerId ( ) ) ; $ this -> saveOrder ( $ order ) ; } catch ( \ Exception $ e ) { throw new \ Aimeos \ MShop \ Service \ Exception ( $ e -> getMessage ( ) ) ; } return $ order ; }
Updates the orders for whose status updates have been received by the confirmation page

@param \Psr\Http\Message\ServerRequestInterface $request Request object with parameters and request body
@param \Aimeos\MShop\Order\Item\Iface $order Order item that should be updated
@return \Aimeos\MShop\Order\Item\Iface Updated order item
@throws \Aimeos\MShop\Service\Exception If updating the orders failed
Updates the orders for whose status updates have been received by the confirmation page