Skip to content

Commit 068ef60

Browse files
committed
MC-36554: Customer should be able to re-use the payflowPro_cc_vault as payment method for subsequent orders
- added integration test to cover pay with vault use case
1 parent e5110e0 commit 068ef60

File tree

2 files changed

+403
-0
lines changed

2 files changed

+403
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\PaypalGraphQl\Model;
9+
10+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
11+
use Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderInterface;
12+
13+
/**
14+
* Get payment additional data for Payflow pro payment
15+
*/
16+
class PayflowProCcVaultAdditionalDataProvider implements AdditionalDataProviderInterface
17+
{
18+
private const PATH_ADDITIONAL_DATA = 'payflowpro_cc_vault';
19+
/**
20+
* Format Payflow input into value expected when setting payment method
21+
*
22+
* @param array $args
23+
* @return array
24+
*/
25+
public function getData(array $args): array
26+
{
27+
if (!isset($args[self::PATH_ADDITIONAL_DATA])) {
28+
throw new GraphQlInputException(
29+
__('Required parameter "payflowpro_cc_vault" for "payment_method" is missing.')
30+
);
31+
}
32+
33+
if (!isset($args[self::PATH_ADDITIONAL_DATA]['public_hash'])) {
34+
throw new GraphQlInputException(
35+
__('Required parameter "public_hash" for "payflowpro_cc_vault" is missing.')
36+
);
37+
}
38+
39+
return $args[self::PATH_ADDITIONAL_DATA];
40+
}
41+
}

0 commit comments

Comments
 (0)