Skip to content

Commit 73c2341

Browse files
harli91florinel-chisIvascu MadalinpeterkoppenaalBuckaroo-Rene
authored
Develop (#17)
* repo init - sample method issuers * composer.json deps * BP-1375 Retrieve extra information for payment method (#1) * BP-1375 Retrive extra information for payment method & BP-1376 setPaymentMethodOnCart support * removed fields info, declared schema for additional payment input * BP-1377 GraphQL - placeOrder method support for simple redirect methods * remove debug statements Co-authored-by: Ivascu Madalin <[email protected]> * Bp 1383 graphql front end support for idin (#2) * BP-1383 GraphQL - front end support for IDIN * correctly get idin status * change Phtase class to __() function Co-authored-by: Ivascu Madalin <[email protected]> * Bp 1378 graphql placeorder method support for inline methods (#3) * BP-1378 GraphQL - placeOrder method support for inline methods * don't need redirect url to qr code display page * forward any query parameters to the process route * remove the process interface Co-authored-by: Ivascu Madalin <[email protected]> * Added functionality for giftcard group transactions (#8) Co-authored-by: Ivascu Madalin <[email protected]> * Make sure Available buttons can be counted (#7) * BP-1508 Update Readme.md file Update the Readme file. * BP-1508 Update Readme.md file (add icons/images) Add icons/images to the Readme.md file. * Completely headless payments (#9) * Completely headless payments * changed migration name & updated readme Co-authored-by: Ivascu Madalin <[email protected]> * Update README.md add notice Add a notice and changed some letters to capital letters. * remove old method of getting order status * Added voucher mutation * Update composer with license and version * add contributing page --------- Co-authored-by: Florinel Chis <[email protected]> Co-authored-by: Ivascu Madalin <[email protected]> Co-authored-by: Peter Koppenaal <[email protected]> Co-authored-by: Rene <[email protected]> Co-authored-by: Rens Gerritsen <[email protected]> Co-authored-by: Andrei Mihalescu <[email protected]>
1 parent 340ccda commit 73c2341

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2897
-18
lines changed

CONTRIBUTING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Contribution Guidelines
2+
3+
### Repository setup:
4+
- Fork the repository to your account.
5+
- More details about [how to fork a repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) can be found [here](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo).
6+
7+
### Making changes:
8+
- Create a branch from the develop branch.
9+
- The name of the branch should be something like: `feature/GITHUB-ISSUE-ID-slug` (eg: `feature/50-configprovider-update`)
10+
- Your code changes should follow the [Magento2 coding standard](https://github.com/magento/magento-coding-standard).
11+
- Including unit tests is encouraged.
12+
13+
### Pull Request:
14+
- Open the PR to develop branch.
15+
- If there is no issue referenced, add a description about the problem and the way it is being solved.
16+
- Allow edits from maintainers.
17+
18+
19+
### Contribution to refactoring:
20+
- The branch should be created from refactoring.
21+
- Your code changes should follow the [Magento2 coding standard](https://github.com/magento/magento-coding-standard).
22+
- Include unit tests.
23+
- Open the Pull Request.
24+
- Check that git workflows checks have passed.

Model/AdditionalDataProvider.php

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
/**
4+
* NOTICE OF LICENSE
5+
*
6+
* This source file is subject to the MIT License
7+
* It is available through the world-wide-web at this URL:
8+
* https://tldrlegal.com/license/mit-license
9+
* If you are unable to obtain it through the world-wide-web, please send an email
10+
* to [email protected] so we can send you a copy immediately.
11+
*
12+
* DISCLAIMER
13+
*
14+
* Do not edit or add to this file if you wish to upgrade this module to newer
15+
* versions in the future. If you wish to customize this module for your
16+
* needs please contact [email protected] for more information.
17+
*
18+
* @copyright Copyright (c) Buckaroo B.V.
19+
* @license https://tldrlegal.com/license/mit-license
20+
*/
21+
22+
namespace Buckaroo\Magento2Graphql\Model;
23+
24+
use Buckaroo\Magento2Graphql\Plugin\AdditionalDataProviderPool;
25+
use Buckaroo\Magento2Graphql\Model\Payment\Method\ConfigFactory;
26+
use Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderInterface;
27+
28+
class AdditionalDataProvider implements AdditionalDataProviderInterface
29+
{
30+
const PAYMENT_FROM = 'buckaroo_payment_from';
31+
/**
32+
*
33+
* @var Buckaroo\Magento2Graphql\Model\Payment\Method\ConfigFactory
34+
*/
35+
protected $fieldListFactory;
36+
37+
public function __construct(ConfigFactory $fieldListFactory)
38+
{
39+
$this->fieldListFactory = $fieldListFactory;
40+
}
41+
/**
42+
* Return Additional Data,
43+
* set a flag so we know the payment originated from graphql
44+
*
45+
* @param array $args
46+
* @return array
47+
*/
48+
public function getData(array $args): array
49+
{
50+
$args[self::PAYMENT_FROM] = 'graphQl';
51+
52+
if (isset($args[AdditionalDataProviderPool::PROVIDER_KEY][$args['code']])) {
53+
54+
$additionalArgs = $args[AdditionalDataProviderPool::PROVIDER_KEY][$args['code']];
55+
unset($args[AdditionalDataProviderPool::PROVIDER_KEY]);
56+
57+
return array_merge($args, $additionalArgs);
58+
}
59+
60+
return $args;
61+
}
62+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* NOTICE OF LICENSE
4+
*
5+
* This source file is subject to the MIT License
6+
* It is available through the world-wide-web at this URL:
7+
* https://tldrlegal.com/license/mit-license
8+
* If you are unable to obtain it through the world-wide-web, please send an email
9+
* to [email protected] so we can send you a copy immediately.
10+
*
11+
* DISCLAIMER
12+
*
13+
* Do not edit or add to this file if you wish to upgrade this module to newer
14+
* versions in the future. If you wish to customize this module for your
15+
* needs please contact [email protected] for more information.
16+
*
17+
* @copyright Copyright (c) Buckaroo B.V.
18+
* @license https://tldrlegal.com/license/mit-license
19+
*/
20+
21+
namespace Buckaroo\Magento2Graphql\Model\Payment\Method;
22+
23+
use Buckaroo\Magento2\Model\ConfigProvider\Method\ConfigProviderInterface;
24+
25+
abstract class AbstractConfig
26+
{
27+
/**
28+
*
29+
* @var Buckaroo\Magento2\Model\ConfigProvider\Method\ConfigProviderInterface
30+
*/
31+
protected $configProvider;
32+
33+
public function __construct(ConfigProviderInterface $configProvider) {
34+
$this->configProvider = $configProvider;
35+
}
36+
/**
37+
* Get payment method configuration
38+
*
39+
* @return array
40+
*/
41+
public function getConfig()
42+
{
43+
return [];
44+
}
45+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* NOTICE OF LICENSE
4+
*
5+
* This source file is subject to the MIT License
6+
* It is available through the world-wide-web at this URL:
7+
* https://tldrlegal.com/license/mit-license
8+
* If you are unable to obtain it through the world-wide-web, please send an email
9+
* to [email protected] so we can send you a copy immediately.
10+
*
11+
* DISCLAIMER
12+
*
13+
* Do not edit or add to this file if you wish to upgrade this module to newer
14+
* versions in the future. If you wish to customize this module for your
15+
* needs please contact [email protected] for more information.
16+
*
17+
* @copyright Copyright (c) Buckaroo B.V.
18+
* @license https://tldrlegal.com/license/mit-license
19+
*/
20+
21+
namespace Buckaroo\Magento2Graphql\Model\Payment\Method\Config;
22+
23+
use Buckaroo\Magento2Graphql\Model\Payment\Method\AbstractConfig;
24+
25+
class Afterpay extends AbstractConfig
26+
{
27+
/**
28+
*
29+
* @var Buckaroo\Magento2\Model\ConfigProvider\Method\Afterpay
30+
*/
31+
protected $configProvider;
32+
/**
33+
* @inheritDoc
34+
*/
35+
public function getConfig()
36+
{
37+
return [
38+
[
39+
"key"=>"businessMethod",
40+
"value" => $this->configProvider->getBusiness()
41+
],
42+
[
43+
"key"=>"paymentMethod",
44+
"value" => $this->configProvider->getPaymentMethod()
45+
]
46+
];
47+
}
48+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
/**
3+
* NOTICE OF LICENSE
4+
*
5+
* This source file is subject to the MIT License
6+
* It is available through the world-wide-web at this URL:
7+
* https://tldrlegal.com/license/mit-license
8+
* If you are unable to obtain it through the world-wide-web, please send an email
9+
* to [email protected] so we can send you a copy immediately.
10+
*
11+
* DISCLAIMER
12+
*
13+
* Do not edit or add to this file if you wish to upgrade this module to newer
14+
* versions in the future. If you wish to customize this module for your
15+
* needs please contact [email protected] for more information.
16+
*
17+
* @copyright Copyright (c) Buckaroo B.V.
18+
* @license https://tldrlegal.com/license/mit-license
19+
*/
20+
21+
namespace Buckaroo\Magento2Graphql\Model\Payment\Method\Config;
22+
23+
use Buckaroo\Magento2Graphql\Model\Payment\Method\AbstractConfig;
24+
25+
class Afterpay2 extends AbstractConfig
26+
{
27+
/**
28+
* @inheritDoc
29+
*/
30+
public function getConfig()
31+
{
32+
return [
33+
[
34+
"key"=>"businessMethod",
35+
"value" => $this->configProvider->getBusiness()
36+
],
37+
[
38+
"key"=>"paymentMethod",
39+
"value" => $this->configProvider->getPaymentMethod()
40+
]
41+
];
42+
}
43+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* NOTICE OF LICENSE
4+
*
5+
* This source file is subject to the MIT License
6+
* It is available through the world-wide-web at this URL:
7+
* https://tldrlegal.com/license/mit-license
8+
* If you are unable to obtain it through the world-wide-web, please send an email
9+
* to [email protected] so we can send you a copy immediately.
10+
*
11+
* DISCLAIMER
12+
*
13+
* Do not edit or add to this file if you wish to upgrade this module to newer
14+
* versions in the future. If you wish to customize this module for your
15+
* needs please contact [email protected] for more information.
16+
*
17+
* @copyright Copyright (c) Buckaroo B.V.
18+
* @license https://tldrlegal.com/license/mit-license
19+
*/
20+
21+
namespace Buckaroo\Magento2Graphql\Model\Payment\Method\Config;
22+
23+
use Buckaroo\Magento2\Model\Config\Source\AfterpayCustomerType;
24+
use Buckaroo\Magento2Graphql\Model\Payment\Method\AbstractConfig;
25+
26+
class Afterpay20 extends AbstractConfig
27+
{
28+
/**
29+
* @inheritDoc
30+
*/
31+
public function getConfig()
32+
{
33+
return [
34+
[
35+
"key"=>"is_b2b",
36+
"value" => $this->configProvider->getCustomerType() !== AfterpayCustomerType::CUSTOMER_TYPE_B2C
37+
]
38+
];
39+
}
40+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?php
2+
3+
/**
4+
* NOTICE OF LICENSE
5+
*
6+
* This source file is subject to the MIT License
7+
* It is available through the world-wide-web at this URL:
8+
* https://tldrlegal.com/license/mit-license
9+
* If you are unable to obtain it through the world-wide-web, please send an email
10+
* to [email protected] so we can send you a copy immediately.
11+
*
12+
* DISCLAIMER
13+
*
14+
* Do not edit or add to this file if you wish to upgrade this module to newer
15+
* versions in the future. If you wish to customize this module for your
16+
* needs please contact [email protected] for more information.
17+
*
18+
* @copyright Copyright (c) Buckaroo B.V.
19+
* @license https://tldrlegal.com/license/mit-license
20+
*/
21+
22+
namespace Buckaroo\Magento2Graphql\Model\Payment\Method\Config;
23+
24+
use Buckaroo\Magento2Graphql\Model\Payment\Method\AbstractConfig;
25+
26+
class Applepay extends AbstractConfig
27+
{
28+
/**
29+
* @inheritDoc
30+
*/
31+
public function getConfig()
32+
{
33+
return [
34+
[
35+
"key" => "storeName",
36+
"value" => $this->getConfigValue('storeName')
37+
],
38+
[
39+
"key" => "currency",
40+
"value" => $this->getConfigValue('currency')
41+
],
42+
[
43+
"key" => "cultureCode",
44+
"value" => $this->getConfigValue('cultureCode')
45+
],
46+
[
47+
"key" => "country",
48+
"value" => $this->getConfigValue('country')
49+
],
50+
[
51+
"key" => "guid",
52+
"value" => $this->getConfigValue('guid')
53+
],
54+
[
55+
"key" => "buttonStyle",
56+
"value" => $this->getConfigValue('buttonStyle')
57+
],
58+
[
59+
"key" => "dontAskBillingInfoInCheckout",
60+
"value" => $this->getConfigValue('dontAskBillingInfoInCheckout')
61+
],
62+
[
63+
"key" => "availableButtons",
64+
"value" => $this->getAvailableButtons()
65+
]
66+
67+
];
68+
}
69+
70+
protected function getConfigValue($key)
71+
{
72+
return $this->configProvider->getConfig()['payment']['buckaroo']['applepay'][$key];
73+
}
74+
75+
/**
76+
* Get list of available buttons
77+
*
78+
* @return string
79+
*/
80+
protected function getAvailableButtons()
81+
{
82+
$result = '';
83+
$availableButtons = $this->getConfigValue('availableButtons');
84+
if (is_countable($availableButtons) && count($availableButtons)) {
85+
$result = implode(",", $availableButtons);
86+
}
87+
88+
return $result;
89+
}
90+
}

0 commit comments

Comments
 (0)