Skip to main content

Buyer

Struct Buyer 

Source
#[non_exhaustive]
pub struct Buyer { pub name: Box<str>, pub surname: Option<Box<str>>, pub email: Box<str>, pub phone: Option<Box<str>>, pub identity_number: Option<Box<str>>, pub ip: Option<Box<str>>, pub address: Option<Address>, }
Expand description

The person paying.

Only the name and the email are required here, because they are the two every provider that asks for a buyer asks for. The rest are Option because which of them is mandatory is the provider’s own decision — iyzico refuses a payment without an identity number, PayTR without the payer’s IP — and an adapter says which one is missing when it needs it.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: Box<str>

Given name. A provider that wants one field takes this.

§surname: Option<Box<str>>

Family name, where the provider keeps them apart. iyzico does.

§email: Box<str>

Email address.

§phone: Option<Box<str>>

Mobile number.

§identity_number: Option<Box<str>>

Turkish national identity number, or the equivalent. iyzico’s classic API requires one on every hosted form.

§ip: Option<Box<str>>

The address the request came from, which fraud checks read. PayTR requires it.

§address: Option<Address>

Where the payer is registered, which iyzico sends as registrationAddress and PayTR as the payer’s address.

Implementations§

Source§

impl Buyer

Source

pub fn new(name: impl Into<Box<str>>, email: impl Into<Box<str>>) -> Self

A buyer with the two fields every provider that wants one asks for.

Source

pub fn surname(self, surname: impl Into<Box<str>>) -> Self

Adds the family name.

Source

pub fn phone(self, phone: impl Into<Box<str>>) -> Self

Adds the mobile number.

Source

pub fn identity_number(self, identity_number: impl Into<Box<str>>) -> Self

Adds the national identity number.

Source

pub fn ip(self, ip: impl Into<Box<str>>) -> Self

Adds the address the request came from.

Source

pub fn address(self, address: Address) -> Self

Adds where the payer is registered.

Trait Implementations§

Source§

impl Clone for Buyer

Source§

fn clone(&self) -> Buyer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Buyer

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Buyer

Source§

impl PartialEq for Buyer

Source§

fn eq(&self, other: &Buyer) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Buyer

Auto Trait Implementations§

§

impl Freeze for Buyer

§

impl RefUnwindSafe for Buyer

§

impl Send for Buyer

§

impl Sync for Buyer

§

impl Unpin for Buyer

§

impl UnsafeUnpin for Buyer

§

impl UnwindSafe for Buyer

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.