Control Payment type options in store


#1

I am trying to expose the option to check out and pay via PayPal (after installing the add-on). I am not having luck. Likewise, I can’t get options e.g. pay by COD to disappear. I don’t think this is bug, I’m just failing to pull the right levers I think.


#2

Hi BuvinJ,

I guess you are trying to enable it in the store, if so, you may have to comment out ./applications/shop/webapp/shop/order/checkoutpayment.ftl lines 320 and 335.

Let me know if that solved your issue. Probably we should make that change in our code too or document it in a more proper way.


#3

No problem at all. I will reach out to @minifreak about this (he is more familiar with the implementation than I am). But until he responds, let’s try the following:

  1. By default you must modify and load the configuration data in addons/paypal-dev/blob/addons/paypal/master/data/PaypalDemoData.xml (you can import the file via https://localhost:8443/admin/control/EntityImport

You must set the “clientId” and “secret” on the PaymentGatewayPayPalRest entry according to your own paypal settings. Also check that the productStoreId defined under ProductStorePaymentSetting matches your own. Import after you did the changes.

There is also a fallback for the clientId in config/paypal.properties, but that won’t show, unless you add the payment option to your productstore.

  1. Check with https://localhost:8443/catalog/control/EditProductStorePaySetup?productStoreId=ScipioShopg (modify productStoreId according to your own) for the COD entry. Generally speaking you can remove the external payment entries (except for EXT_PAYPAL) you probably installed with the demo data. That should remove the COD option for you.

#6

After thinking about it some more, i am confident that you may not have installed the “seed” data. That one is on us, we should update the README file and point that out. I will create a ticket for this.


#7

Previously, I defined sandbox creds for the PayPal gateway using the accounting app.

When I “installed” the add-on, I created a new branch of my repo in a dev environment and ran the addon bash script. It seemed to work fine. I ended up with commits on the branch head. Then, I committed and pushed that new branch, checked it out in prod, and restarted the service.

I played with store and product settings (payment types) in the catalog app to no avail.

I have yet to try these suggestions from the two of you yet, but I will attempt to within the coming hours. Thanks!


#8

Yeah, the git-addons script only pulls the addon files, it doesn’t install data. We may need to make that more user-friendly (it is sort of implicit in upstream, but that is more like a documentation omission than anything).

You can do it with the command line like this:

./ant load-file -Ddata-file=addons/paypal/data/PaypalData.xml,addons/paypal/data/PaypalDemoData.xml
(don’t add extra spaces)

(It will be added to the git-addons script, but it needs some more rigorous testing first, within that script I mean, so you can use this in the meantime)

You have to run that command on both your dev and prod servers… while the servers are stopped (./ant stop).


#10

I fear that there has been a bug with regards to how the addon is loaded by default, which may have also caused your error. We already created a bugfix and will notify you once it has been pushed to github. Sorry about this.


#11

Thanks for the heads up! Should I proceed with the rest of the step listed here? Loading the seed data, defining the Paypal creds, editing the ./applications/shop/webapp/shop/order/checkoutpayment.ftl


#12

We created a fix for that too. So you don’t need to edit any files.

The only thing you should do after we pushed the changes is reload the seed data as pascal described. ie:

./ant load-file -Ddata-file=addons/paypal/data/PaypalData.xml,addons/paypal/data/PaypalDemoData.xml
(don’t add extra spaces)


#13

Great! I want to make sure I have configured the payment gateway correctly. I will start with a sandbox account config. These values (on the gateway form) come straight from paypal and are obvious:

  • Business Email
  • Api User Name
  • Api Password
  • Api Signature

These are a bit less clear. I can guess what most are, but I wanted to be sure I was doing this right:

When possible, please explain what these settings do. For instance, what is the open ended field “api environment”? That one I’m quite puzzled by. Is “Notify url” the address to a script that will process paypal notices? (Such as when a payment was made independently from the store, or a dispute was filed, etc.?), if so why there is no default value? Is that script something not built in? Or does notify url serve an entirely different function? (“notifying” a third party client perhaps?)


#14

(Somewhat different topic) I want to start with the traditional “PayPal standard”, but then setup “PayPal Payments Pro” for direct credit card processing. Is there overlap in configuring the two on Scipio, or are they entirely different animals?

I can start a new thread on this, if that would be preferable.


#15

That would be great - simply so that we are not mixing topics here.


#16

Hi Buvin,

Correct, they are completely different animals. What you are editing is the former Paypal implementation based in the old API. What you want to configure is the Paypal implementation that uses the new REST API.
To do so, you have two alternatives:

  1. Go to https://localhost:8443/admin/control/ViewGeneric?entityName=PaymentGatewayPayPalRest&paymentGatewayConfigId=PAYPAL_REST_CFG&enableEdit=true and fill out the fields with your Paypal account data
  2. This is more like a fallback, edit ./addons/paypal/config/paypal.properties and add the corresponding values.

#17

As a side note, we will fix soon the screen where you can edit in a more convenient way: https://localhost:8443/accounting/control/EditPaymentGatewayConfig?paymentGatewayConfigId=PAYPAL_REST_CFG


#18

To answer your other question:

If you are interested in the technical things - check out addons/paypal/data/PaypalDemoData.xml

The following entry is what matches the API specs:

     <PaymentGatewayPayPalRest paymentGatewayConfigId="PAYPAL_REST_CFG" clientId="AUEJqr6N9UiGntvEJ-Gsn9cw2eTW4MjcUl1KZc3X-jpJAmiKKa342r5z8q9SSpWpmOWYr-a7yB7Uc6y6" secret="EJXE5EC3pbGJvfwWG6fQNobcWXsxpJQ_Zu1EvvdWdZ_E0T9ZgLyxhQOjrGeF0pHO6XGanD9cIp-LhwaY" paymentReturnUrl="returnPaymentPayPalRest" paymentCancelUrl="cancelPaymentPayPalRest" billingAgreementReturnUrl="returnBillingAgreementPayPalRest" billingAgreementCancelUrl="cancelBillingAgreementPayPalRest" />`

The way it works is this:

Basically on checkout we internally create the order, then forward the customer to paypal (the paypal address is autogenerated based on the paypal configuration). We do a handshake in the background in which we also provide paypal with return, cancellation and notification urls. Those are autogenerated based on the shop url and the string added in PaymentGatewayPayPalRest attributes. The customer will do his thing there and paypal will return him to either the return or cancel url. Scipio ERP will receive updates on the payment status afterwards on the notification url provided. Since we autogenerate these, there isn’t too much you have to do. We can then update the order and payment info based on this data. Default values exist for these, i think you were only looking at the wrong file :slight_smile:


#19

Excellent! Thanks for all the explanations!

I will proceed with the ant data seed loading and await notice for the git patch.


#20

The changes have been pushed to github.


#21

If you already pulled from github, please pull again - we had to apply another fix.


#22

Thanks. I’ve haven’t gotten a chance to try yet, but hopefully I can get to that today. Where are the commits going? I don’t see anything on https://gitlab.ilscipio.com/SCIPIO-ERP/paypal. Are these patches going into the core project? If so, what branch? Is there a “hot fix” branch for this? (before I find myself in larger merging issues potentially)


#23

These are pushed to master for now. There is a branch but for now you should stick with master.