Code Duplication    Length = 14-16 lines in 2 locations

src/merchants/webmoney/WebmoneyMerchant.php 1 location

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

src/merchants/yandex/YandexP2pMerchant.php 1 location

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