for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Copyright © Getnet. All rights reserved.
*
* @author Bruno Elisei <[email protected]>
* See LICENSE for license details.
*/
namespace Getnet\PaymentMagento\Gateway\Request;
use InvalidArgumentException;
use Magento\Payment\Gateway\Data\PaymentDataObjectInterface;
use Magento\Payment\Gateway\Request\BuilderInterface;
* Class External Payment Id - Payment Id structure.
class ExtPaymentIdRequest implements BuilderInterface
{
* @var string
public const GETNET_PAYMENT_ID = 'payment_id';
* Build.
* @param array $buildSubject
public function build(array $buildSubject)
if (!isset($buildSubject['payment'])
|| !$buildSubject['payment'] instanceof PaymentDataObjectInterface
) {
throw new InvalidArgumentException('Payment data object should be provided');
}
$paymentDO = $buildSubject['payment'];
$payment = $paymentDO->getPayment();
return [
self::GETNET_PAYMENT_ID => $payment->getLastTransId(),
];