Components/AmazonPay/Plentymarkets/HandleAmazonPayPaymentCommandHandler.php
public function handle(CommandInterface $command)
    {
        /**
         * @var Payment $payment
         */
        $payment = $command->getPayload();

        /**
         * @var AmazonPayPaymentData $data
         */
        $data = $payment->getPaymentData();

        if (!($data instanceof AmazonPayPaymentData)) {
            return $this->parentCommandHandler->handle($command);
        }

        $orderIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $payment->getOrderIdentifer(),
            'objectType' => Order::TYPE,
            'adapterName' => PlentymarketsAdapter::NAME,
        ]);

        if (null === $orderIdentity) {
            throw new NotFoundException('could not find order for amazon payment handling - ' . $payment->getOrderIdentifer());
        }

        $amazonPayDataParams = [
            'key' => $data->getKey(),
            'order_reference_id' => $data->getTransactionId(),
            'order_id' => $orderIdentity->getAdapterIdentifier(),
        ];

        $this->client->request('POST', 'amazon-shopware-connect', $amazonPayDataParams, null, null, ['foreign' => true]);

        return true;
    }
public function handle(CommandInterface $command)
    {
        /**
         * @var Payment $payment
         */
        $payment = $command->getPayload();

        /**
         * @var AmazonPayPaymentData $data
         */
        $data = $payment->getPaymentData();

        if (!($data instanceof AmazonPayPaymentData)) {
            return $this->parentCommandHandler->handle($command);
        }

        $orderIdentity = $this->identityService->findOneBy([
            'objectIdentifier' => $payment->getOrderIdentifer(),
            'objectType' => Order::TYPE,
            'adapterName' => PlentymarketsAdapter::NAME,
        ]);

        if (null === $orderIdentity) {
            throw new NotFoundException('could not find order for amazon payment handling - ' . $payment->getOrderIdentifer());
        }

        $amazonPayDataParams = [
            'key' => $data->getKey(),
            'order_reference_id' => $data->getTransactionId(),
            'order_id' => $orderIdentity->getAdapterIdentifier(),
        ];

        $this->client->request('POST', 'amazon-shopware-connect', $amazonPayDataParams, null, null, ['foreign' => true]);

        return true;
    }
public function handle ( CommandInterface $ command ) { /**
         * @var Payment $payment
         */ $ payment = $ command -> getPayload ( ) ; /**
         * @var AmazonPayPaymentData $data
         */ $ data = $ payment -> getPaymentData ( ) ; if ( ! ( $ data instanceof AmazonPayPaymentData ) ) { return $ this -> parentCommandHandler -> handle ( $ command ) ; } $ orderIdentity = $ this -> identityService -> findOneBy ( [ 'objectIdentifier' => $ payment -> getOrderIdentifer ( ) , 'objectType' => Order :: TYPE , 'adapterName' => PlentymarketsAdapter :: NAME , ] ) ; if ( null === $ orderIdentity ) { throw new NotFoundException ( 'could not find order for amazon payment handling - ' . $ payment -> getOrderIdentifer ( ) ) ; } $ amazonPayDataParams = [ 'key' => $ data -> getKey ( ) , 'order_reference_id' => $ data -> getTransactionId ( ) , 'order_id' => $ orderIdentity -> getAdapterIdentifier ( ) , ] ; $ this -> client -> request ( 'POST' , 'amazon-shopware-connect' , $ amazonPayDataParams , null , null , [ 'foreign' => true ] ) ; return true ; }
{@inheritdoc}

@var TransferObjectCommand $command
{ @inheritdoc }