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

Exchange routes #3282

Merged
merged 22 commits into from
Mar 30, 2015
Merged

Exchange routes #3282

merged 22 commits into from
Mar 30, 2015

Conversation

Changaco
Copy link
Contributor

Closes #1681 and #2446. Unblocks #2824 and #3245.

@rohitpaulk
Copy link
Contributor

How does b6d7f65 solve #1681?

From #2443 (comment) -

Even if we start logging additional information about exchanges it won't fix the past receipts (#1681). If we want to fix those we'll have to do lots of Balanced API queries to retrieve the information.

We don't seem to be doing anything about previous exchanges here - shouldn't we be linking all of them to the respective route(s)?

@Changaco
Copy link
Contributor Author

b6d7f65 solves #1681 in that we won't be showing the wrong credit card anymore. However you're right, I haven't written a script to backfill the route column, so we won't be showing the right credit card either. The issue for that is #2779.

@Changaco
Copy link
Contributor Author

Rebased on master and added a couple of small commits.

@chadwhitacre
Copy link
Contributor

Is "Exchange Routes" a term we're exposing in the UI? Or is that just internal?

@rohitpaulk
Copy link
Contributor

Or is that just internal?

Internal, as far as I've seen.

@chadwhitacre
Copy link
Contributor

Okay. I bring it up because "exchange" in a financial context often means "foreign exchange," so I'm not sure it's the best user-facing term to use.

@rohitpaulk
Copy link
Contributor

I guess I'm the only person who's reviewed this - It is a big change and probably deserves more eyeballs, but I'm merging this in coz it's a blocker.

rohitpaulk added a commit that referenced this pull request Mar 30, 2015
@rohitpaulk rohitpaulk merged commit f279dfb into master Mar 30, 2015
@Changaco Changaco deleted the exchange-routes branch March 30, 2015 07:54
@rohitpaulk
Copy link
Contributor

One thing I just noticed - we haven't modified record-an-exchange.spt.

@rohitpaulk
Copy link
Contributor

Reticketed as #3295

@Changaco
Copy link
Contributor Author

branch.py done. I had to modify it a little:

@@ -1,3 +1,7 @@
+from __future__ import print_function
+
+import traceback
+
 import balanced

 from gratipay import wireup
@@ -56,8 +60,16 @@ with db.get_cursor() as cursor:
             print("processing participant %i/%i" % (i, total))
         customer = customer_from_href(p.balanced_customer_href)
         if p.last_bill_result != None:
-            card = customer.cards.one()
-            insert_exchange_route(p.id, 'balanced-cc', card.href, p.last_bill_result)
+            try:
+                card = customer.cards.one()
+                insert_exchange_route(p.id, 'balanced-cc', card.href, p.last_bill_result)
+            except Exception as e:
+                print('cc', p.id, p.last_bill_result)
+                traceback.print_exc()
         if p.last_ach_result != None:
-            ba = customer.bank_accounts.one()
-            insert_exchange_route(p.id, 'balanced-ba', ba.href, p.last_ach_result)
+            try:
+                ba = customer.bank_accounts.one()
+                insert_exchange_route(p.id, 'balanced-ba', ba.href, p.last_ach_result)
+            except Exception as e:
+                print('ba', p.id, p.last_ach_result)
+                traceback.print_exc()

There were 54 exceptions, all NoResultFound.

@Changaco
Copy link
Contributor Author

Heroku deployment done.

I'm going to run the second part of branch.sql now, and #3249 too. Since liberapay/postgres.py#43 still isn't merged there will be a small downtime.

@Changaco
Copy link
Contributor Author

Final step: updated schema.sql in 9920551. make schema-diff reports no inconsistencies.

@chadwhitacre
Copy link
Contributor

!m @Changaco @rohitpaulk IRC

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

Successfully merging this pull request may close these issues.

wrong credit card on receipt
3 participants