Skip to content

Commit

Permalink
Develop (#17)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
7 people authored Mar 27, 2023
1 parent 340ccda commit 73c2341
Show file tree
Hide file tree
Showing 41 changed files with 2,897 additions and 18 deletions.
24 changes: 24 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Contribution Guidelines

### Repository setup:
- Fork the repository to your account.
- 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).

### Making changes:
- Create a branch from the develop branch.
- The name of the branch should be something like: `feature/GITHUB-ISSUE-ID-slug` (eg: `feature/50-configprovider-update`)
- Your code changes should follow the [Magento2 coding standard](https://github.com/magento/magento-coding-standard).
- Including unit tests is encouraged.

### Pull Request:
- Open the PR to develop branch.
- If there is no issue referenced, add a description about the problem and the way it is being solved.
- Allow edits from maintainers.


### Contribution to refactoring:
- The branch should be created from refactoring.
- Your code changes should follow the [Magento2 coding standard](https://github.com/magento/magento-coding-standard).
- Include unit tests.
- Open the Pull Request.
- Check that git workflows checks have passed.
62 changes: 62 additions & 0 deletions Model/AdditionalDataProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

/**
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* It is available through the world-wide-web at this URL:
* https://tldrlegal.com/license/mit-license
* If you are unable to obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact [email protected] for more information.
*
* @copyright Copyright (c) Buckaroo B.V.
* @license https://tldrlegal.com/license/mit-license
*/

namespace Buckaroo\Magento2Graphql\Model;

use Buckaroo\Magento2Graphql\Plugin\AdditionalDataProviderPool;
use Buckaroo\Magento2Graphql\Model\Payment\Method\ConfigFactory;
use Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderInterface;

class AdditionalDataProvider implements AdditionalDataProviderInterface
{
const PAYMENT_FROM = 'buckaroo_payment_from';
/**
*
* @var Buckaroo\Magento2Graphql\Model\Payment\Method\ConfigFactory
*/
protected $fieldListFactory;

public function __construct(ConfigFactory $fieldListFactory)
{
$this->fieldListFactory = $fieldListFactory;
}
/**
* Return Additional Data,
* set a flag so we know the payment originated from graphql
*
* @param array $args
* @return array
*/
public function getData(array $args): array
{
$args[self::PAYMENT_FROM] = 'graphQl';

if (isset($args[AdditionalDataProviderPool::PROVIDER_KEY][$args['code']])) {

$additionalArgs = $args[AdditionalDataProviderPool::PROVIDER_KEY][$args['code']];
unset($args[AdditionalDataProviderPool::PROVIDER_KEY]);

return array_merge($args, $additionalArgs);
}

return $args;
}
}
45 changes: 45 additions & 0 deletions Model/Payment/Method/AbstractConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* It is available through the world-wide-web at this URL:
* https://tldrlegal.com/license/mit-license
* If you are unable to obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact [email protected] for more information.
*
* @copyright Copyright (c) Buckaroo B.V.
* @license https://tldrlegal.com/license/mit-license
*/

namespace Buckaroo\Magento2Graphql\Model\Payment\Method;

use Buckaroo\Magento2\Model\ConfigProvider\Method\ConfigProviderInterface;

abstract class AbstractConfig
{
/**
*
* @var Buckaroo\Magento2\Model\ConfigProvider\Method\ConfigProviderInterface
*/
protected $configProvider;

public function __construct(ConfigProviderInterface $configProvider) {
$this->configProvider = $configProvider;
}
/**
* Get payment method configuration
*
* @return array
*/
public function getConfig()
{
return [];
}
}
48 changes: 48 additions & 0 deletions Model/Payment/Method/Config/Afterpay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* It is available through the world-wide-web at this URL:
* https://tldrlegal.com/license/mit-license
* If you are unable to obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact [email protected] for more information.
*
* @copyright Copyright (c) Buckaroo B.V.
* @license https://tldrlegal.com/license/mit-license
*/

namespace Buckaroo\Magento2Graphql\Model\Payment\Method\Config;

use Buckaroo\Magento2Graphql\Model\Payment\Method\AbstractConfig;

class Afterpay extends AbstractConfig
{
/**
*
* @var Buckaroo\Magento2\Model\ConfigProvider\Method\Afterpay
*/
protected $configProvider;
/**
* @inheritDoc
*/
public function getConfig()
{
return [
[
"key"=>"businessMethod",
"value" => $this->configProvider->getBusiness()
],
[
"key"=>"paymentMethod",
"value" => $this->configProvider->getPaymentMethod()
]
];
}
}
43 changes: 43 additions & 0 deletions Model/Payment/Method/Config/Afterpay2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* It is available through the world-wide-web at this URL:
* https://tldrlegal.com/license/mit-license
* If you are unable to obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact [email protected] for more information.
*
* @copyright Copyright (c) Buckaroo B.V.
* @license https://tldrlegal.com/license/mit-license
*/

namespace Buckaroo\Magento2Graphql\Model\Payment\Method\Config;

use Buckaroo\Magento2Graphql\Model\Payment\Method\AbstractConfig;

class Afterpay2 extends AbstractConfig
{
/**
* @inheritDoc
*/
public function getConfig()
{
return [
[
"key"=>"businessMethod",
"value" => $this->configProvider->getBusiness()
],
[
"key"=>"paymentMethod",
"value" => $this->configProvider->getPaymentMethod()
]
];
}
}
40 changes: 40 additions & 0 deletions Model/Payment/Method/Config/Afterpay20.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* It is available through the world-wide-web at this URL:
* https://tldrlegal.com/license/mit-license
* If you are unable to obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact [email protected] for more information.
*
* @copyright Copyright (c) Buckaroo B.V.
* @license https://tldrlegal.com/license/mit-license
*/

namespace Buckaroo\Magento2Graphql\Model\Payment\Method\Config;

use Buckaroo\Magento2\Model\Config\Source\AfterpayCustomerType;
use Buckaroo\Magento2Graphql\Model\Payment\Method\AbstractConfig;

class Afterpay20 extends AbstractConfig
{
/**
* @inheritDoc
*/
public function getConfig()
{
return [
[
"key"=>"is_b2b",
"value" => $this->configProvider->getCustomerType() !== AfterpayCustomerType::CUSTOMER_TYPE_B2C
]
];
}
}
90 changes: 90 additions & 0 deletions Model/Payment/Method/Config/Applepay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

/**
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* It is available through the world-wide-web at this URL:
* https://tldrlegal.com/license/mit-license
* If you are unable to obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact [email protected] for more information.
*
* @copyright Copyright (c) Buckaroo B.V.
* @license https://tldrlegal.com/license/mit-license
*/

namespace Buckaroo\Magento2Graphql\Model\Payment\Method\Config;

use Buckaroo\Magento2Graphql\Model\Payment\Method\AbstractConfig;

class Applepay extends AbstractConfig
{
/**
* @inheritDoc
*/
public function getConfig()
{
return [
[
"key" => "storeName",
"value" => $this->getConfigValue('storeName')
],
[
"key" => "currency",
"value" => $this->getConfigValue('currency')
],
[
"key" => "cultureCode",
"value" => $this->getConfigValue('cultureCode')
],
[
"key" => "country",
"value" => $this->getConfigValue('country')
],
[
"key" => "guid",
"value" => $this->getConfigValue('guid')
],
[
"key" => "buttonStyle",
"value" => $this->getConfigValue('buttonStyle')
],
[
"key" => "dontAskBillingInfoInCheckout",
"value" => $this->getConfigValue('dontAskBillingInfoInCheckout')
],
[
"key" => "availableButtons",
"value" => $this->getAvailableButtons()
]

];
}

protected function getConfigValue($key)
{
return $this->configProvider->getConfig()['payment']['buckaroo']['applepay'][$key];
}

/**
* Get list of available buttons
*
* @return string
*/
protected function getAvailableButtons()
{
$result = '';
$availableButtons = $this->getConfigValue('availableButtons');
if (is_countable($availableButtons) && count($availableButtons)) {
$result = implode(",", $availableButtons);
}

return $result;
}
}
Loading

0 comments on commit 73c2341

Please sign in to comment.