Skip to main content
added 1 character in body
Source Link
Yogesh Karodiya
  • 3.1k
  • 4
  • 20
  • 42

After some R&D I got the solution myself.

First I created a class in my module:

namespace VendorName\ModuleName\Model\Payment;
class Payflowpro 
{
 public function __construct(
    \Magento\Vault\Model\VaultPaymentInterface $vault
) {
   $this->vault = $vault
   
}
  public function mymethod($payment,$amount)
  {
    $this->vault->authorize($payment,$amount);
  }
}

hereHere I passed an object of Vault Class.

In second step I1 created di.xml in my module and write below code:

<type name="VendorName\ModuleName\Model\Payment\Payflowpro">
    <arguments>
        <argument name="vault" xsi:type="object">PayflowProCreditCardVaultFacade</argument>
    </arguments>
 </type>  

here type is used for assigning object value which I passed in my module class

Now last steps I createcreates VirtualType in my di.xml for assigning provider to Vault Class.

 <virtualType name="PayflowProCreditCardVaultFacade" type="Magento\Vault\Model\Method\Vault">
    <arguments>
        <argument name="config" xsi:type="object">PayflowProVaultPaymentConfig</argument>
        <argument name="valueHandlerPool" xsi:type="object">PayflowProVaultPaymentValueHandlerPool</argument>
        <argument name="vaultProvider" xsi:type="object">Magento\Paypal\Model\Payflow\Transparent</argument>
        <argument name="code" xsi:type="const">Magento\Paypal\Model\Payflow\Transparent::CC_VAULT_CODE</argument>
    </arguments>
</virtualType>

After some R&D I got the solution myself.

First I created a class in my module:

namespace VendorName\ModuleName\Model\Payment;
class Payflowpro 
{
 public function __construct(
    \Magento\Vault\Model\VaultPaymentInterface $vault
) {
   $this->vault = $vault
   
}
  public function mymethod($payment,$amount)
  {
    $this->vault->authorize($payment,$amount);
  }
}

here I passed an object of Vault Class.

In second step I created di.xml in my module and write below code:

<type name="VendorName\ModuleName\Model\Payment\Payflowpro">
    <arguments>
        <argument name="vault" xsi:type="object">PayflowProCreditCardVaultFacade</argument>
    </arguments>
 </type>  

here type is used for assigning object value which I passed in my module class

Now last steps I create VirtualType in my di.xml for assigning provider to Vault Class.

 <virtualType name="PayflowProCreditCardVaultFacade" type="Magento\Vault\Model\Method\Vault">
    <arguments>
        <argument name="config" xsi:type="object">PayflowProVaultPaymentConfig</argument>
        <argument name="valueHandlerPool" xsi:type="object">PayflowProVaultPaymentValueHandlerPool</argument>
        <argument name="vaultProvider" xsi:type="object">Magento\Paypal\Model\Payflow\Transparent</argument>
        <argument name="code" xsi:type="const">Magento\Paypal\Model\Payflow\Transparent::CC_VAULT_CODE</argument>
    </arguments>
</virtualType>

After some R&D I got the solution myself.

First I created a class in my module:

namespace VendorName\ModuleName\Model\Payment;
class Payflowpro 
{
 public function __construct(
    \Magento\Vault\Model\VaultPaymentInterface $vault
) {
   $this->vault = $vault
   
}
  public function mymethod($payment,$amount)
  {
    $this->vault->authorize($payment,$amount);
  }
}

Here I passed an object of Vault Class.

In second step 1 created di.xml in my module and write below code:

<type name="VendorName\ModuleName\Model\Payment\Payflowpro">
    <arguments>
        <argument name="vault" xsi:type="object">PayflowProCreditCardVaultFacade</argument>
    </arguments>
 </type>  

here type is used for assigning object value which I passed in my module class

Now last steps I creates VirtualType in my di.xml for assigning provider to Vault Class.

 <virtualType name="PayflowProCreditCardVaultFacade" type="Magento\Vault\Model\Method\Vault">
    <arguments>
        <argument name="config" xsi:type="object">PayflowProVaultPaymentConfig</argument>
        <argument name="valueHandlerPool" xsi:type="object">PayflowProVaultPaymentValueHandlerPool</argument>
        <argument name="vaultProvider" xsi:type="object">Magento\Paypal\Model\Payflow\Transparent</argument>
        <argument name="code" xsi:type="const">Magento\Paypal\Model\Payflow\Transparent::CC_VAULT_CODE</argument>
    </arguments>
</virtualType>

After some R&D iI got the solution myself.

First I created a class in my module:

namespace VendorName\ModuleName\Model\Payment;
class Payflowpro 
{
 public function __construct(
    \Magento\Vault\Model\VaultPaymentInterface $vault
) {
   $this->vault = $vault
   
}
  public function mymethod($payment,$amount)
  {
    $this->vault->authorize($payment,$amount);
  }
}

here iI passed an object of VaultVault Class.

In second step I created di.xml in my module and write below code:

<type name="VendorName\ModuleName\Model\Payment\Payflowpro">
    <arguments>
        <argument name="vault" xsi:type="object">PayflowProCreditCardVaultFacade</argument>
    </arguments>
 </type>  
  

here type is used for assigning object value which I passed in my module class

Now last steps I create VirtualType in my di.xml for assigning provider to Vault Class.

 <virtualType name="PayflowProCreditCardVaultFacade" type="Magento\Vault\Model\Method\Vault">
    <arguments>
        <argument name="config" xsi:type="object">PayflowProVaultPaymentConfig</argument>
        <argument name="valueHandlerPool" xsi:type="object">PayflowProVaultPaymentValueHandlerPool</argument>
        <argument name="vaultProvider" xsi:type="object">Magento\Paypal\Model\Payflow\Transparent</argument>
        <argument name="code" xsi:type="const">Magento\Paypal\Model\Payflow\Transparent::CC_VAULT_CODE</argument>
    </arguments>
</virtualType>

After some R&D i got the solution myself.

First I created a class in my module:

namespace VendorName\ModuleName\Model\Payment;
class Payflowpro 
{
 public function __construct(
    \Magento\Vault\Model\VaultPaymentInterface $vault
) {
   $this->vault = $vault
   
}
  public function mymethod($payment,$amount)
  {
    $this->vault->authorize($payment,$amount);
  }
}

here i passed an object of Vault Class.

In second step I created di.xml in my module and write below code:

<type name="VendorName\ModuleName\Model\Payment\Payflowpro">
    <arguments>
        <argument name="vault" xsi:type="object">PayflowProCreditCardVaultFacade</argument>
    </arguments>
 

here type is used for assigning object value which I passed in my module class

Now last steps I create VirtualType in my di.xml for assigning provider to Vault Class.

 <virtualType name="PayflowProCreditCardVaultFacade" type="Magento\Vault\Model\Method\Vault">
    <arguments>
        <argument name="config" xsi:type="object">PayflowProVaultPaymentConfig</argument>
        <argument name="valueHandlerPool" xsi:type="object">PayflowProVaultPaymentValueHandlerPool</argument>
        <argument name="vaultProvider" xsi:type="object">Magento\Paypal\Model\Payflow\Transparent</argument>
        <argument name="code" xsi:type="const">Magento\Paypal\Model\Payflow\Transparent::CC_VAULT_CODE</argument>
    </arguments>
</virtualType>

After some R&D I got the solution myself.

First I created a class in my module:

namespace VendorName\ModuleName\Model\Payment;
class Payflowpro 
{
 public function __construct(
    \Magento\Vault\Model\VaultPaymentInterface $vault
) {
   $this->vault = $vault
   
}
  public function mymethod($payment,$amount)
  {
    $this->vault->authorize($payment,$amount);
  }
}

here I passed an object of Vault Class.

In second step I created di.xml in my module and write below code:

<type name="VendorName\ModuleName\Model\Payment\Payflowpro">
    <arguments>
        <argument name="vault" xsi:type="object">PayflowProCreditCardVaultFacade</argument>
    </arguments>
 </type>  
 

here type is used for assigning object value which I passed in my module class

Now last steps I create VirtualType in my di.xml for assigning provider to Vault Class.

 <virtualType name="PayflowProCreditCardVaultFacade" type="Magento\Vault\Model\Method\Vault">
    <arguments>
        <argument name="config" xsi:type="object">PayflowProVaultPaymentConfig</argument>
        <argument name="valueHandlerPool" xsi:type="object">PayflowProVaultPaymentValueHandlerPool</argument>
        <argument name="vaultProvider" xsi:type="object">Magento\Paypal\Model\Payflow\Transparent</argument>
        <argument name="code" xsi:type="const">Magento\Paypal\Model\Payflow\Transparent::CC_VAULT_CODE</argument>
    </arguments>
</virtualType>
Source Link
Yogesh Karodiya
  • 3.1k
  • 4
  • 20
  • 42

After some R&D i got the solution myself.

First I created a class in my module:

namespace VendorName\ModuleName\Model\Payment;
class Payflowpro 
{
 public function __construct(
    \Magento\Vault\Model\VaultPaymentInterface $vault
) {
   $this->vault = $vault
   
}
  public function mymethod($payment,$amount)
  {
    $this->vault->authorize($payment,$amount);
  }
}

here i passed an object of Vault Class.

In second step I created di.xml in my module and write below code:

<type name="VendorName\ModuleName\Model\Payment\Payflowpro">
    <arguments>
        <argument name="vault" xsi:type="object">PayflowProCreditCardVaultFacade</argument>
    </arguments>

here type is used for assigning object value which I passed in my module class

Now last steps I create VirtualType in my di.xml for assigning provider to Vault Class.

 <virtualType name="PayflowProCreditCardVaultFacade" type="Magento\Vault\Model\Method\Vault">
    <arguments>
        <argument name="config" xsi:type="object">PayflowProVaultPaymentConfig</argument>
        <argument name="valueHandlerPool" xsi:type="object">PayflowProVaultPaymentValueHandlerPool</argument>
        <argument name="vaultProvider" xsi:type="object">Magento\Paypal\Model\Payflow\Transparent</argument>
        <argument name="code" xsi:type="const">Magento\Paypal\Model\Payflow\Transparent::CC_VAULT_CODE</argument>
    </arguments>
</virtualType>