Git Product home page Git Product logo

sbanken-cli's People

Contributors

johnolos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sbanken-cli's Issues

Feature: interactive mode + use `account_nr` primarily

Sbanken with #1 decided to use account_id instead of account_nr.
Account_id is a long hexadecimal, which not only is hard to read, seems estranged to the user.

Going forward, sbanken-cli will expect account_nr instead of account_id, and will do the conversion to account_id behind the scenes before calling the respective APIs.

Changed API as of late May.

Update May 2018

We have stopped using customerId as a part of the API URL. Instead we require all API requests to include the customerId as a http header. See swagger for more information.
We have rolled back all APIs to start on V1
We have stopped using AccountNumber as part of the URL. Instead we require all Account API requests to include the AccountId as retrieved from HTTP GET /Bank/api/v1/Accounts (see powershell script example)
Update of IdentityServer requires Clients to form-urlencode ClientId and Secret prior to Base64-encoding the Authorization header. This is according to specification in RFC6749. See DotNetCoreSampleApplication (updated to IdentityModel 3.6.1 which does this automatically) and ShellScripts example.

error: could not compile `sbanken-cli`

Build fails!

Anything I can do on my side? Don't know rust (yet), but afaik appears code needs various minor patches for deprecated rust functionality.

setup:

λ sw_vers -productVersion; sw_vers -buildVersion;uname -a; which zsh;zsh --version; systemstats|head -n 16; rustc --version

10.15.4
19E287
Darwin 10core.local 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar  4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
/usr/local/bin/zsh
zsh 5.8 (x86_64-apple-darwin19.3.0)

Summary
=======
           System Version:	19E287
           Hardware Model:	iMacPro1,1
                 Board ID:	Mac-7BA5B2D9E42DDD94
    Installed Memory Size:	64GB (68719476736)
                Page Size:	4096
         Root Volume Type:	SSD:1,HDD:0,FUSION:0,FDE:1,RAID:0,TINYSSD:0,IN:1,EX:0,INEX:0,APFS
         Root Volume Size:	1773GB (1904000081920)
                 SSD Name:	APPLE SSD AP2048M
             SSD Revision:	717.100.
     Discrete GPU Present:	0
               Total Time:	183:19:12
          Dashboard Start:	2020-05-18 00:24:41
            Dashboard End:	2020-05-25 15:43:41
rustc 1.43.1

build output:

λ cargo build --release                                                                                master?
   Compiling sbanken-cli v0.4.0 (/Users/storm/Dropbox/Kode/sbanken-cli)
error[E0432]: unresolved imports `hyper::header::Accept`, `hyper::header::Authorization`, `hyper::header::Basic`, `hyper::header::Bearer`, `hyper::header::ContentType`, `hyper::header::Headers`, `hyper::header::UserAgent`
 --> src/core/authorize.rs:4:21
  |
4 | use hyper::header::{Accept, Authorization, Basic, Bearer, ContentType, Headers, UserAgent};
  |                     ^^^^^^  ^^^^^^^^^^^^^  ^^^^^  ^^^^^^  ^^^^^^^^^^^  ^^^^^^^  ^^^^^^^^^ no `UserAgent` in `header`
  |                     |       |              |      |       |            |
  |                     |       |              |      |       |            no `Headers` in `header`
  |                     |       |              |      |       no `ContentType` in `header`
  |                     |       |              |      no `Bearer` in `header`
  |                     |       |              no `Basic` in `header`
  |                     |       no `Authorization` in `header`
  |                     no `Accept` in `header`

warning: trait objects without an explicit `dyn` are deprecated
  --> src/core/error.rs:34:32
   |
34 |     fn cause(&self) -> Option<&error::Error> {
   |                                ^^^^^^^^^^^^ help: use `dyn`: `dyn error::Error`
   |
   = note: `#[warn(bare_trait_objects)]` on by default

error[E0277]: cannot subtract `time::Duration` from `chrono::DateTime<chrono::Utc>`
   --> src/main.rs:159:30
    |
159 |             None => end_date - Duration::days(30),
    |                              ^ no implementation for `chrono::DateTime<chrono::Utc> - time::Duration`
    |
    = help: the trait `std::ops::Sub<time::Duration>` is not implemented for `chrono::DateTime<chrono::Utc>`

error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
  --> src/core/authorize.rs:35:28
   |
35 |           let mut response = client
   |  ____________________________^
36 | |             .post(Authorize::IDENTITY_SERVER_URL)
37 | |             .body("grant_type=client_credentials")
38 | |             .send()?;
   | |____________________^ the `?` operator cannot be applied to type `impl std::future::Future`
   |
   = help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
   = note: required by `std::ops::Try::into_result`

error[E0308]: mismatched types
   --> src/core/authorize.rs:65:20
    |
57  |     ) -> Result<Response, Error> {
    |          ----------------------- expected because this return type...
58  |         let token: AccessToken = self.get_access_token()?;
    |                                                         - ...is found to be `std::result::Result<reqwest::Response, reqwest::Error>` here
...
65  |             return client.get(url).query(&params).send();
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found opaque type
    |
   ::: /Users/storm/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.10.4/src/async_impl/request.rs:397:26
    |
397 |     pub fn send(self) -> impl Future<Output = Result<Response, crate::Error>> {
    |                          ---------------------------------------------------- the found opaque type
    |
    = note:     expected type `std::result::Result<reqwest::Response, reqwest::Error>`
            found opaque type `impl std::future::Future`
    = note: to return `impl Trait`, all returned values must be of the same type
    = note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
    = help: alternatively, create a new `enum` with a variant for each returned type

error[E0308]: mismatched types
   --> src/core/authorize.rs:68:9
    |
57  |     ) -> Result<Response, Error> {
    |          ----------------------- expected `std::result::Result<reqwest::Response, reqwest::Error>` because of return type
...
68  |         client.get(url).send()
    |         ^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found opaque type
    |
   ::: /Users/storm/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.10.4/src/async_impl/request.rs:397:26
    |
397 |     pub fn send(self) -> impl Future<Output = Result<Response, crate::Error>> {
    |                          ---------------------------------------------------- the found opaque type
    |
    = note:     expected enum `std::result::Result<reqwest::Response, reqwest::Error>`
            found opaque type `impl std::future::Future`

error[E0308]: mismatched types
   --> src/core/authorize.rs:77:9
    |
71  |       pub fn post_request(&self, url: Url, object: impl Serialize) -> Result<Response, Error> {
    |                                                                       ----------------------- expected `std::result::Result<reqwest::Response, reqwest::Error>` because of return type
...
77  | /         client
78  | |             .post(url)
79  | |             .body(serde_json::to_string(&object).unwrap())
80  | |             .send()
    | |___________________^ expected enum `std::result::Result`, found opaque type
    |
   ::: /Users/storm/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.10.4/src/async_impl/request.rs:397:26
    |
397 |       pub fn send(self) -> impl Future<Output = Result<Response, crate::Error>> {
    |                            ---------------------------------------------------- the found opaque type
    |
    = note:     expected enum `std::result::Result<reqwest::Response, reqwest::Error>`
            found opaque type `impl std::future::Future`

error[E0599]: no method named `json` found for struct `reqwest::Response` in the current scope
  --> src/core/bank.rs:22:18
   |
22 |         response.json::<Accounts>()
   |                  ^^^^ method not found in `reqwest::Response`

error[E0599]: no method named `json` found for struct `reqwest::Response` in the current scope
  --> src/core/bank.rs:34:18
   |
34 |         response.json::<Account>()
   |                  ^^^^ method not found in `reqwest::Response`

error[E0599]: no method named `json` found for struct `reqwest::Response` in the current scope
  --> src/core/bank.rs:63:18
   |
63 |         response.json::<Transactions>()
   |                  ^^^^ method not found in `reqwest::Response`

error[E0599]: no method named `json` found for struct `reqwest::Response` in the current scope
  --> src/core/bank.rs:71:18
   |
71 |         response.json::<TransferResponse>()
   |                  ^^^^ method not found in `reqwest::Response`

error[E0599]: no method named `json` found for struct `reqwest::Response` in the current scope
  --> src/core/customers.rs:20:18
   |
20 |         response.json::<Customer>()
   |                  ^^^^ method not found in `reqwest::Response`

warning: use of deprecated item 'std::error::Error::description': use the Display impl or to_string()
  --> src/core/error.rs:24:44
   |
24 |             Error::Reqwest(ref err) => err.description(),
   |                                            ^^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

warning: use of deprecated item 'std::error::Error::description': use the Display impl or to_string()
  --> src/core/error.rs:26:42
   |
26 |             Error::Regex(ref err) => err.description(),
   |                                          ^^^^^^^^^^^

error: aborting due to 11 previous errors

Some errors have detailed explanations: E0277, E0308, E0432, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `sbanken-cli`.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.