Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-19152

When using taxes and IPN processor, total_amount is reset to $0

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Duplicate
    • Affects Version/s: 4.7.9
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      How to reproduce the error:

      • Use a payment processor that supports IPNs (ex: PayPal Standard? I tested with CMCIC/Monetico)
      • Create an Event, make sure it sends email receipts.
      • Configure taxes, so that event registrations are taxed

      When the participant registers, before the IPN is in, everything is OK. However, once the IPN arrives, the total_amount of the registration gets reset to $0.

      What I think is happening:

      • the payment processor does a Contribution.completetransaction API call (with the contribution_id and trxn_id)
      • completetransaction loads the $contribution object and calls _ipn_process_transaction() in api/v3/Contribution.php
      • nothing too exciting here, then it then calls CRM_Contribute_BAO_Contribution::completeOrder()
      • .. which then calls the Contribution.sendconfirmation API to send an email receipt
      • .. which then calls CRM_Contribute_BAO_Contribution::sendMail()
      • .. which then does an API call to Contribution.create, in order to update the receipt_date

      At this point, Contribution.create does not know the total_amount, and fails to recalculate taxes, so the total_amount becomes $0.

      Backtrace of the above:

      #1 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/api/v3/Contribution.php(85): CRM_Contribute_BAO_Contribution::checkTaxAmount((Array:4))
      #2 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_contribution_create((Array:4))
      #3 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/Civi/API/Kernel.php(96): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9))
      #4 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/api/api.php(23): Civi\API\Kernel->run("Contribution", "create", (Array:3), NULL)
      #5 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/api/api.php(43): civicrm_api("Contribution", "create", (Array:3))
      #6 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(4652): civicrm_api3("Contribution", "create", (Array:2))
      #7 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/api/v3/Contribution.php(404): CRM_Contribute_BAO_Contribution::sendMail((Array:2), (Array:8), "53", (Array:12))
      #8 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_contribution_sendconfirmation((Array:3))
      #9 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/Civi/API/Kernel.php(96): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9))
      #10 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/api/api.php(23): Civi\API\Kernel->run("Contribution", "sendconfirmation", (Array:3), NULL)
      #11 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/api/api.php(43): civicrm_api("Contribution", "sendconfirmation", (Array:3))
      #12 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(4591): civicrm_api3("Contribution", "sendconfirmation", (Array:2))
      #13 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/api/v3/Contribution.php(645): CRM_Contribute_BAO_Contribution::completeOrder((Array:10), (Array:8), (Array:7), Object(CRM_Core_Transaction), FALSE, Object(CRM_Contribute_BAO_Contribution), FALSE, FALSE)
      #14 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/api/v3/Contribution.php(493): _ipn_process_transaction((Array:3), Object(CRM_Contribute_BAO_Contribution), (Array:1), (Array:8))
      #15 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_contribution_completetransaction((Array:3))
      #16 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/Civi/API/Kernel.php(96): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9))
      #17 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/api/api.php(23): Civi\API\Kernel->run("contribution", "completetransaction", (Array:3), NULL)
      #18 /srv/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/api/api.php(43): civicrm_api("contribution", "completetransaction", (Array:3))
      #19 /srv/aegir/platforms/civicrm-4.7/vendor/civicrm/coop.symbiotic.moneticoclassique/CRM/Core/Payment/MoneticoIPN.php(176): civicrm_api3("contribution", "completetransaction", (Array:2))
      #20 /srv/aegir/platforms/civicrm-4.7/vendor/civicrm/coop.symbiotic.moneticoclassique/CRM/Monetico/Page/Monetico.php(17): CRM_Core_Payment_MoneticoIPN->main()

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mlutfy Mathieu Lutfy
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: