mangopay

Crates.iomangopay
lib.rsmangopay
version0.1.6
sourcesrc
created_at2022-05-27 10:38:42.573649
updated_at2022-07-22 11:53:15.477033
descriptionMangoPay API SDK #mangopay #pay #lib
homepage
repository
max_upload_size
id595005
size51,504
Killian Gardahaut (KillianG)

documentation

README

[WIP] MangoPay library for rust

Feel free to help me build this KillianG/MangoPay :)

How to use (by examples)

Initialization

let mango: Mangopay = Mangopay::init(
    env!("MANGO_CLIENT_ID").parse().unwrap(),
    env!("MANGO_API_KEY").parse().unwrap(),
    "https://api.sandbox.mangopay.com/v2.01/".to_string()
);

User

let user_infos = CreateUserBody {
    first_name: "firstName".to_string(),
    last_name: "lastNme".to_string(),
    email: "john@doe.com".to_string(),
    user_category: "Payer".to_string(),
    tag: "Tagged".to_string(),
    terms_and_conditions_accepted: true,
};

let user = mango.create_user(&user_infos).unwrap();
let user_get = mangop.get_user(user.id).unwrap();

Wallet

let wallet: Wallet = mango.create_wallet(CreateWallet{
    owners: vec![user.id],
    description: "Description".to_string(),
    currency: "EUR".to_string(),
    tag: "Tagged".to_string()
})

let list_wallets: ListWallets = mangop.list_wallets(user_id.to_string()).unwrap();

Card registration

let card_registration_result = mango.create_card_registration(&CardRegistrationBody{
    tag: "Tag".to_string(),
    user_id: user_id.to_owned(),
    currency: "EUR".to_string(),
    card_type: "CB_VISA_MASTERCARD".to_string()
}).unwrap();

let card_registration = mango.get_card_registration(card_registration_result.id).unwrap();

let modified_card_registration = mangop.update_card_registration(card_registration.id, &UpdateCardRegistrationBody {
    tag: "".to_string(),
    registration_data: "registrationdata".to_string()
}).unwrap();
Commit count: 0

cargo fmt