CRM-17469 Online pledge payment credits scheduled amount, not actual amount

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Critical
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.6.9
    • Fix Version/s: 4.7
    • Component/s: CiviPledge
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      When an online pledge payment is made, the scheduled amount is credited for each payment check box selected regardless of the actual amount paid. For example, if the next pending pledge payment due is $100, and a pledge payment of $50 is made, the full $100 amount is credited to the pledge.

      Obviously, this is a significant error in pledge processing and, to my astonishment, it has always worked this way.

      To reproduce on the demo site:

      1. Create a contribution page with the pledge option enabled and use the Test payment processor.
      2. Create a new pledge of $1200 at $100 per month starting 1/1/2015 and select the Self-service Payments Page
      3. Go to the online pledge payment URL: /civicrm/contribute/transact?reset=1&id=[contrib page id]&cid=[contact id]&pledgeId=[pledge id]
      4. Enter a payment amount of $50 and leave all pledge payment check boxes checked.
      5. Submit the contribution using Visa #4111111111111111, exp: 05/2016, cvv2: 000
      6. Go to the Pledge tab for the contact and notice that $100 has been credited for each of the overdue payments and the next scheduled payment, even though only $50 was paid.

      I have coded a fix for this problem and will attach a patch shortly.

        Attachments

          Activity

          [CRM-17469] Online pledge payment credits scheduled amount, not actual amount
          Marty Wright added a comment -

          This patch does the following:

          1. Initializes the amount field on the online pledge payment form with the total of all payments that are checked. Prior to the patch, the field was blank and the user needed to calculate the total amount themselves.
          2. Recalculates the amount field any time a payment check box changes.
          3. Upon submission, allocates the actual amount paid to each of the selected payments, even if it results in a partial pledge payment or an over payment.
          David Greenberg added a comment -

          Marty Wright Thanks for reporting, diagnosing and proposing a fix! If you're able to submit your patch as a Pull Request on Github - that would be super helpful.

          Marty Wright added a comment -

          Created my first pull request. Let me know if I did anything wrong. Thanks!

          David Greenberg added a comment -

          Marty Wright Awesome! We'll do a full review / QA cycle shortly.

            People

            • Assignee:
              Yashodha Chaku
              Reporter:
              Marty Wright

              Dates

              • Created:
                Updated:
                Resolved: