Inhalte aufrufen

Profilbild

Question about custom payment plugin


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
10 Antworten zu diesem Thema

#1 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 11 July 2016 - 19:58

Hi,

I working on a payment plugin for Libra Bank (an bank and payment provider in Romania). Since now I have no errors at build time, but when I run the shop from VS2015 I have some little issues:
1.) When I go to administration in plugins if I try to install the plugin I can install it but it does not have the "Configure..." button when is done.

L.E.

Following an old topic opened last year (http://community.sma...le/#entry265441) I have now the Configure button but it rise an exception in Configure.cshtml at:

@using SmartStore.Web.Framework;
@using SmartStore.Web.Framework.UI;
@using SmartStore.LibraPay.Models;
@model ConfigurationModel

with: The name 'model' does not exist in the current context

L.E.

At first sight it seems to be somehow related to MVC version.

 

2.) If I take a look in "src\Presentation\SmartStore.Web\Plugins\SmartStore.LibraPay" I found there, numerous dll's from SmartStore bin (I did not take count but it seems that are  all references) that normally are not found in other plugins folders (so the footprint of files becames unnecessary bigger).

L.E.

Similar with step 1 following the old post I partially solved: still is copied a folder where we found the Roslyn compiler . It's related to Visual Studio Code Analysis but I did not found how to get rid off.

 

Any hints please?



#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 11 July 2016 - 20:37

1. If your payment provider implements IConfigurable then you get the configure button under "Configuration > Payment methods". If your plugin class (PaymentPluginBase, PaymentMethodBase, IPlugin etc.) implements IConfigurable then you get the configure button under "Plugins > Manage Plugins".
A per payment provider configuration is preferable. See PayPal Plugin for code details.
 
2. Right click the assembly reference and choose "Properties". Set "Copy local" to "False" and you do not get these DLLs copied to your plugin folder.

Marcus Gesing

Smartstore AG


#3 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 11 July 2016 - 22:06

 

1. If your payment provider implements IConfigurable then you get the configure button under "Configuration > Payment methods". If your plugin class (PaymentPluginBase, PaymentMethodBase, IPlugin etc.) implements IConfigurable then you get the configure button under "Plugins > Manage Plugins".
A per payment provider configuration is preferable. See PayPal Plugin for code details.
 
2. -> Solved

 

I used:

public class LibraPayPaymentProcessor : BasePlugin, IConfigurable

Now the button is visible, but I got exception in Configure.cshtml

As I say in previous message, it seems to be MVC version related. I will make tomorrow a new, clean project from scratch to see if this may be reason.



#4 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 11 July 2016 - 23:44

The view folder of your plugin must contain a web.config file with the property "Copy to Output directory" set to "Copy if newer".
Use one of the existing plugins (like mentioned PayPal plugin) to ensure it has a proper content.

Marcus Gesing

Smartstore AG


#5 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 12 July 2016 - 06:47

 

The view folder of your plugin must contain a web.config file with the property "Copy to Output directory" set to "Copy if newer".
Use one of the existing plugins (like mentioned PayPal plugin) to ensure it has a proper content.

 

Thank you. After this I can enter the config page, but it not behave as I expect: If I go for example in Configuration -> Payment Methods my plugin is not visible there. Is visible only in Plugins -> Manage Plugins. Also if I try to pay a shopping cart, is not visible there.

 

L.E.

How can I achieve this:

I need in Domain\Orders\OrderStatus.cs to add this enumeration:

/// <summary>
        /// Authorized
        /// </summary>
        Authorized = 50,
  /// <summary>
  /// On Hold
  /// </summary>
        OnHold = 60,
  /// <summary>
  /// Declined
  /// </summary>

and so on.

and in Domain\Payments\PaymentStatus.cs:

/// <summary>
        ///
        /// </summary>
        OnHold = 60,
        /// <summary>
        ///
        /// </summary>
        Declined = 70,
        /// <summary>
        ///

and so on.

Is possible to do this directly in controller because is not very convenient to modify directly in Core ?



#6 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 12 July 2016 - 09:44

Your payment provider must inherit from PaymentPluginBase, see PayPalStandardProvider as an example.
And your controller should inherit from PaymentControllerBase. Another solution: reinstall the plugin.
 
No, you cannot change core enumerations. If you need extra data stored for each order, you can use GenericAttributeService or SyncMappingService.

Marcus Gesing

Smartstore AG


#7 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 12 July 2016 - 15:08

 

Your payment provider must inherit from PaymentPluginBase, see PayPalStandardProvider as an example.
And your controller should inherit from PaymentControllerBase. Another solution: reinstall the plugin.
 
No, you cannot change core enumerations. If you need extra data stored for each order, you can use GenericAttributeService or SyncMappingService.

 

Is inherited from BasePlugin but I have another payment plugin that I made that is inherited the same (from BasePlugin) and it works. Anyway I will try to inherit from PaymentPluginBase to see if such a fix

Controller is inherited from PaymentControllerBase.



#8 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 12 July 2016 - 15:22

btw PaymentStatus.Authorized; can be assumed to be as same as PaymentStatus.Paid; ?



#9 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 12 July 2016 - 16:41

No, PaymentStatus.Authorized comes before PaymentStatus.Paid. It means the payment (amount) is "reserved" for later capturing. PaymentStatus.Paid means the amount has been captured thus the transmission has been disposed.


Marcus Gesing

Smartstore AG


#10 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 12 July 2016 - 16:57

No, PaymentStatus.Authorized comes before PaymentStatus.Paid. It means the payment (amount) is "reserved" for later capturing. PaymentStatus.Paid means the amount has been captured thus the transmission has been disposed.

So I understand that Paid must be marked manually? Because by experience I see that between the moment of "locking" the amount of money in my account and the moment when the money are really transferred can be between hours to days. So I don't see how can deal the plugin with this.



#11 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 12 July 2016 - 18:56

Typically an amout is authorized when an order is created. See for instance PayPalRestApiProviderBase.ProcessPayment:
ProcessPaymentRequest.NewPaymentStatus is set to PaymentStatus.Authorized when the authorization was successful.
Then the merchant wants to capture the amount when the products are shipped. For this he clicks the capture button on
the order detail page and that invokes PayPalRestApiProviderBase.Capture:
If the capturing is successful then CapturePaymentRequest.NewPaymentStatus is set to PaymentStatus.Paid.
 
Another scenario is to authorize and capture automatically when an order is created. Most payment providers have a configuration setting for this.
 
So actually PaymentStatus.Paid does not mean the amount arrived on the merchant's bank account. It is set when the amount is successfully captured against the API of the payment provider.
 

Marcus Gesing

Smartstore AG