Code Duplication    Length = 14-16 lines in 2 locations

src/merchants/webmoney/WebmoneyMerchant.php 1 location

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

src/merchants/yandex/YandexP2pMerchant.php 1 location

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