{"action":"created","issue":{"url":"https://api.github.com/repos/civicrm/civicrm-core/issues/12387","repository_url":"https://api.github.com/repos/civicrm/civicrm-core","labels_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/12387/labels{/name}","comments_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/12387/comments","events_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/12387/events","html_url":"https://github.com/civicrm/civicrm-core/pull/12387","id":337318798,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4NTQwNjY5","number":12387,"title":"dev/financial#27 Paypal_Standard recurring IPNs don't work","user":{"login":"mattwire","id":2052161,"node_id":"MDQ6VXNlcjIwNTIxNjE=","avatar_url":"https://avatars1.githubusercontent.com/u/2052161?v=4","gravatar_id":"","url":"https://api.github.com/users/mattwire","html_url":"https://github.com/mattwire","followers_url":"https://api.github.com/users/mattwire/followers","following_url":"https://api.github.com/users/mattwire/following{/other_user}","gists_url":"https://api.github.com/users/mattwire/gists{/gist_id}","starred_url":"https://api.github.com/users/mattwire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattwire/subscriptions","organizations_url":"https://api.github.com/users/mattwire/orgs","repos_url":"https://api.github.com/users/mattwire/repos","events_url":"https://api.github.com/users/mattwire/events{/privacy}","received_events_url":"https://api.github.com/users/mattwire/received_events","type":"User","site_admin":false},"labels":[{"id":246037889,"node_id":"MDU6TGFiZWwyNDYwMzc4ODk=","url":"https://api.github.com/repos/civicrm/civicrm-core/labels/master","name":"master","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-07-01T20:17:33Z","updated_at":"2018-07-23T17:10:29Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/12387","html_url":"https://github.com/civicrm/civicrm-core/pull/12387","diff_url":"https://github.com/civicrm/civicrm-core/pull/12387.diff","patch_url":"https://github.com/civicrm/civicrm-core/pull/12387.patch"},"body":"Overview\r\n----------------------------------------\r\nCurrently you can setup recurring payments using the Paypal Standard processor, but after the first IPN is processed subsequent IPNs do not get processed because the IPN code does not fully implement code to do so and fails to identify the correct payment processor in CiviCRM if the \"business\" email does not match.\r\n\r\nBy replacing the call to completetransaction with one to repeattransaction we have working recurring IPNs for paypal standard.\r\n\r\nSee: https://lab.civicrm.org/dev/financial/issues/27\r\n\r\n- \"business\" email does not necessarily match the \"Merchant Account Email\" defined for the payment processor. Currently this causes the IPN to silently fail as it cannot identify the payment processor. Fix: A new function getPayPalPaymentProcessorID() based on the one used by PayPalPro IPN is implemented (a future improvement could be to make this a shared function).\r\n- \"receive_date\" is being set to the date/time the IPN was processed instead of using the \"payment_date\" specified in the IPN response. Fix: We now use the \"payment_date\" if it is available.\r\n- Subsequent contributions not being created. On the client site I tested this on NONE of the subsequent transactions were being processed - I assumed this was because we are using CompleteTransaction function instead of calling the API Contribution.repeattransaction. It may, in part have been caused by the bad lookup for the payment processor (see above). However, on further testing and looking at the testIPNPaymentRecurSuccess() test, whilst I can see that the test \"Passes\" I can also see that it is not creating the subsequent contributions correctly (they have a different payment_instrument and the total_amount is different for both contributions because it is not using the value passed by the mock IPN response. Fix: I've updated this PR to include improvements to the unit test to make sure we capture those issues - it should pass when run with the other changes in this PR but fail if the other changes are not applied.\r\n\r\nBefore\r\n----------------------------------------\r\nPaypal Standard recurring IPNs do not work properly\r\n\r\nAfter\r\n----------------------------------------\r\nPaypal Standard recurring IPNs work properly.\r\n\r\nTechnical Details\r\n----------------------------------------\r\nSwitch to calling the internal function completetransaction to the API repeattransaction which is the \"correct\" thing to do.\r\n\r\nComments\r\n----------------------------------------\r\nThis has been tested on a live site, and has been used with nz.co.fuzion.notificationlog to replay six months of IPNs that were received by CiviCRM but not acted on.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/civicrm/civicrm-core/issues/comments/407131981","html_url":"https://github.com/civicrm/civicrm-core/pull/12387#issuecomment-407131981","issue_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/12387","id":407131981,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzEzMTk4MQ==","user":{"login":"mattwire","id":2052161,"node_id":"MDQ6VXNlcjIwNTIxNjE=","avatar_url":"https://avatars1.githubusercontent.com/u/2052161?v=4","gravatar_id":"","url":"https://api.github.com/users/mattwire","html_url":"https://github.com/mattwire","followers_url":"https://api.github.com/users/mattwire/followers","following_url":"https://api.github.com/users/mattwire/following{/other_user}","gists_url":"https://api.github.com/users/mattwire/gists{/gist_id}","starred_url":"https://api.github.com/users/mattwire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattwire/subscriptions","organizations_url":"https://api.github.com/users/mattwire/orgs","repos_url":"https://api.github.com/users/mattwire/repos","events_url":"https://api.github.com/users/mattwire/events{/privacy}","received_events_url":"https://api.github.com/users/mattwire/received_events","type":"User","site_admin":false},"created_at":"2018-07-23T17:10:29Z","updated_at":"2018-07-23T17:10:29Z","author_association":"CONTRIBUTOR","body":"@eileenmcnaughton @pradpnayak I've removed the is_email_receipt parameter as that's not critical to this PR.  @pradpnayak Can you confirm if you are happy this should be merged now?"}}
{"actor":{"display_login":"mattwire"}}