SchemeConfig

Enum SchemeConfig 

Source
pub enum SchemeConfig {
    Visa {
        account_info: String,
    },
    Mastercard {
        account_info: String,
    },
    UnionPay {
        account_info: String,
    },
    IPSET {
        guid: String,
        bic: String,
        account: String,
    },
}
Expand description

Payment scheme configuration

Variants§

§

Visa

Fields

§account_info: String
§

Mastercard

Fields

§account_info: String
§

UnionPay

Fields

§account_info: String
§

IPSET

Fields

§guid: String
§account: String

Implementations§

Source§

impl SchemeConfig

Source

pub fn ips_et(guid: &str, bic: &str, account: &str) -> Self

Create IPS ET scheme builder

Examples found in repository?
examples/basic_static.rs (lines 14-18)
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8    // Create a basic static QR code for a coffee shop
9    let qr_builder = QRBuilder::new()
10        .merchant_name("Addis Coffee House")
11        .merchant_city("Addis Ababa")
12        .merchant_category_code("5812") // Eating places, restaurants
13        .add_scheme(SchemeConfig::visa("4111111111111111"))
14        .add_scheme(SchemeConfig::ips_et(
15            "581b314e257f41bfbbdc6384daa31d16",
16            "CBETETAA",
17            "10000171234567890",
18        ));
19
20    let qr_code = qr_builder.build()?;
21
22    println!("QR Code Payload: {}", qr_builder);
23    println!("QR Code version: {:?}", qr_code.version());
24
25    Ok(())
26}
More examples
Hide additional examples
examples/dynamic_with_amount.rs (lines 21-25)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11    // Additional data if required
12    let additional_data = AdditionalData::new()
13        .bill_number("INV-001")
14        .reference_label("ORDER-123");
15
16    // Create a basic dynamic QR code for a restaurant
17    let qr_builder = QRBuilder::new()
18        .merchant_name("Restaurant")
19        .merchant_city("Dire Dawa")
20        .merchant_category_code("5812")
21        .add_scheme(SchemeConfig::ips_et(
22            "581b314e257f41bfbbdc6384daa31d16",
23            "CBETETAA",
24            "10000171234567890",
25        ))
26        .transaction_amount("50.00")
27        .additional_data(additional_data);
28
29    let qr_code = qr_builder.build()?;
30
31    println!("QR Code Payload: {}", qr_builder);
32    println!("QR Code version: {:?}", qr_code.version());
33
34    Ok(())
35}
Source

pub fn visa(account_info: impl Into<String>) -> Self

Create Visa scheme

Examples found in repository?
examples/basic_static.rs (line 13)
7fn main() -> Result<(), Box<dyn std::error::Error>> {
8    // Create a basic static QR code for a coffee shop
9    let qr_builder = QRBuilder::new()
10        .merchant_name("Addis Coffee House")
11        .merchant_city("Addis Ababa")
12        .merchant_category_code("5812") // Eating places, restaurants
13        .add_scheme(SchemeConfig::visa("4111111111111111"))
14        .add_scheme(SchemeConfig::ips_et(
15            "581b314e257f41bfbbdc6384daa31d16",
16            "CBETETAA",
17            "10000171234567890",
18        ));
19
20    let qr_code = qr_builder.build()?;
21
22    println!("QR Code Payload: {}", qr_builder);
23    println!("QR Code version: {:?}", qr_code.version());
24
25    Ok(())
26}
Source

pub fn mastercard(account_info: impl Into<String>) -> Self

Create Mastercard scheme

Source

pub fn tag_id(&self) -> &str

Get the scheme tag ID

Source

pub fn encode(&self) -> Result<EMVTag>

Encode scheme as EMV tag

Trait Implementations§

Source§

impl Clone for SchemeConfig

Source§

fn clone(&self) -> SchemeConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SchemeConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.