Skip to content

Commit

Permalink
DAVAMS-764: Add IN3B2B (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinodsowdagar authored May 10, 2024
1 parent 0cadd0b commit d377c97
Show file tree
Hide file tree
Showing 8 changed files with 212 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CustomerData/PaymentRequest/PaymentComponentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use MultiSafepay\ConnectCore\Model\Ui\Gateway\VisaConfigProvider;
use MultiSafepay\ConnectCore\Util\RecurringTokensUtil;
use MultiSafepay\ConnectCore\Model\Ui\Gateway\ZiniaConfigProvider;
use MultiSafepay\ConnectCore\Model\Ui\Gateway\In3B2bConfigProvider;

class PaymentComponentRequest
{
Expand All @@ -36,7 +37,8 @@ class PaymentComponentRequest
CreditCardConfigProvider::CODE,
BnplinstmConfigProvider::CODE,
ZiniaConfigProvider::CODE,
BnplmfConfigProvider::CODE
BnplmfConfigProvider::CODE,
In3B2bConfigProvider::CODE,
];

/**
Expand Down
42 changes: 42 additions & 0 deletions Model/Ui/Gateway/In3B2bConfigProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is provided with Magento in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* See DISCLAIMER.md for disclaimer details.
*/

declare(strict_types=1);

namespace MultiSafepay\ConnectCore\Model\Ui\Gateway;

use Magento\Framework\Exception\LocalizedException;
use MultiSafepay\ConnectCore\Model\Ui\GenericConfigProvider;

class In3B2bConfigProvider extends GenericConfigProvider
{
public const CODE = 'multisafepay_in3b2b';

/**
* Retrieve assoc array of checkout configuration
*
* @return array
* @throws LocalizedException
*/
public function getConfig(): array
{
return [
'payment' => [
$this->getCode() => [
'image' => $this->getImage(),
'is_preselected' => $this->isPreselected(),
'payment_type' => $this->getPaymentType()
]
]
];
}
}
5 changes: 5 additions & 0 deletions Test/Integration/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,10 @@ public function testForAdminObservers()
PaymentComponentDataAssignObserver::class,
'payment_method_assign_data_multisafepay_zinia'
);

$this->findObserverForEvent(
PaymentComponentDataAssignObserver::class,
'payment_method_assign_data_multisafepay_in3b2b'
);
}
}
26 changes: 26 additions & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,32 @@
<is_multisafepay>1</is_multisafepay>
<gateway_code>IN3</gateway_code>
</multisafepay_in3>
<multisafepay_in3b2b>
<active>0</active>
<model>MultiSafepayIn3B2bFacade</model>
<order_status>pending</order_status>
<payment_action>initialize</payment_action>
<title>in3: Betaal in 3 delen (0% rente)</title>
<payment_type>redirect</payment_type>
<currency>EUR</currency>
<can_initialize>1</can_initialize>
<can_fetch_transaction_information>1</can_fetch_transaction_information>
<can_fetch_transaction_info>1</can_fetch_transaction_info>
<can_use_checkout>1</can_use_checkout>
<can_use_internal>0</can_use_internal>
<can_refund>1</can_refund>
<can_refund_partial_per_invoice>1</can_refund_partial_per_invoice>
<is_gateway>1</is_gateway>
<sort_order>1</sort_order>
<allowspecific>0</allowspecific>
<allow_specific_currency>0</allow_specific_currency>
<allow_specific_shipping_method>0</allow_specific_shipping_method>
<allow_specific_customer_group>0</allow_specific_customer_group>
<custom_payment_link_lifetime>0</custom_payment_link_lifetime>
<transaction_type>redirect</transaction_type>
<is_multisafepay>1</is_multisafepay>
<gateway_code>IN3B2B</gateway_code>
</multisafepay_in3b2b>
<multisafepay_wechatpay>
<active>0</active>
<model>MultiSafepayWeChatPayFacade</model>
Expand Down
130 changes: 130 additions & 0 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6003,6 +6003,130 @@
</arguments>
</virtualType>

<!-- In3B2b Payment Method Facade configuration -->
<virtualType name="MultiSafepayIn3B2bFacade" type="Magento\Payment\Model\Method\Adapter">
<arguments>
<argument name="code" xsi:type="const">MultiSafepay\ConnectCore\Model\Ui\Gateway\In3B2bConfigProvider::CODE</argument>
<argument name="formBlockType" xsi:type="string">Magento\Payment\Block\Form</argument>
<argument name="infoBlockType" xsi:type="string">Magento\Payment\Block\ConfigurableInfo</argument>
<argument name="validatorPool" xsi:type="object">MultiSafepayIn3B2bValidatorPool</argument>
<argument name="valueHandlerPool" xsi:type="object">MultiSafepayIn3B2bValueHandlerPool</argument>
<argument name="commandPool" xsi:type="object">MultiSafepayIn3B2bCommandPool</argument>
</arguments>
</virtualType>

<!-- In3B2b Configuration reader -->
<virtualType name="MultiSafepayIn3B2bConfig" type="Magento\Payment\Gateway\Config\Config">
<arguments>
<argument name="methodCode" xsi:type="const">MultiSafepay\ConnectCore\Model\Ui\Gateway\In3B2bConfigProvider::CODE</argument>
</arguments>
</virtualType>

<!-- In3B2b Config Value Handler Pool -->
<virtualType name="MultiSafepayIn3B2bConfigValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">MultiSafepayIn3B2bConfigValueHandler</item>
</argument>
</arguments>
</virtualType>

<!-- In3B2b Config Value Handler -->
<virtualType name="MultiSafepayIn3B2bConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">MultiSafepayIn3B2bConfig</argument>
</arguments>
</virtualType>

<!-- In3B2b Logger, initialized with MultiSafepayIn3B2bConfig -->
<virtualType name="MultiSafepayIn3B2bLogger" type="Magento\Payment\Model\Method\Logger">
<arguments>
<argument name="config" xsi:type="object">MultiSafepayIn3B2bConfig</argument>
</arguments>
</virtualType>

<type name="\MultiSafepay\ConnectCore\Gateway\Http\Client\RedirectClient">
<arguments>
<argument name="logger" xsi:type="object">MultiSafepayIn3B2bLogger</argument>
</arguments>
</type>

<!-- In3B2b Commands infrastructure -->
<virtualType name="MultiSafepayIn3B2bCommandPool" type="Magento\Payment\Gateway\Command\CommandPool">
<arguments>
<argument name="commands" xsi:type="array">
<item name="initialize" xsi:type="string">MultiSafepayIn3B2bInitializeCommand</item>
<item name="refund" xsi:type="string">MultiSafepayIn3B2bRefundCommand</item>
<item name="fetch_transaction_information" xsi:type="string">MultiSafepay\ConnectCore\Gateway\Command\FetchTransactionInfo</item>
</argument>
</arguments>
</virtualType>

<!-- In3B2b Initialize command -->
<virtualType name="MultiSafepayIn3B2bInitializeCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments>
<argument name="requestBuilder" xsi:type="object">MultiSafepayIn3B2bInitializeRequestBuilder</argument>
<argument name="transferFactory" xsi:type="object">MultiSafepay\ConnectCore\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">MultiSafepay\ConnectCore\Gateway\Http\Client\RedirectClient</argument>
</arguments>
</virtualType>

<!-- In3B2b Refund command -->
<virtualType name="MultiSafepayIn3B2bRefundCommand" type="Magento\Payment\Gateway\Command\GatewayCommand">
<arguments>
<argument name="requestBuilder" xsi:type="object">MultiSafepayIn3B2bRefundRequestBuilder</argument>
<argument name="transferFactory" xsi:type="object">MultiSafepay\ConnectCore\Gateway\Http\TransferFactory</argument>
<argument name="client" xsi:type="object">MultiSafepay\ConnectCore\Gateway\Http\Client\ShoppingCartRefundClient</argument>
<argument name="handler" xsi:type="object">MultiSafepay\ConnectCore\Gateway\Response\RefundResponseHandler</argument>
</arguments>
</virtualType>

<!-- In3B2b Initialization Request -->
<virtualType name="MultiSafepayIn3B2bInitializeRequestBuilder" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments>
<argument name="builders" xsi:type="array">
<item name="transaction" xsi:type="string">MultiSafepay\ConnectCore\Gateway\Request\Builder\RedirectTransactionBuilder</item>
</argument>
</arguments>
</virtualType>

<!-- In3B2b Refund Request -->
<virtualType name="MultiSafepayIn3B2bRefundRequestBuilder" type="Magento\Payment\Gateway\Request\BuilderComposite">
<arguments>
<argument name="builders" xsi:type="array">
<item name="transaction" xsi:type="string">MultiSafepay\ConnectCore\Gateway\Request\Builder\ShoppingCartRefundRequestBuilder</item>
</argument>
</arguments>
</virtualType>

<!-- In3B2b Validator Pool -->
<virtualType name="MultiSafepayIn3B2bValidatorPool" type="Magento\Payment\Gateway\Validator\ValidatorPool">
<arguments>
<argument name="validators" xsi:type="array">
<item name="country" xsi:type="string">MultiSafepayIn3B2bCountryValidator</item>
</argument>
</arguments>
</virtualType>
<virtualType name="MultiSafepayIn3B2bCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
<arguments>
<argument name="config" xsi:type="object">MultiSafepayIn3B2bConfig</argument>
</arguments>
</virtualType>

<!-- In3B2b Value handlers infrastructure -->
<virtualType name="MultiSafepayIn3B2bValueHandlerPool" type="Magento\Payment\Gateway\Config\ValueHandlerPool">
<arguments>
<argument name="handlers" xsi:type="array">
<item name="default" xsi:type="string">MultiSafepayIn3B2bConfigValueHandler</item>
</argument>
</arguments>
</virtualType>
<virtualType name="MultiSafepayIn3B2bConfigValueHandler" type="Magento\Payment\Gateway\Config\ConfigValueHandler">
<arguments>
<argument name="configInterface" xsi:type="object">MultiSafepayIn3B2bConfig</argument>
</arguments>
</virtualType>

<!-- MyBank Payment Method Facade configuration -->
<virtualType name="MyBankFacade" type="Magento\Payment\Model\Method\Adapter">
<arguments>
Expand Down Expand Up @@ -9083,6 +9207,11 @@
MultiSafepay\ConnectCore\Model\Api\Builder\OrderRequestBuilder\AdditionalDataBuilder\PaymentComponentAdditionalDataBuilder
</item>
</item>
<item name="multisafepay_in3b2b" xsi:type="array">
<item name="payment_component_builder" xsi:type="object">
MultiSafepay\ConnectCore\Model\Api\Builder\OrderRequestBuilder\AdditionalDataBuilder\PaymentComponentAdditionalDataBuilder
</item>
</item>
</argument>
</arguments>
</type>
Expand Down Expand Up @@ -9172,6 +9301,7 @@
<item name="multisafepay_paypal" xsi:type="object">MultiSafepay\ConnectCore\Model\Ui\Gateway\PaypalConfigProvider</item>
<item name="multisafepay_trustly" xsi:type="object">MultiSafepay\ConnectCore\Model\Ui\Gateway\TrustlyConfigProvider</item>
<item name="multisafepay_in3" xsi:type="object">MultiSafepay\ConnectCore\Model\Ui\Gateway\In3ConfigProvider</item>
<item name="multisafepay_in3b2b" xsi:type="object">MultiSafepay\ConnectCore\Model\Ui\Gateway\In3B2bConfigProvider</item>
<item name="multisafepay_genericgateway" xsi:type="object">MultiSafepay\ConnectCore\Model\Ui\Gateway\GenericGatewayConfigProvider</item>
<item name="multisafepay_wechatpay" xsi:type="object">MultiSafepay\ConnectCore\Model\Ui\Gateway\WeChatPayConfigProvider</item>
<item name="multisafepay_zinia" xsi:type="object">MultiSafepay\ConnectCore\Model\Ui\Gateway\ZiniaConfigProvider</item>
Expand Down
3 changes: 3 additions & 0 deletions etc/events.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<event name="payment_method_assign_data_multisafepay_in3">
<observer name="in3_assign_payment_data" instance="MultiSafepay\ConnectCore\Observer\Gateway\In3DataAssignObserver" />
</event>
<event name="payment_method_assign_data_multisafepay_in3b2b">
<observer name="multisafepay_in3b2b_assign_payment_data" instance="MultiSafepay\ConnectCore\Observer\Gateway\PaymentComponentDataAssignObserver" />
</event>
<event name="payment_method_assign_data_multisafepay_visa">
<observer name="visa_assign_credit_card_data" instance="MultiSafepay\ConnectCore\Observer\Gateway\CreditCardDataAssignObserver" />
</event>
Expand Down
3 changes: 3 additions & 0 deletions etc/payment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@
<method name="multisafepay_in3">
<allow_multiple_address>1</allow_multiple_address>
</method>
<method name="multisafepay_in3b2b">
<allow_multiple_address>1</allow_multiple_address>
</method>
<method name="multisafepay_babygiftcard">
<allow_multiple_address>1</allow_multiple_address>
</method>
Expand Down
Binary file added view/base/web/images/multisafepay_in3b2b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d377c97

Please sign in to comment.