Inhalte aufrufen

Profilbild

Payment module


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

#1 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 23 March 2015 - 10:39

I obtained from a payment operator from my country, a sample plugin that was developed for nop commerce 1.6

Is realistic to try to convert this in a payment plugin for SmartStore 2.1.x?

 

Thank you



#2 Wolfgang Schmerge

Wolfgang Schmerge

    SmartStore AG

  • Administrators
  • 2453 Beiträge

Geschrieben: 23 March 2015 - 10:52

Hi,

 

no, that will not work.
Which payment-method is it?

 

Regards

 

Wolfgang


Shopbetreiber benötigen Ihre Hilfe! Bewerten Sie jetzt Smartstore auf Capterra.

Als Dankeschön erhalten Sie 20 Euro für Ihren nächsten Kauf im Marketplace.

Smartstore bewerten


 

Bleibt gesund!

 

Viele zusätzliche Smartstore Plugins gibt es im MARKETPLACE:
http://community.sma...dex.php?/files/

 

Hier geht es zu den Smartstore Videos:
Smartstore.NET Youtube-Channel
 

Die deutsche Smartstore Online-Dokumentation gibt es hier:
https://smartstore.a...iew?mode=global

In dem folgenden BLOG findet man interessante Tipps & Tricks zum Thema "Smartstore":

http://community.sma...t-tipps-tricks/

 


#3 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 23 March 2015 - 11:31

Hi,

 

I don't think to use it as is but to use it as starting point to re-write a new one. Is a national widely used payment operator (www.plationline.ro)

Initially I think to use the PayPal as starting point but I find that is to complicated to the purpose.

In fact I have two operators from which I obtained their API and examples, and mainly in plain aspx approach what I have to send to them via a http request (encoded) is the amount of money, and id of transaction, and an ID of buyer. All others info comes directly in their pages (number of card, date of expiration, name on card, CVV/CVC code etc.)

On other hand I remember that at moment here in SmartStore we have a generic card payment method, but now I did not found the source of this plugin to use as starting point for a new one.



#4 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 23 March 2015 - 12:09

Yes, you can try to convert it. Suggestions for first steps: Create a payment provider class and derive it from PaymentMethodBase. 
Develop the core implementation of your payment method by overriding the properties and methods of PaymentMethodBase. They are very similar to Nop.
 
As an example: Offline payment methods are combined in SmartStore.OfflinePayment project which serves 7 providers for 7 payment methods.
Generic card payment method is provided by \SmartStore.OfflinePayment\Providers\ManualProvider.cs.
Another example would be SmartStore.AmazonPay but it's a relative extensive plugin.

Marcus Gesing

Smartstore AG


#5 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 23 March 2015 - 12:49

So generic card is included in offline payment? In this case I have to add a (new) provider class here ?

 

L.E.

And PaymentMethodBase in which plugin is implemented?



#6 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 23 March 2015 - 13:49

No, you have to create your own plugin. SmartStore.OfflinePayment is intended for non payment gateway methods.


Marcus Gesing

Smartstore AG


#7 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 24 March 2015 - 08:44

The payment plugins are at base web apps? I ask this because the nop based plugin that I try to convert is class library.



#8 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 24 March 2015 - 11:47

Yes, they are. Maybe this information could be helpful.


Marcus Gesing

Smartstore AG


#9 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 27 March 2015 - 10:00

Finally I somehow finish to port the plugin example from nopCommerce to SmartStore (I converted from Class Library to Web App, and I have no build errors), but I have some issues:

1. When I build the solution, in smartstore\web\plugins\SmartStore.PlatiOnline is copied only the SmartStore.PlatiOnline.dll resulted, and no the help files\folders such Views, Content, Localization. Also are copied the related System.Web.*.dll and I don't know why (this makes much larger the package)

2. When I enter in plugin management, I never see my plugin, no matter how many times I hit "Reload List of Plugins"

3. If I try to build the all web package using ClickToBuild.cmd I have errors, but if I exclude my plugin from solution no. Anyway if I build from Visual Studio, I don't have



#10 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 27 March 2015 - 12:32

If would suggest not to use the SmartStore prefix for your plugin, better would be to use a short author or company name.
 
1. Take a look at another plugin. Go to reference, right click the reference and click properties. Set "Copy Local" to False
to suppress local copies of system assemblies. For Localization xml and views choose "Build Action" Content and "Copy to output directory"
Copy if newer.
2. Check the plugin properties. Output path should be something like "..\..\Presentation\SmartStore.Web\Plugins\MyCompany.PlatiOnline\".
3. No idea. Maybe 2. is the reason.

Marcus Gesing

Smartstore AG


#11 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 27 March 2015 - 13:17

Thank you
 
I solved issue 1, now is build with all the files and without build errors.
In what concerns the name, initially was other, I changed after I observed that all plugin are prefixed as SmartStore.NameOfPlugin
As I explained, I started from the plugin for nop that was not web application but class library.
I add a new (empty) web application project under plugins folder, and rebuild all from scratch (I have to note that I tested the plugin with nop for being sure that it works, and it works)
I corrected all the references and usings in code, and I have no error at build level. Here I have to say that the empty project was targeted for dot.net 4.6 but all other smartStore plugins are targeted for 4.5 . If I change this also to 4.5 I have build errors.
OK, next step I launch the shop from visual studio, I go to plugin mamangement, hit "Reload List of Plugins", nothing happens, but if I go to System -> Warnings, there I can see a "Payments.PlatiOnline' plugin is incompatible with your SmartStore.NET version. Delete it or update to the latest version." warning.
I noticed yesterday a similar behaviour when I made tests with original plugin in nop. It is not clear for me how I sorted out of this, anyway it was a sequence of clear solution -> rebuild solution, and clear cache of browser, and finally it works. But here in SmartStore still not work.
 
L.E.
I find that it was unavailable because of the description.txt file . It was in nop format
Now is visible, it can be installed, but at this step it can't be activated: "Activating this payment method is forbidden by the plugin."



#12 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 27 March 2015 - 14:22

"Activating this payment method is forbidden by the plugin"
PaymentMethodBase has a new property "IsActive" that you have to override. It should return True.

Marcus Gesing

Smartstore AG


#13 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 27 March 2015 - 15:02

Where in my plugin I have to implement this? At first sight I did not find this in other payment plugins for having an idea how to do this.
Anyway, at this level I have this aspects that are not clear to me:
Even if is installed (but not active) my plugin don't have the "Configure" button if I go to "Admin/Payment/Providers" (Payment Methods menu entry)
I don't know how to bind my custom logo icon of payment provider. Is displayed the generic credit card icon instead. I have provided in folder Contents an icon as icon.png but it not helps.
It's not clear to me if necessary (and if, how to provide) to have the resources.xx-XX.xml file in Localization folder,

 

Maybe are also other issues, but I don't know because I am stuck here.



#14 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 27 March 2015 - 17:06

"Where in my plugin I have to implement this?"
Rebuild your solution and see if it goes away. Otherwise override PaymentMethodBase.IsActive.
 
"my plugin don't have the "Configure" button"
Implement IConfigurable. See PayPal payment providers for example.
 
"bind my custom logo icon of payment provider"
Provide Content\icon.png with "Copy if newer" for "Copy to output directory". See PayPal payment plugin for example.
 
"if necessary (and if, how to provide) to have the resources.xx-XX.xml file in Localization folder"
Contains localized string resources of your plugin. If the plugin uses localized string resources it is required otherwise not. See PayPal payment plugin for example.

Marcus Gesing

Smartstore AG


#15 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 30 March 2015 - 10:17

I search for PaymentMethodBase.IsActive and I did not find this anywhere in solution. I succeeded to make it configurable, but I did not find how to activate.
 
L.E.
I find in DependencyRegistrat.cs (e.g. In PayPal, ) somwthing related to this:
builder.RegisterType<PayPalExpressCheckoutFilter>().AsActionFilterFor<CheckoutController>(x => x.PaymentMethod()).InstancePerRequest();

but for example in OfflinePayment the approach is different, in Plugin.cs is a method Install() (and paired with method Uninstall() )

So what is in fact the way for allowing Install for my plugin. Regarding to first approach, my plugin does not implement nothing related to Filters.



#16 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 30 March 2015 - 10:48

"search for PaymentMethodBase.IsActive and I did not find this anywhere in solution"
That's impossible. If you get "Activating this payment method is forbidden by the plugin." you must have PaymentMethodBase.IsActive because both
were source code included with the same git-commit. Please pull again.
 
"my plugin does not implement nothing related to Filters."
That's ok and optional. Amazon payments has to manipulate the checkout and therefore it requires to register action filters. Probably you do not need that.

Marcus Gesing

Smartstore AG


#17 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 30 March 2015 - 11:55

My bad. Finally I found it, and now I activate the payment plugin, I made some tests, it seems to work (because the provider also emails every transaction, even the test one), but I have an exception when it comes back from payment to smartstore (in fact it comes back in plugin in a CheckOutCompleted.cshtml view, where I display the messages from the gateway (e.g. success, payment deinied etc.) and the redirect to OrderDetails:

A route named 'OrderDetails' could not be found in the route collection.
Parameter name: name

#18 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 30 March 2015 - 18:11

"A route named 'OrderDetails' could not be found in the route collection."
It has been removed with several other named routes, so please don't use it anymore. I would use RedirectToAction with the following logic
(taken from \SmartStore.PayPal\Controllers\PayPalStandardController.cs::CancelOrder):
public ActionResult CancelOrder(FormCollection form)
{
  var order = _orderService.SearchOrders(_storeContext.CurrentStore.Id, _workContext.CurrentCustomer.Id,
    null, null, null, null, null, null, null, null, 0, 1).FirstOrDefault();

  if (order != null)
  {
    return RedirectToAction("Details", "Order", new { id = order.Id, area = "" });
  }

  return RedirectToAction("Index", "Home", new { area = "" });
}

Another way would be to use an INotifier message to display gateway messages. In an action method you can use "NotifySuccess" for example.


Marcus Gesing

Smartstore AG


#19 net4u

net4u

    Advanced Member

  • Members
  • PunktPunktPunkt
  • 48 Beiträge

Geschrieben: 24 April 2015 - 11:21

How can I contribute this plugin for community ?
In this moment is functional, but I want to check how to upgrade it for the latest release of smartStore.net and to see if it persist an issue when used in mobile environment (when I made a pay from smartphone when it redirect back to the smartStore.net shop I have an issue related to an section not declared in a view: not sure that is related to my plugin or to mobile theme)

#20 Murat Cakir

Murat Cakir

    SmartStore AG

  • Administrators
  • 1118 Beiträge

Geschrieben: 24 April 2015 - 16:37

Contributing is easy:

  • Create a NuGet package for your plugin with the SmartStore.Packager Tool: https://github.com/s...ension-packager
  • Click Upload file in the Marketplace
  • Enter all info
  • Submit your package
  • Wait for approval :-)

Murat Cakir
SmartStore AG