Bug 21701

Summary: Have PayPal optionally return to originating OPAC url rather than OPACBaseURL
Product: Koha Reporter: David Kuhn <techservspec>
Component: OPACAssignee: David Kuhn <techservspec>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: katrin.fischer, kyle, techservspec, tgoatley
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23761
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00
Attachments: Bug 21701: Have PayPal optionally return to originating OPAC url rather than OPACBaseURL
Bug 21701: Have PayPal optionally return to originating OPAC url rather than OPACBaseURL
Bug 21701: Have PayPal optionally return to originating OPAC url rather than OPACBaseURL
Bug 21701: Fix up db update

Description David Kuhn 2018-10-26 23:46:33 UTC
We are part of a multi-library consortium that shares a single Koha server. Each of the member libraries has its own unique OPAC URL. When a patron pays a charge online, they are directed to PayPal. When the transaction is completed (or if the patron cancels the payment) they are redirected to the value of OPACBaseURL, not the URL from which the patron was using. This ends up with the ending up on a screen displaying a combination of all our OPACs together.

We would like to have the ability to have the URL of the OPAC the patron is using be sent as the return url sent to PayPal.

This could also be set up as a global option to use either the OPACBaseURL or the OPAC's individual's domain (for systems that would prefer to still use the current method).
Comment 1 David Kuhn 2018-11-08 17:05:49 UTC
Created attachment 82103 [details] [review]
Bug 21701: Have PayPal optionally return to originating OPAC url rather than OPACBaseURL

This enhancement will allow a library to choose whether to use the alias of the current OPAC or the value of OPACBaseURL as the return url when making

payments via PayPal.

To test:
Note: you need to have PayPal enabled on your system (either Sandbox mode or Live) and be using an alias URL for your OPAC.

1. Apply the patch.
2. With the option "PayPalReturnURL" set to "OPACBaseURL", log into a card via the OPAC and start the process to pay in PayPal (you can either complete the

payment or cancel from the PayPal page). When you are returned to the OPAC, the domain will be the value of OPACBaseURL.
3. With the option "PayPalReturnURL" set to "OPAC's alias", repeat the above sequence to make a payment in PayPal. When you are returned to the OPAC, the

domain will be your current alias.
Comment 2 Todd Goatley 2018-11-26 23:13:40 UTC
David, As per your instructions I tried to make payment using PayPal using both OPACBaseURL and OPAC's Alias. I used ByWater's 18.05.05 sandbox and added the patch. After logging in to staff, I created a fine for the koha patron. I then logged into the OPAC and went to pay the fine. I selected the fine to be paid and then pressed the button for Make payment. The message I've received is the following:
Error: there was a problem processing your payment
Unable to verify payment.
Please contact the library to verify your payment.
Comment 3 David Kuhn 2019-09-03 23:55:40 UTC
The following prerequisites are needed to test this patch:
1. Enable PayPal on your system (either Sandbox mode or Live)
2. Set the PayPal credentials PayPalPwd, PayPalSignature, and PayPalUser for the mode selected above
Of course, you also need to be using an alias URL for your OPAC.

If needed, you can set up a PayPal sandbox account at https://developer.paypal.com

To test:
1. Apply the patch.
2. With the option "PayPalReturnURL" set to "OPACBaseURL", log into a card via the OPAC and start the process to pay in PayPal (you can either complete the payment or cancel from the PayPal page). When you are returned to the OPAC, the domain will be the value of OPACBaseURL.
3. With the option "PayPalReturnURL" set to "OPAC's alias", repeat the above sequence to make a payment in PayPal. When you are returned to the OPAC, the domain will be your current alias.

If you get the message:
"Error: there was a problem processing your payment
Unable to verify payment.
Please contact the library to verify your payment."
there may be a problem with the Paypal credentials entered.
Comment 4 Brendan Gallagher 2019-10-02 13:41:10 UTC
Created attachment 93477 [details] [review]
Bug 21701: Have PayPal optionally return to originating OPAC url rather than OPACBaseURL

This enhancement will allow a library to choose whether to use the alias of the current OPAC or the value of OPACBaseURL as the return url when making

payments via PayPal.

To test:
Note: you need to have PayPal enabled on your system (either Sandbox mode or Live) and be using an alias URL for your OPAC.

1. Apply the patch.
2. With the option "PayPalReturnURL" set to "OPACBaseURL", log into a card via the OPAC and start the process to pay in PayPal (you can either complete the

payment or cancel from the PayPal page). When you are returned to the OPAC, the domain will be the value of OPACBaseURL.
3. With the option "PayPalReturnURL" set to "OPAC's alias", repeat the above sequence to make a payment in PayPal. When you are returned to the OPAC, the

domain will be your current alias.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Comment 5 Kyle M Hall 2019-10-07 13:04:14 UTC
*** Bug 23761 has been marked as a duplicate of this bug. ***
Comment 6 Kyle M Hall 2019-10-07 13:24:11 UTC
Created attachment 93821 [details] [review]
Bug 21701: Have PayPal optionally return to originating OPAC url rather than OPACBaseURL

This enhancement will allow a library to choose whether to use the alias of the current OPAC or the value of OPACBaseURL as the return url when making

payments via PayPal.

To test:
Note: you need to have PayPal enabled on your system (either Sandbox mode or Live) and be using an alias URL for your OPAC.

1. Apply the patch.
2. With the option "PayPalReturnURL" set to "OPACBaseURL", log into a card via the OPAC and start the process to pay in PayPal (you can either complete the

payment or cancel from the PayPal page). When you are returned to the OPAC, the domain will be the value of OPACBaseURL.
3. With the option "PayPalReturnURL" set to "OPAC's alias", repeat the above sequence to make a payment in PayPal. When you are returned to the OPAC, the

domain will be your current alias.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Kyle M Hall 2019-10-07 13:24:26 UTC
Created attachment 93822 [details] [review]
Bug 21701: Fix up db update

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 8 Martin Renvoize 2019-10-08 13:53:24 UTC
Nice work!

Pushed to master for 19.11.00