Summary: | Add hook to OPAC payments to allow plugins to set minimum payment threshold | ||
---|---|---|---|
Product: | Koha | Reporter: | Agustín Moyano <agustinmoyano> |
Component: | Plugin architecture | Assignee: | Agustín Moyano <agustinmoyano> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | fridolin.somers, kyle, martin.renvoize, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26193 | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
19.11.00
|
|
Circulation function: | |||
Bug Depends on: | 23214 | ||
Bug Blocks: | 20211, 23118, 23868 | ||
Attachments: |
Bug 23213: Enable minimum payment threshold check in OPAC
Bug 23213: Enable minimum payment threshold check in OPAC Bug 23213: Enable minimum payment threshold check in OPAC |
Description
Agustín Moyano
2019-06-26 03:31:37 UTC
Change this line
> If the amount that the patron is lower than the threshold declared by the
> plugin then payment is not allowed.
for:
If the amount the patron is about to pay is lower than the threshold declared by the plugin then payment is not allowed for that specific plugin.
> Plugins that defines a threshold should declare a new hook named
named opac_online_payment_threshold
Created attachment 91122 [details] [review] Bug 23213: Enable minimum payment threshold check in OPAC This patch enables OPAC to check for the miminum payment threshold per payment method. If the total amount to pay is less than the threshold, payment for that method is disabled. To test: 1) apply dependencies 2) get 2 payment plugins, one with threshold as https://gitlab.com/thekesolutions/plugins/koha-plugin-pay-via-paypal/uploads/4c66444ff697586dff3d8759c1e5746c/koha-plugin-pay-via-paypal-v1.0.0.kpz and one without threshold as https://github.com/bywatersolutions/koha-plugin-pay-via-paygov/releases/download/v1.0.5/koha-plugin-pay-via-paygov-v1.0.5.kpz 3) install both plugins 4) Configure both plugins to work correctly (can be invented data.. we are not interested in the actual payment page, but to test if payment method is allowed) 5) In plugin with threshold, set minimum threshold to 10 6) Fetch any user, and create 2 manual invoices, both for the amount of 5 7) Enter OPAC as user, and go to "my fines" tab CHECK => both plugins appear as payment method 8) Check the checkbox of one of the fines SUCCESS => plugin with threshold is now disabled, and has a warning message that says "Minimum amount needed by this service is 10.00" => plugin without threshold is enabled => if plugin with threshold was selected, "Make payment" button is disabled until an enabled payment method is selected 9) Check the second checkbox SUCCESS => both payment methods are now enabled 10) Sign off As a note to this one.. I think it really ought to have been written independently of bug 23214 really.. it was a surprise to see that as a dependency here as really they're pretty unrelated changes. I will however on this occasion look to testing both to save you a refactor. On second thoughts.. the tree beneath bug 23214 is fairly large and currently blocked by an FQA bug.. will wait on that to test this, but in effect, it means this bug is blocked.. (In reply to Martin Renvoize from comment #4) > As a note to this one.. I think it really ought to have been written > independently of bug 23214 really.. it was a surprise to see that as a > dependency here as really they're pretty unrelated changes. > > I will however on this occasion look to testing both to save you a refactor. My bad. I'll try to take that into account the next time Thanks Created attachment 93140 [details] [review] Bug 23213: Enable minimum payment threshold check in OPAC This patch enables OPAC to check for the miminum payment threshold per payment method. If the total amount to pay is less than the threshold, payment for that method is disabled. To test: 1) apply dependencies 2) get 2 payment plugins, one with threshold as https://gitlab.com/thekesolutions/plugins/koha-plugin-pay-via-paypal/uploads/4c66444ff697586dff3d8759c1e5746c/koha-plugin-pay-via-paypal-v1.0.0.kpz and one without threshold as https://github.com/bywatersolutions/koha-plugin-pay-via-paygov/releases/download/v1.0.5/koha-plugin-pay-via-paygov-v1.0.5.kpz 3) install both plugins 4) Configure both plugins to work correctly (can be invented data.. we are not interested in the actual payment page, but to test if payment method is allowed) 5) In plugin with threshold, set minimum threshold to 10 6) Fetch any user, and create 2 manual invoices, both for the amount of 5 7) Enter OPAC as user, and go to "my fines" tab CHECK => both plugins appear as payment method 8) Check the checkbox of one of the fines SUCCESS => plugin with threshold is now disabled, and has a warning message that says "Minimum amount needed by this service is 10.00" => plugin without threshold is enabled => if plugin with threshold was selected, "Make payment" button is disabled until an enabled payment method is selected 9) Check the second checkbox SUCCESS => both payment methods are now enabled 10) Sign off Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Does what is says on the tin, Signing off. Created attachment 93144 [details] [review] Bug 23213: Enable minimum payment threshold check in OPAC This patch enables OPAC to check for the miminum payment threshold per payment method. If the total amount to pay is less than the threshold, payment for that method is disabled. To test: 1) apply dependencies 2) get 2 payment plugins, one with threshold as https://gitlab.com/thekesolutions/plugins/koha-plugin-pay-via-paypal/uploads/4c66444ff697586dff3d8759c1e5746c/koha-plugin-pay-via-paypal-v1.0.0.kpz and one without threshold as https://github.com/bywatersolutions/koha-plugin-pay-via-paygov/releases/download/v1.0.5/koha-plugin-pay-via-paygov-v1.0.5.kpz 3) install both plugins 4) Configure both plugins to work correctly (can be invented data.. we are not interested in the actual payment page, but to test if payment method is allowed) 5) In plugin with threshold, set minimum threshold to 10 6) Fetch any user, and create 2 manual invoices, both for the amount of 5 7) Enter OPAC as user, and go to "my fines" tab CHECK => both plugins appear as payment method 8) Check the checkbox of one of the fines SUCCESS => plugin with threshold is now disabled, and has a warning message that says "Minimum amount needed by this service is 10.00" => plugin without threshold is enabled => if plugin with threshold was selected, "Make payment" button is disabled until an enabled payment method is selected 9) Check the second checkbox SUCCESS => both payment methods are now enabled 10) Sign off Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Nice work! Pushed to master for 19.11.00 Depends on Bug 23214 not in 19.05.x Should we add this to https://wiki.koha-community.org/wiki/Koha_Plugin_Hooks? We certainly should, well spotted Katrin. Agustin, could you take care of adding this? (In reply to Martin Renvoize from comment #13) > We certainly should, well spotted Katrin. Agustin, could you take care of > adding this? Thanks Katrin for spotting it. Hook description was added. |