| Current Path : /home/rtorresani/www/vendor/paypal/module-braintree-graph-ql/Model/ |
| Current File : //home/rtorresani/www/vendor/paypal/module-braintree-graph-ql/Model/BraintreeDataProvider.php |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace PayPal\BraintreeGraphQl\Model;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderInterface;
/**
* Format Braintree input into value expected when setting payment method
*/
class BraintreeDataProvider implements AdditionalDataProviderInterface
{
private const PATH_ADDITIONAL_DATA = 'braintree';
/**
* Format Braintree input into value expected when setting payment method
*
* @param array $args
* @return array
* @throws GraphQlInputException
*/
public function getData(array $args): array
{
if (!isset($args[self::PATH_ADDITIONAL_DATA])) {
throw new GraphQlInputException(
__('Required parameter "braintree" for "payment_method" is missing.')
);
}
return $args[self::PATH_ADDITIONAL_DATA];
}
}