-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathtransfer.py
More file actions
54 lines (39 loc) · 1.82 KB
/
transfer.py
File metadata and controls
54 lines (39 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
__author__ = 'pmb6tz'
from amount import CoinbaseAmount
class CoinbaseTransfer(object):
def __init__(self, transfer):
self.data = transfer
self.type = transfer['type']
self.code = transfer['code']
self.created_at = transfer['created_at']
fees_coinbase_cents = transfer['fees']['coinbase']['cents']
fees_coinbase_currency_iso = transfer['fees']['coinbase']['currency_iso']
self.fees_coinbase = CoinbaseAmount.from_cents(fees_coinbase_cents, fees_coinbase_currency_iso)
fees_bank_cents = transfer['fees']['bank']['cents']
fees_bank_currency_iso = transfer['fees']['bank']['currency_iso']
self.fees_bank = CoinbaseAmount.from_cents(fees_bank_cents, fees_bank_currency_iso)
self.payout_date = transfer['payout_date']
self.transaction_id = transfer.get('transaction_id', '')
self.status = transfer['status']
btc_amount = transfer['btc']['amount']
btc_currency = transfer['btc']['currency']
self.btc_amount = CoinbaseAmount(btc_amount, btc_currency)
subtotal_amount = transfer['subtotal']['amount']
subtotal_currency = transfer['subtotal']['currency']
self.subtotal_amount = CoinbaseAmount(subtotal_amount, subtotal_currency)
total_amount = transfer['total']['amount']
total_currency = transfer['total']['currency']
self.total_amount = CoinbaseAmount(total_amount, total_currency)
self.description = transfer.get('description', '')
def refresh(self):
pass
#TODO: Refresh the transfer
def cancel(self):
pass
#TODO: Cancel the transfer if possible
def complete(self):
pass
#TODO: Approve the transfer if possible
def resend(self):
pass
#TODO: Resend the transfer email if possible