lib/custom/src/MShop/Service/Provider/Payment/OmniPay.php
public function refund( \Aimeos\MShop\Order\Item\Iface $order )
	{
		$provider = $this->getProvider();

		if( !$provider->supportsRefund() ) {
			return;
		}

		$base = $this->getOrderBase( $order->getBaseId() );
		$type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT;
		$service = $this->getBasketService( $base, $type, $this->getServiceItem()->getCode() );

		$data = array(
			'transactionReference' => $this->getTransactionReference( $base ),
			'currency' => $base->getPrice()->getCurrencyId(),
			'amount' => $this->getAmount( $base->getPrice() ),
			'transactionId' => $order->getId(),
		);

		$response = $provider->refund( $data )->send();

		if( $response->isSuccessful() )
		{
			$attr = array( 'REFUNDID' => $response->getTransactionReference() );
			$this->setAttributes( $service, $attr, 'payment/omnipay' );
			$this->saveOrderBase( $base );

			$status = \Aimeos\MShop\Order\Item\Base::PAY_REFUND;
			$order->setPaymentStatus( $status );
			$this->saveOrder( $order );
		}
	}
public function refund( \Aimeos\MShop\Order\Item\Iface $order )
	{
		$provider = $this->getProvider();

		if( !$provider->supportsRefund() ) {
			return;
		}

		$base = $this->getOrderBase( $order->getBaseId() );
		$type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT;
		$service = $this->getBasketService( $base, $type, $this->getServiceItem()->getCode() );

		$data = array(
			'transactionReference' => $this->getTransactionReference( $base ),
			'currency' => $base->getPrice()->getCurrencyId(),
			'amount' => $this->getAmount( $base->getPrice() ),
			'transactionId' => $order->getId(),
		);

		$response = $provider->refund( $data )->send();

		if( $response->isSuccessful() )
		{
			$attr = array( 'REFUNDID' => $response->getTransactionReference() );
			$this->setAttributes( $service, $attr, 'payment/omnipay' );
			$this->saveOrderBase( $base );

			$status = \Aimeos\MShop\Order\Item\Base::PAY_REFUND;
			$order->setPaymentStatus( $status );
			$this->saveOrder( $order );
		}
	}
Refunds the money for the given order if supported.

@param \Aimeos\MShop\Order\Item\Iface $order Order invoice object