From 4b413ceb718af49310e79b518b8cc34dc09c9dad Mon Sep 17 00:00:00 2001 From: Seb Insua Date: Thu, 30 Mar 2017 13:06:52 +0100 Subject: [PATCH 1/4] fix(build): osx makes this harder to build and i do not have time --- Cargo.lock | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 6 ++++++ 2 files changed, 65 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 21b0c44..bcde135 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -461,3 +461,62 @@ dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[metadata] +"checksum aho-corasick 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2b3fb52b09c1710b961acb35390d514be82e4ac96a9969a8e38565a29b878dc9" +"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" +"checksum chrono 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)" = "a714b6792cb4bb07643c35d2a051d92988d4e296322a60825549dd0764bcd396" +"checksum cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0e3d6405328b6edb412158b3b7710e2634e23f3614b9bb1c412df7952489a626" +"checksum docopt 0.6.81 (registry+https://github.com/rust-lang/crates.io-index)" = "323b5c50646d8d3f26c826eb62c15659b2bc031831d56bcdb02e0e49c5b73829" +"checksum env_logger 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "82dcb9ceed3868a03b335657b85a159736c961900f7e7747d3b0b97b9ccb5ccb" +"checksum gcc 0.3.32 (registry+https://github.com/rust-lang/crates.io-index)" = "dcb000abd6df9df4c637f75190297ebe56c1d7e66b56bbf3b4aa7aece15f61a2" +"checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518" +"checksum hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2da7d3a34cf6406d9d700111b8eafafe9a251de41ae71d8052748259343b58" +"checksum httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "46534074dbb80b070d60a5cb8ecadd8963a00a438ae1a95268850a7ef73b67ae" +"checksum hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)" = "eb27e8a3e8f17ac43ffa41bbda9cf5ad3f9f13ef66fa4873409d4902310275f7" +"checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11" +"checksum itertools 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ac6e56e7cfd710efcf4c4f614bd101794845d9fe5f406b87ac5108b9153d033f" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" +"checksum lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49247ec2a285bb3dcb23cbd9c35193c025e7251bfce77c1d5da97e6362dffe7f" +"checksum libc 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "39dfaaa0f4da0f1a06876c5d94329d739ad0150868069cc235f1ddf80a0480e7" +"checksum libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "cbc058951ab6a3ef35ca16462d7642c4867e6403520811f28537a4e2f2db3e71" +"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054" +"checksum matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "15305656809ce5a4805b1ff2946892810992197ce1270ff79baded852187942e" +"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" +"checksum mime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf93a79c700c9df8227ec6a4f0f27a8948373c079312bac24549d944cef85f64" +"checksum num 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "d2ee34a0338c16ae67afb55824aaf8852700eb0f77ccd977807ccb7606b295f6" +"checksum num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "fb24d9bfb3f222010df27995441ded1e954f8f69cd35021f6bef02ca9552fb92" +"checksum num-iter 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "287a1c9969a847055e1122ec0ea7a5c5d6f72aad97934e131c83d5c08ab4e45c" +"checksum num-traits 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "95e58eac34596aac30ab134c8a8da9aa2dc99caa4b4b4838e6fc6e298016278f" +"checksum num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "cee7e88156f3f9e19bdd598f8d6c9db7bf4078f99f8381f43a55b09648d1a6e3" +"checksum openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "c4117b6244aac42ed0150a6019b4d953d28247c5dd6ae6f46ae469b5f2318733" +"checksum openssl-sys 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ac5e9d911dd4c3202bbf4139b73bc7a1231f7d0a39432c6f893745f0e04120" +"checksum openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "11c5e1dba7d3d03d80f045bf0d60111dc69213b67651e7c889527a3badabb9fa" +"checksum openssl-verify 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed86cce894f6b0ed4572e21eb34026f1dc8869cb9ee3869029131bc8c3feb2d" +"checksum pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8cee804ecc7eaf201a4a207241472cc870e825206f6c031e3ee2a72fa425f2fa" +"checksum pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "61c9231d31aea845007443d62fcbb58bb6949ab9c18081ee1e09920e0cf1118b" +"checksum rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2791d88c6defac799c3f20d74f094ca33b9332612d9aef9078519c82e4fe04a5" +"checksum regex 0.1.73 (registry+https://github.com/rust-lang/crates.io-index)" = "56b7ee9f764ecf412c6e2fff779bca4b22980517ae335a21aeaf4e32625a5df2" +"checksum regex-syntax 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "31040aad7470ad9d8c46302dcffba337bb4289ca5da2e3cd6e37b64109a85199" +"checksum rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "6159e4e6e559c81bd706afe9c8fd68f547d3e851ce12e76b1de7914bab61691b" +"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" +"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" +"checksum solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "172382bac9424588d7840732b250faeeef88942e37b6e35317dce98cafdd75b2" +"checksum strsim 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e4d73a2c36a4d095ed1a6df5cbeac159863173447f7a82b3f4757426844ab825" +"checksum tabwriter 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "85dbf563da2891d55ef4b00ef08c5b5f160143f67691ff1f97ad89e77824ed3b" +"checksum tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0b62933a3f96cd559700662c34f8bab881d9e3540289fb4f368419c7f13a5aa9" +"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" +"checksum thread_local 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "55dd963dbaeadc08aa7266bf7f91c3154a7805e32bb94b820b769d2ef3b4744d" +"checksum time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7ec6d62a20df54e07ab3b78b9a3932972f4b7981de295563686849eb3989af" +"checksum traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "07eaeb7689bb7fca7ce15628319635758eda769fed481ecfe6686ddef2600616" +"checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" +"checksum unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "13a5906ca2b98c799f4b1ab4557b76367ebd6ae5ef14930ec841c74aed5f3764" +"checksum unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f7ceb96afdfeedee42bade65a0d585a6a0106f681b6749c8ff4daa8df30b3f" +"checksum unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "26643a2f83bac55f1976fb716c10234485f9202dcd65cfbdf9da49867b271172" +"checksum unicode-width 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6722facc10989f63ee0e20a83cd4e1714a9ae11529403ac7e0afd069abc39e" +"checksum url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8ab4ca6f0107350f41a59a51cb0e71a04d905bc6a29181d2cb42fa4f040c65c9" +"checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47" +"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum yup-hyper-mock 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "397ab5202cb362d25349d82e25b4d39ef941ed6c905b69902d40c476a371b63a" diff --git a/README.md b/README.md index cd61a94..e6404a6 100644 --- a/README.md +++ b/README.md @@ -181,3 +181,9 @@ This relates to the following error: src/openssl_shim.c:1:10: fatal error: 'openssl/hmac.h' file not found #include ``` + +If `brew` complains about not being able to force-link `openssl` then you could try building like this: + +```sh +OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include DEP_OPENSSL_INCLUDE=/usr/local/opt/openssl/include cargo build +``` From 213919d30abf2b5ad5b0c28d63a12722f625f5ec Mon Sep 17 00:00:00 2001 From: Seb Insua Date: Thu, 30 Mar 2017 13:07:52 +0100 Subject: [PATCH 2/4] fix(api): new responses with less structure --- src/api/client.rs | 47 +++---- src/api/inform/get_counterparties.rs | 12 +- src/api/mocks/get-account.http | 30 ++--- src/api/mocks/get-accounts.http | 81 +++++------- src/api/mocks/get-transactions.http | 188 ++++++++++++++++----------- src/command/representations.rs | 2 +- 6 files changed, 190 insertions(+), 170 deletions(-) diff --git a/src/api/client.rs b/src/api/client.rs index 7799920..de33a86 100644 --- a/src/api/client.rs +++ b/src/api/client.rs @@ -9,38 +9,33 @@ use api::error::TellerClientError; pub type ApiServiceResult = Result; -#[derive(Debug, RustcDecodable)] -struct AccountResponse { - data: Account, -} +type AccountResponse = Account; -#[derive(Debug, RustcDecodable)] -struct AccountsResponse { - data: Vec, -} +type AccountsResponse = Vec; -#[derive(Debug, RustcDecodable)] -struct TransactionsResponse { - data: Vec, -} +type TransactionsResponse = Vec; #[derive(Debug, RustcDecodable, Clone)] pub struct Account { - pub name: String, - pub institution: String, - pub id: String, - pub currency: String, - pub bank_code: String, + pub account_number: String, pub balance: String, - pub account_number_last_4: String, + pub bank_code: String, + pub currency: String, + // pub enrollment_id: String, + pub id: String, + pub institution: String, + pub name: String, } #[derive(Debug, RustcDecodable, Clone)] pub struct Transaction { - pub description: String, - pub date: String, - pub counterparty: String, pub amount: String, + pub counterparty: String, + pub date: String, + pub description: String, + // pub id: String, + // pub running_balance: String, + // pub type: String, } pub fn parse_utc_date_from_transaction(t: &Transaction) -> Date { @@ -100,14 +95,14 @@ impl<'a> TellerClient<'a> { let body = try!(self.get_body(&format!("{}/accounts", TELLER_API_SERVER_URL))); let accounts_response: AccountsResponse = try!(json::decode(&body)); - Ok(accounts_response.data) + Ok(accounts_response) } pub fn get_account(&self, account_id: &str) -> ApiServiceResult { let body = try!(self.get_body(&format!("{}/accounts/{}", TELLER_API_SERVER_URL, account_id))); let account_response: AccountResponse = try!(json::decode(&body)); - Ok(account_response.data) + Ok(account_response) } pub fn raw_transactions(&self, @@ -127,7 +122,7 @@ impl<'a> TellerClient<'a> { let body = try!(self.get_body(&url.as_str())); let transactions_response: TransactionsResponse = try!(json::decode(&body)); - Ok(transactions_response.data) + Ok(transactions_response) } #[allow(unused_variables)] @@ -215,7 +210,7 @@ mod tests { currency: "GBP".to_string(), bank_code: "00000000".to_string(), balance: "1000.00".to_string(), - account_number_last_4: "0000".to_string(), + account_number: "00000000".to_string(), }; assert!(true); } @@ -256,7 +251,7 @@ mod tests { assert_eq!("1000.00", account.balance); assert_eq!("GBP", account.currency); assert_eq!("000000", account.bank_code); - assert_eq!("0000", account.account_number_last_4); + assert_eq!("00000000", account.account_number); } #[test] diff --git a/src/api/inform/get_counterparties.rs b/src/api/inform/get_counterparties.rs index f885c4c..57015f6 100644 --- a/src/api/inform/get_counterparties.rs +++ b/src/api/inform/get_counterparties.rs @@ -124,14 +124,12 @@ mod tests { let cpts = teller.get_counterparties("123", &from, &to).unwrap(); assert_eq!("GBP", cpts.currency); - assert_eq!("COUNTERPARTY-3", cpts.counterparties[0].0); - assert_eq!("50.00", cpts.counterparties[0].1); - assert_eq!("COUNTERPARTY-1", cpts.counterparties[1].0); - assert_eq!("55.00", cpts.counterparties[1].1); + assert_eq!("COUNTERPARTY-1", cpts.counterparties[0].0); + assert_eq!("55.00", cpts.counterparties[0].1); + assert_eq!("COUNTERPARTY-4", cpts.counterparties[1].0); + assert_eq!("98.97", cpts.counterparties[1].1); assert_eq!("COUNTERPARTY-2", cpts.counterparties[2].0); - assert_eq!("60.00", cpts.counterparties[2].1); - assert_eq!("COUNTERPARTY-4", cpts.counterparties[3].0); - assert_eq!("98.97", cpts.counterparties[3].1); + assert_eq!("110.00", cpts.counterparties[2].1); } } diff --git a/src/api/mocks/get-account.http b/src/api/mocks/get-account.http index f853fda..2d2a6d0 100644 --- a/src/api/mocks/get-account.http +++ b/src/api/mocks/get-account.http @@ -6,19 +6,19 @@ server: Teller API Connection: keep-alive { - "data":{ - "refreshed_at":"2016-01-28T02:19:22Z", - "name":"current", - "links":{ - "transactions":"https://api.teller.io/accounts/123/transactions", - "self":"https://api.teller.io/accounts/123", - "direct_debits":"https://api.teller.io/accounts/123/direct_debits" - }, - "institution":"natwest", - "id":"123", - "currency":"GBP", - "bank_code":"000000", - "balance":"1000.00", - "account_number_last_4":"0000" - } + "account_number":"00000000", + "balance":"1000.00", + "bank_code":"000000", + "currency":"GBP", + "enrollment_id":"123", + "id":"123", + "institution":"natwest", + "links":{ + "direct_debits":"https://api.teller.io/accounts/123/direct_debits", + "payees": "https://api.teller.io/accounts/123/payees", + "self":"https://api.teller.io/accounts/123", + "standing_orders":"https://api.teller.io/accounts/123/standing_orders", + "transactions":"https://api.teller.io/accounts/123/transactions" + }, + "name":"current" } diff --git a/src/api/mocks/get-accounts.http b/src/api/mocks/get-accounts.http index 9affca7..6e1e9c6 100644 --- a/src/api/mocks/get-accounts.http +++ b/src/api/mocks/get-accounts.http @@ -5,48 +5,39 @@ date: Thu, 28 Jan 2016 13:00:51 GMT server: Teller API Connection: keep-alive -{ - "meta":{ - "pagination":{ - "prev":null, - "next":null, - "last":"https://api.teller.io/accounts?page=1&page_size=250", - "first":"https://api.teller.io/accounts?page=1&page_size=250" - } - }, - "links":{ - "self":"https://api.teller.io/accounts?page=1&page_size=250" - }, - "data":[ - { - "refreshed_at":"2016-01-10T01:09:12Z", - "name":"Savings", - "links":{ - "transactions":"https://api.teller.io/accounts/123/transactions", - "self":"https://api.teller.io/accounts/123", - "direct_debits":"https://api.teller.io/accounts/123/direct_debits" - }, - "institution":"natwest", - "id":"123", - "currency":"GBP", - "bank_code":"000000", - "balance":"10000.00", - "account_number_last_4":"0000" - }, - { - "refreshed_at":"2016-01-10T01:09:13Z", - "name":"Current", - "links":{ - "transactions":"https://api.teller.io/accounts/456/transactions", - "self":"https://api.teller.io/accounts/456", - "direct_debits":"https://api.teller.io/accounts/456/direct_debits" - }, - "institution":"natwest", - "id":"456", - "currency":"GBP", - "bank_code":"000001", - "balance":"1000.00", - "account_number_last_4":"0001" - } - ] -} +[ + { + "account_number":"00000000", + "balance":"10000.00", + "bank_code":"000000", + "currency":"GBP", + "enrollment_id":"123", + "id":"123", + "institution":"natwest", + "links":{ + "direct_debits":"https://api.teller.io/accounts/123/direct_debits", + "payees": "https://api.teller.io/accounts/123/payees", + "self":"https://api.teller.io/accounts/123", + "standing_orders":"https://api.teller.io/accounts/123/standing_orders", + "transactions":"https://api.teller.io/accounts/123/transactions" + }, + "name":"Savings" + }, + { + "account_number":"00000000", + "balance":"1000.00", + "bank_code":"000000", + "currency":"GBP", + "enrollment_id":"456", + "id":"456", + "institution":"natwest", + "links":{ + "direct_debits":"https://api.teller.io/accounts/456/direct_debits", + "payees": "https://api.teller.io/accounts/456/payees", + "self":"https://api.teller.io/accounts/456", + "standing_orders":"https://api.teller.io/accounts/456/standing_orders", + "transactions":"https://api.teller.io/accounts/456/transactions" + }, + "name":"Current" + } +] diff --git a/src/api/mocks/get-transactions.http b/src/api/mocks/get-transactions.http index a7a1854..8533497 100644 --- a/src/api/mocks/get-transactions.http +++ b/src/api/mocks/get-transactions.http @@ -5,89 +5,125 @@ date: Thu, 28 Jan 2016 13:00:51 GMT server: Teller API Connection: keep-alive -{ - "meta":{ - "pagination":{ - "prev":null, - "next":null, - "last":"https://api.teller.io/accounts/123/transactions?page=1&page_size=10", - "first":"https://api.teller.io/accounts/123/transactions?page=1&page_size=10" - } - }, - "links":{ - "self":"https://api.teller.io/accounts/123/transactions?page=1&page_size=10", - "account":"https://api.teller.io/accounts/123" +[ + { + "amount":"-55.00", + "counterparty":"COUNTERPARTY-1", + "date":"2016-01-01", + "description":"Some description", + "id": "c4232041-3e9e-4fae-a418-925f63fbbd20", + "links": { + "self": "https://api.teller.io/accounts/46dfe588-3e56-4a99-8cc6-241ad358d4b1/transactions/c4232041-3e9e-4fae-a418-925f63fbbd20" + }, + "running_balance": "15000.00", + "type":"transaction" }, - "data":[ - { - "type":"transaction", - "description":"Some description", - "date":"2016-01-01", - "counterparty":"COUNTERPARTY-1", - "amount":"-55.00" + { + "amount":"50.00", + "counterparty":"COUNTERPARTY-2", + "date":"2015-12-01", + "description":"Some description", + "id": "c4232041-3e9e-4fae-a418-925f63fbbd20", + "links": { + "self": "https://api.teller.io/accounts/46dfe588-3e56-4a99-8cc6-241ad358d4b1/transactions/c4232041-3e9e-4fae-a418-925f63fbbd20" }, - { - "type":"transaction", - "description":"Some description", - "date":"2015-12-01", - "counterparty":"COUNTERPARTY-2", - "amount":"50.00" + "running_balance": "15000.00", + "type":"transaction" + }, + { + "amount":"-60.00", + "counterparty":"COUNTERPARTY-2", + "date":"2015-11-01", + "description":"Some description", + "id": "c4232041-3e9e-4fae-a418-925f63fbbd20", + "links": { + "self": "https://api.teller.io/accounts/46dfe588-3e56-4a99-8cc6-241ad358d4b1/transactions/c4232041-3e9e-4fae-a418-925f63fbbd20" }, - { - "type":"transaction", - "description":"Some description", - "date":"2015-11-01", - "counterparty":"COUNTERPARTY-2", - "amount":"-60.00" + "running_balance": "15000.00", + "type":"transaction" + }, + { + "amount":"50.00", + "counterparty":"COUNTERPARTY-2", + "date":"2015-10-01", + "description":"Some description", + "id": "c4232041-3e9e-4fae-a418-925f63fbbd20", + "links": { + "self": "https://api.teller.io/accounts/46dfe588-3e56-4a99-8cc6-241ad358d4b1/transactions/c4232041-3e9e-4fae-a418-925f63fbbd20" }, - { - "type":"transaction", - "description":"Some description", - "date":"2015-10-01", - "counterparty":"COUNTERPARTY-3", - "amount":"50.00" + "running_balance": "15000.00", + "type":"transaction" + }, + { + "amount":"-50.00", + "counterparty":"COUNTERPARTY-2", + "date":"2015-09-01", + "description":"Some description", + "id": "c4232041-3e9e-4fae-a418-925f63fbbd20", + "links": { + "self": "https://api.teller.io/accounts/46dfe588-3e56-4a99-8cc6-241ad358d4b1/transactions/c4232041-3e9e-4fae-a418-925f63fbbd20" }, - { - "type":"transaction", - "description":"Some description", - "date":"2015-09-01", - "counterparty":"COUNTERPARTY-3", - "amount":"-50.00" + "running_balance": "15000.00", + "type":"transaction" + }, + { + "amount":"100.00", + "counterparty":"COUNTERPARTY-3", + "date":"2015-08-01", + "description":"Some description", + "id": "c4232041-3e9e-4fae-a418-925f63fbbd20", + "links": { + "self": "https://api.teller.io/accounts/46dfe588-3e56-4a99-8cc6-241ad358d4b1/transactions/c4232041-3e9e-4fae-a418-925f63fbbd20" }, - { - "type":"transaction", - "description":"Some description", - "date":"2015-08-01", - "counterparty":"COUNTERPARTY-3", - "amount":"100.00" + "running_balance": "15000.00", + "type":"transaction" + }, + { + "amount":"150.00", + "counterparty":"COUNTERPARTY-4", + "date":"2015-07-01", + "description":"Some description", + "id": "c4232041-3e9e-4fae-a418-925f63fbbd20", + "links": { + "self": "https://api.teller.io/accounts/46dfe588-3e56-4a99-8cc6-241ad358d4b1/transactions/c4232041-3e9e-4fae-a418-925f63fbbd20" }, - { - "type":"transaction", - "description":"Some description", - "date":"2015-07-01", - "counterparty":"COUNTERPARTY-4", - "amount":"150.00" + "running_balance": "15000.00", + "type":"transaction" + }, + { + "amount":"-50.00", + "counterparty":"COUNTERPARTY-4", + "date":"2015-06-01", + "description":"Some description", + "id": "c4232041-3e9e-4fae-a418-925f63fbbd20", + "links": { + "self": "https://api.teller.io/accounts/46dfe588-3e56-4a99-8cc6-241ad358d4b1/transactions/c4232041-3e9e-4fae-a418-925f63fbbd20" }, - { - "type":"transaction", - "description":"Some description", - "date":"2015-06-01", - "counterparty":"COUNTERPARTY-4", - "amount":"-50.00" + "running_balance": "15000.00", + "type":"transaction" + }, + { + "amount":"-25.00", + "counterparty":"COUNTERPARTY-4", + "date":"2015-05-01", + "description":"Some description", + "id": "c4232041-3e9e-4fae-a418-925f63fbbd20", + "links": { + "self": "https://api.teller.io/accounts/46dfe588-3e56-4a99-8cc6-241ad358d4b1/transactions/c4232041-3e9e-4fae-a418-925f63fbbd20" }, - { - "type":"transaction", - "description":"Some description", - "date":"2015-05-01", - "counterparty":"COUNTERPARTY-4", - "amount":"-25.00" + "running_balance": "15000.00", + "type":"transaction" + }, + { + "amount":"-23.97", + "counterparty":"COUNTERPARTY-4", + "date":"2015-01-01", + "description":"Some description", + "id": "c4232041-3e9e-4fae-a418-925f63fbbd20", + "links": { + "self": "https://api.teller.io/accounts/46dfe588-3e56-4a99-8cc6-241ad358d4b1/transactions/c4232041-3e9e-4fae-a418-925f63fbbd20" }, - { - "type":"transaction", - "description":"Some description", - "date":"2015-01-01", - "counterparty":"COUNTERPARTY-4", - "amount":"-23.97" - } - ] -} + "running_balance": "15000.00", + "type":"transaction" + } +] diff --git a/src/command/representations.rs b/src/command/representations.rs index 4fa5203..850cce6 100644 --- a/src/command/representations.rs +++ b/src/command/representations.rs @@ -26,7 +26,7 @@ pub fn represent_list_accounts(accounts: &Vec, config: &Config) { row_number, account_alias, account.name, - account.account_number_last_4, + account.account_number, account.balance, account.currency); accounts_table = accounts_table + &new_account_row; From 3cbd6a491a20853307c60a8a1bd4b8f4d17b7162 Mon Sep 17 00:00:00 2001 From: Seb Insua Date: Thu, 30 Mar 2017 13:12:20 +0100 Subject: [PATCH 3/4] fix(list-accounts): full account number displayed --- src/command/representations.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command/representations.rs b/src/command/representations.rs index 850cce6..a7db9d6 100644 --- a/src/command/representations.rs +++ b/src/command/representations.rs @@ -22,7 +22,7 @@ pub fn represent_list_accounts(accounts: &Vec, config: &Config) { for (idx, account) in accounts.iter().enumerate() { let row_number = (idx + 1) as u32; let account_alias = config.get_account_alias_for_id(&account.id); - let new_account_row = format!("{} {}\t{}\t****{}\t{}\t{}\n", + let new_account_row = format!("{} {}\t{}\t{}\t{}\t{}\n", row_number, account_alias, account.name, From 6424d9320c484ed7c0c8305a97a97068331db52d Mon Sep 17 00:00:00 2001 From: Seb Insua Date: Thu, 30 Mar 2017 13:20:04 +0100 Subject: [PATCH 4/4] fix(counterparties): original values --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/api/inform/get_counterparties.rs | 12 +++++++----- src/api/mocks/get-transactions.http | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bcde135..550a135 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ [root] name = "teller_cli" -version = "0.0.8" +version = "0.0.9" dependencies = [ "chrono 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 0.6.81 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 88431e7..4ce65b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "teller_cli" -version = "0.0.8" +version = "0.0.9" authors = ["Seb Insua "] [[bin]] diff --git a/src/api/inform/get_counterparties.rs b/src/api/inform/get_counterparties.rs index 57015f6..f885c4c 100644 --- a/src/api/inform/get_counterparties.rs +++ b/src/api/inform/get_counterparties.rs @@ -124,12 +124,14 @@ mod tests { let cpts = teller.get_counterparties("123", &from, &to).unwrap(); assert_eq!("GBP", cpts.currency); - assert_eq!("COUNTERPARTY-1", cpts.counterparties[0].0); - assert_eq!("55.00", cpts.counterparties[0].1); - assert_eq!("COUNTERPARTY-4", cpts.counterparties[1].0); - assert_eq!("98.97", cpts.counterparties[1].1); + assert_eq!("COUNTERPARTY-3", cpts.counterparties[0].0); + assert_eq!("50.00", cpts.counterparties[0].1); + assert_eq!("COUNTERPARTY-1", cpts.counterparties[1].0); + assert_eq!("55.00", cpts.counterparties[1].1); assert_eq!("COUNTERPARTY-2", cpts.counterparties[2].0); - assert_eq!("110.00", cpts.counterparties[2].1); + assert_eq!("60.00", cpts.counterparties[2].1); + assert_eq!("COUNTERPARTY-4", cpts.counterparties[3].0); + assert_eq!("98.97", cpts.counterparties[3].1); } } diff --git a/src/api/mocks/get-transactions.http b/src/api/mocks/get-transactions.http index 8533497..2a4b64c 100644 --- a/src/api/mocks/get-transactions.http +++ b/src/api/mocks/get-transactions.http @@ -44,7 +44,7 @@ Connection: keep-alive }, { "amount":"50.00", - "counterparty":"COUNTERPARTY-2", + "counterparty":"COUNTERPARTY-3", "date":"2015-10-01", "description":"Some description", "id": "c4232041-3e9e-4fae-a418-925f63fbbd20", @@ -56,7 +56,7 @@ Connection: keep-alive }, { "amount":"-50.00", - "counterparty":"COUNTERPARTY-2", + "counterparty":"COUNTERPARTY-3", "date":"2015-09-01", "description":"Some description", "id": "c4232041-3e9e-4fae-a418-925f63fbbd20",