braintree / braintree_php

Braintree PHP library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
545 stars 224 forks source link

"amount" vs. "amountDisputed"? #225

Closed danadesrosiers closed 6 years ago

danadesrosiers commented 6 years ago

General information

Issue description

In the WebhookTesting class, there exists methods to provide sample test XML for dispute notifications. These methods recently got moved to WebhookTestingGateway.

https://github.com/braintree/braintree_php/blob/master/lib/Braintree/WebhookTestingGateway.php#L263-L326

The XML in these methods have a member named "amount". The documentation references a member "amountDisputed", but no member "amount".

https://developers.braintreepayments.com/reference/response/dispute/php#amount_disputed

I am currently referencing "amount" for the disputed amount in production and everything seems to be working. Is the documentation wrong? Are both values sent? I want to make sure I'm referencing the correct field.

Also, shouldn't WebhookTestingGateway::_disputeWonSampleXml() include a member "amount-won", corresponding to "amountWon" mentioned in the docs?

crookedneighbor commented 6 years ago

Thanks for the report. amount-won and amount-disputed are indeed missing. We'll fix this.

amount is a deprecated field from before there was an official disputes API, so it's maintained only for legacy integrations. It is essentially an alias for amount-disputed, and should not be relied upon.

We'll update this issue when the PHP sdk has been released with a fix.

danadesrosiers commented 6 years ago

Excellent. Thank you.

crookedneighbor commented 6 years ago

This is fixed in v3.34.0 https://github.com/braintree/braintree_php/blob/master/CHANGELOG.md#3340