Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Enhancements for Partial payment Payments #15696

Conversation

magnolia61
Copy link
Contributor

@magnolia61 magnolia61 commented Nov 1, 2019

Overview

Enable the "Pay now" button on the userdashboard for 'partially paid' payments .
Use case:

Event Fee:    50 euro
Already paid: 20 euro
Balance due:  30 euro

Before

Only for contributions with status "Pending" the "Pay Now" button was shown

After

For contributions with status "Pending" and "Partially paid" the 'Pay now' button is shown.
Using the Pay Now button the following contribution page shows the proper balance due (30 euro).
After payment of this the contribution is completed.

user dashboard:
Screenshot from 2019-11-01 21-37-31
payment screen:
Screenshot from 2019-11-01 21-38-05

Technical Details

All changes of the past period Eileen made to the payment.create api made it very easy to enable this because it is already supported.

Comments

This is a follow up of #12319

Remaining bugs:

bug 1: the paid remaining amount (30 euro) overrides the Contribution Total (this changed from 50 to 30)
bug 2: the contribution date gets overwritten by the date of the current payment

WIP:

a. Send the Additional Payment receipt instead of the 'Event Confirmation' mail
b. Show Partially paid details on the contribution invoice (the pdf ignores these atm)

@civibot
Copy link

civibot bot commented Nov 1, 2019

(Standard links)

@civibot civibot bot added the master label Nov 1, 2019
@magnolia61 magnolia61 force-pushed the Enhancements_for_Partial_payment_Payments branch 2 times, most recently from 1a4eb13 to 70790cb Compare November 1, 2019 11:01
@magnolia61 magnolia61 closed this Nov 1, 2019
@magnolia61 magnolia61 force-pushed the Enhancements_for_Partial_payment_Payments branch from 70790cb to 40143ea Compare November 1, 2019 11:02
@magnolia61 magnolia61 reopened this Nov 1, 2019
@magnolia61 magnolia61 force-pushed the Enhancements_for_Partial_payment_Payments branch 5 times, most recently from bbf75a3 to 4aba5ec Compare November 1, 2019 12:48
@magnolia61 magnolia61 changed the title Enhancements for Partial payment Payments [WIP] Enhancements for Partial payment Payments Nov 1, 2019
@magnolia61 magnolia61 force-pushed the Enhancements_for_Partial_payment_Payments branch 17 times, most recently from 429db01 to 8cbe87f Compare November 1, 2019 18:49
@magnolia61 magnolia61 force-pushed the Enhancements_for_Partial_payment_Payments branch from 8cbe87f to 00af3cc Compare November 1, 2019 18:58
@magnolia61 magnolia61 force-pushed the Enhancements_for_Partial_payment_Payments branch 5 times, most recently from f5cace9 to 10d265f Compare November 2, 2019 11:26
CRM_Core_Error::statusBounce(ts("This contribution is already fully paid."));
}
$contribution = civicrm_api3('Contribution', 'getsingle', array('id' => $this->_ccid));
if ($contribution['contribution_status'] == 'Pending' || $contribution['contribution_status'] == 'Partially paid') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can't use 'contribution_status' since its a label field(correct me if i am wrong) which can be changed from UI.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If (in_array($contribution['contribution_status'], ['Pending', 'Partially Paid'])) {

}
$contribution = civicrm_api3('Contribution', 'getsingle', array('id' => $this->_ccid));
if ($contribution['contribution_status'] == 'Pending' || $contribution['contribution_status'] == 'Partially paid') {
$totalAmount = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $this->_ccid, 'total_amount');
Copy link
Contributor

@pradpnayak pradpnayak Feb 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this->assign('contribution_total', $contribution['total_amount']);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// This is required for tpl logic. We should move away from hard-code this to adding an array of actions to the row
// which the tpl can iterate through - this should allow us to cope with competing attempts to add new buttons
// and allow extensions to assign new ones through the pageRun hook
if ('Pending' === CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $row['contribution_status_id'])) {
if ('Pending' === CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $row['contribution_status_id']) || 'Partially paid' === CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $row['contribution_status_id'])) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be simplified as

$statusName = CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $row['contribution_status_id']);
if (in_array($statusName , ['Pending', 'Partially Paid'])) {

@magnolia61 magnolia61 force-pushed the Enhancements_for_Partial_payment_Payments branch 2 times, most recently from 1896183 to 1e65fc2 Compare February 19, 2020 08:19
@magnolia61 magnolia61 force-pushed the Enhancements_for_Partial_payment_Payments branch 2 times, most recently from dcc4f31 to bdcdbcf Compare February 19, 2020 15:05
@magnolia61 magnolia61 force-pushed the Enhancements_for_Partial_payment_Payments branch from bdcdbcf to bfc0576 Compare February 19, 2020 15:13
@eileenmcnaughton
Copy link
Contributor

Closing as in WIP long-term. Please Re-open when reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants