braintree / braintree_java

Braintree Java library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
158 stars 98 forks source link

discountAmount returns null when a discount applied to transaction in search results #71

Closed codeniko closed 5 years ago

codeniko commented 5 years ago

General information

Issue description

I have one subscription (initial recurring) transaction in my sandbox environment with a discount applied. When I search for all sale transactions which includes the above discounted transaction, I'm noticing an inconsistency when looking at the returned discountAmount value and discounts object. discounts.size tells me there is 1 discount and discounts[0].amount gives me the correct discount amount value, however discountAmount gives me null every single time.

My TransactionSearchRequest is a simple

TransactionSearchRequest().type().`is`(SALE)
hollabaq86 commented 5 years ago

Hi @codeniko, transaction response objects will have a discountAmount if that value was supplied in the transaction.sale() request that created the transaction.

Transaction response objects will have data in the discounts object if the transaction was created from a subscription that had any discounts applied.

We can make our docs a little more clear about these differences, I'll forward this feedback on to our Docs team.