Skip to content
This repository was archived by the owner on Jun 2, 2022. It is now read-only.

Commit afbac81

Browse files
author
Patrick McLain
committed
Add additional payment module support
Adds native support for: * Pmclain_Stripe * Pmclain_AuthorizenetCim
1 parent e303715 commit afbac81

File tree

5 files changed

+62
-2
lines changed

5 files changed

+62
-2
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Pmclain\OneClickCheckout\Model\VaultSource;
4+
5+
use Pmclain\OneClickCheckout\Api\VaultSourceInterface;
6+
use Magento\Vault\Api\Data\PaymentTokenInterface;
7+
8+
class PmclainAuthorizenetCim implements VaultSourceInterface
9+
{
10+
/**
11+
* @param PaymentTokenInterface $token
12+
* @return array
13+
*/
14+
public function getPaymentData($token)
15+
{
16+
return [
17+
'additional_data' => [
18+
PaymentTokenInterface::PUBLIC_HASH => $token->getPublicHash(),
19+
],
20+
'method' => 'pmclain_authorizenetcim_vault',
21+
];
22+
}
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Pmclain\OneClickCheckout\Model\VaultSource;
4+
5+
use Pmclain\OneClickCheckout\Api\VaultSourceInterface;
6+
use Magento\Vault\Api\Data\PaymentTokenInterface;
7+
8+
class PmclainStripe implements VaultSourceInterface
9+
{
10+
/**
11+
* @param PaymentTokenInterface $token
12+
* @return array
13+
*/
14+
public function getPaymentData($token)
15+
{
16+
return [
17+
'additional_data' => [
18+
PaymentTokenInterface::PUBLIC_HASH => $token->getPublicHash(),
19+
],
20+
'method' => 'pmclain_stripe_vault',
21+
];
22+
}
23+
}

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ customers without a default payment. The last stored payment method for is set
2828
as default.
2929

3030
### Compatibility
31-
It is compatible with Braintree out of the box. Configuration can be added for
32-
any payment method using the Magento Vault module for storing gateway tokens.
31+
**Compatible Payment Modules**
32+
* Magento_Braintree (included with Magento)
33+
* [Pmclain_Stripe](https://github.com/pmclain/module-stripe)
34+
* [Pmclain_AuthorizenetCim](https://github.com/pmclain/module-authorizenetcim)
3335

3436
***Adding a new Vault Payment Provider***
3537
1. Create class implementing `Pmclain\OneClickCheckout\Api\VaultSourceInterface`. The

etc/di.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<arguments>
88
<argument name="vaultSourceMap" xsi:type="array">
99
<item name="braintree" xsi:type="object">Pmclain\OneClickCheckout\Model\VaultSource\Braintree</item>
10+
<item name="pmclain_authorizenetcim" xsi:type="object">Pmclain\OneClickCheckout\Model\VaultSource\PmclainAuthorizenetCim</item>
11+
<item name="pmclain_stripe" xsi:type="object">Pmclain\OneClickCheckout\Model\VaultSource\PmclainStripe</item>
1012
</argument>
1113
</arguments>
1214
</type>

view/frontend/layout/vault_cards_listaction.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,15 @@
66
<argument name="template" xsi:type="string">Pmclain_OneClickCheckout::customer_account/credit_card.phtml</argument>
77
</action>
88
</referenceBlock>
9+
<referenceBlock name="pmclainauthorizenetcim.card.renderer">
10+
<action method="setTemplate">
11+
<argument name="template" xsi:type="string">Pmclain_OneClickCheckout::customer_account/credit_card.phtml</argument>
12+
</action>
13+
</referenceBlock>
14+
<referenceBlock name="stripe.card.renderer">
15+
<action method="setTemplate">
16+
<argument name="template" xsi:type="string">Pmclain_OneClickCheckout::customer_account/credit_card.phtml</argument>
17+
</action>
18+
</referenceBlock>
919
</body>
1020
</page>

0 commit comments

Comments
 (0)