Code Duplication    Length = 14-16 lines in 2 locations

src/merchants/webmoney/WebmoneyMerchant.php 1 location

@@ 68-81 (lines=14) @@
65
     * @param array $data
66
     * @return CompletePurchaseResponse
67
     */
68
    public function completePurchase($data)
69
    {
70
        /** @var \Omnipay\WebMoney\Message\CompletePurchaseResponse $response */
71
        $response = $this->gateway->completePurchase($data)->send();
72
73
        return (new CompletePurchaseResponse())
74
            ->setIsSuccessful($response->isSuccessful())
75
            ->setAmount($this->moneyParser->parse($response->getAmount(), $response->getCurrency()))
76
            ->setFee(new Money(0, new Currency($response->getCurrency())))
77
            ->setTransactionReference($response->getTransactionReference())
78
            ->setTransactionId($response->getTransactionId())
79
            ->setPayer($response->getData()['LMI_PAYER_PURSE'])
80
            ->setTime(new \DateTime($response->getData()['LMI_SYS_TRANS_DATE']));
81
    }
82
}
83

src/merchants/yandex/YandexP2pMerchant.php 1 location

@@ 66-81 (lines=16) @@
63
     * @param array $data
64
     * @return CompletePurchaseResponse
65
     */
66
    public function completePurchase($data)
67
    {
68
        /** @var \Omnipay\YandexMoney\Message\p2p\CompletePurchaseResponse $response */
69
        $response = $this->gateway->completePurchase($data)->send();
70
71
        return (new CompletePurchaseResponse())
72
            ->setIsSuccessful($response->isSuccessful())
73
            ->setAmount($this->moneyParser->parse($response->getAmount(), $response->getCurrency()))
74
            ->setTransactionReference($response->getTransactionReference())
75
            ->setTransactionId($response->getTransactionId())
76
            ->setPayer($response->getData()['sender'] ?? $response->getData()['email'] ?? '')
77
            ->setTime(
78
                (new \DateTime($response->getTime(), new \DateTimeZone('Europe/Moscow')))
79
                    ->setTimezone(new \DateTimeZone('UTC'))
80
            );
81
    }
82
}
83