Git Product home page Git Product logo

lazerpay-rust-sdk's People

Contributors

appcypher avatar ecj222 avatar lordsarcastic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lazerpay-rust-sdk's Issues

Rename Library to `lazerpay`

I think the library should just be renamed lazerpay or lazerpay-rs. lazerpay-rust-sdk is a mouthful.
There is no need for the ...-rust-sdk namespacing since this rust version is only ever going to exist in crates-verse.

It also helps with discoverability.

Results over Unwraps

Might want to return Results instead of unwrapping. This puts error handling into the users hands and prevents unexpected and sometimes unwanted panics.

API Change Proposal

Right now, Lazerpay Rust SDK looks so much like the node SDK. The issue with that is the library doesn't take full advantage of Rust's type safety all in the spirit of staying true to the official implementation. But node is not Rust. JavaScript is a weakly typed language.

For the reasons stated above, I would like to propose a slightly different, more Rusty interface for the SDK. Specifying it in a way that doesn't diverge too much from the reference implementation.

I think it will help with creating a more solid foundation for the project as Lazerpay grows its features.

let lazerpay = Lazerpay::new()?; // Sets up API keys. Grabs details from .env.

let payment = lazerpay.create_payment(PaymentConfig { // Returns a payment object but doesn't send req.
    customer: Customer::new("Lagbaja Ajanaku", "[email protected]"),
    coin: Coin::USDC,
    currency: Currency::NGN,
    amount: 5_000,
    pk_address: "0x16227d60f7a0e586c66b005219dfc887d13c9531",
    reference: "Just sending some money your way",
    ..Default::default()
})?;

payment.send()?; // Sends payment req.

payment.check_confirmation()?; // Asks for confirmation.

payment.get_accepted_coins()?; // Get supported coins.

Let me know what you think and if there is any edge case I'm missing.

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.