Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

charge on Braintree #3470

Merged
merged 22 commits into from
May 28, 2015
Merged

charge on Braintree #3470

merged 22 commits into from
May 28, 2015

Conversation

chadwhitacre
Copy link
Contributor

Closes #3287.

@chadwhitacre chadwhitacre added this to the Balanced shutdown milestone May 21, 2015
@chadwhitacre
Copy link
Contributor Author

I don't see that we had tests for fetch_card_holds that actually hit Balanced. I ran this test and it canceled a few dozen card holds in our Balanced sandbox.

@rohitpaulk
Copy link
Contributor

@whit537 - I'll take this over, you could focus on using the Balanced -> Braintree migration data. Sound good?

@chadwhitacre
Copy link
Contributor Author

@rohitpaulk Roger that.

@chadwhitacre
Copy link
Contributor Author

It looks like customer id is an editable field. The id for customers brought over from Balanced is their Balanced customer id.

@chadwhitacre
Copy link
Contributor Author

In other words, we don't need a separate Participant ID in custom_fields. We could just use Gratipay's participant.id as the customer id at Braintree.

@chadwhitacre
Copy link
Contributor Author

Moving to #3391 ...

@rohitpaulk
Copy link
Contributor

@whit537 - 59ca2f3

@chadwhitacre
Copy link
Contributor Author

Good look.

@rohitpaulk
Copy link
Contributor

The transaction has been submitted for settlement and will be included in the next settlement batch. Settlement happens nightly — the exact time depends on the processor.

Looks like we can't capture card holds immediately like with Balanced.

@chadwhitacre
Copy link
Contributor Author

Looks like we can't capture card holds immediately like with Balanced.

Yeah, Balanced floated us the money (i.e., they made it available to us in our escrow immediately, even though they didn't actually get the money from the acquiring bank until the next day). This came up in my meeting with Citizens last week. It's not a big deal for now since we have enough in escrow to float the different for a day. As we gain more experience with Braintree and as we reduce escrow (#1383) we'll have to maybe rethink our timing of card captures vs. payouts.

@chadwhitacre
Copy link
Contributor Author

The main point is that card captures are almost certain to settle without incident, so there's little risk in floating for a day if we can make it work cash-flow-wise. Once we have a hold/authorization, we can count on the funds landing in our bank account sooner or later.

@rohitpaulk
Copy link
Contributor

Once we have a hold/authorization, we can count on the funds landing in our bank account sooner or later.

Cool, so I'll proceed with the assumption that a transaction that is authorized and then submitted_for_settlement is good enough to add to the user's balance.

@chadwhitacre
Copy link
Contributor Author

Cool, so I'll proceed with the assumption that a transaction that is authorized and then submitted_for_settlement is good enough to add to the user's balance.

Yup. We'll keep an eye out, and if we end up getting burned by this assumption down the road then we'll adjust.

@chadwhitacre chadwhitacre mentioned this pull request May 21, 2015
@chadwhitacre
Copy link
Contributor Author

@rohitpaulk One test failure, ya?

@rohitpaulk
Copy link
Contributor

@whit537 - Has to do with how we cleanup stuff in the Braintree test sandbox, I'm working on a fix.

@rohitpaulk
Copy link
Contributor

Since I was in a hurry, I neglected changing to Braintree's nomenclature (and I probably left a few import pdb; pdb.set_trace()s around). We aren't running on Braintree today, I'll revisit this tomorrow.

@chadwhitacre chadwhitacre mentioned this pull request May 28, 2015
log(msg + "succeeded.")
error = ""
result = braintree.Transaction.sale({
'amount': str(cents/100.0),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we in danger of float errors here? Why type is cents?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cents is an int.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You positive? I thought it was a Decimal here. Regardless, if Braintree accepts dollars we should just pass dollars. We only convert to cents in _prep_hit because Balanced wanted cents (though does ach_credit also use _prep_hit)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading correctly, cents comes from _prep_hit - and https://github.com/gratipay/gratipay.com/blob/master/gratipay/billing/exchanges.py#L288

We only convert to cents in _prep_hit because Balanced wanted cents

True. I wanted to minimize the code changes here, that's why I reused the function.

though does ach_credit also use _prep_hit

No, it doesn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to minimize the code changes here, that's why I reused the function.

Yeah, we can clean that up later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reticketed as #3500.

chadwhitacre added a commit that referenced this pull request May 28, 2015
@chadwhitacre chadwhitacre merged commit f1362eb into master May 28, 2015
@chadwhitacre chadwhitacre deleted the charge-on-braintree branch May 28, 2015 21:48
@chadwhitacre
Copy link
Contributor Author

!m @rohitpaulk

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

migrate to Braintree
2 participants