TransactionEndpoints

Struct TransactionEndpoints 

Source
pub struct TransactionEndpoints<T: HttpClient + Default> { /* private fields */ }
Expand description

A struct to hold all the functions of the transaction API endpoint

Implementations§

Source§

impl<T: HttpClient + Default> TransactionEndpoints<T>

Source

pub fn new(key: Arc<String>, http: Arc<T>) -> TransactionEndpoints<T>

Creates a new TransactionEndpoints instance

§Arguments
  • key - The Paystack API key
  • http - The HTTP client implementation to use for API requests
§Returns

A new TransactionEndpoints instance

Source

pub async fn initialize_transaction( &self, transaction_request: TransactionRequest, ) -> PaystackResult<TransactionResponseData>

Initialize a transaction in your integration

§Arguments
  • transaction_request - The request data to initialize the transaction. Should be created with a TransactionRequestBuilder struct
§Returns

A Result containing the transaction response data or an error

Source

pub async fn verify_transaction( &self, reference: &str, ) -> PaystackResult<TransactionStatusData>

Verifies the status of a transaction

§Arguments
  • reference - The transaction reference used to initiate the transaction
§Returns

A Result containing the transaction status data or an error

Source

pub async fn list_transactions( &self, per_page: Option<u32>, status: Option<Status>, ) -> PaystackResult<Vec<TransactionStatusData>>

Lists transactions carried out on your integration

§Arguments
  • per_page - Optional number of transactions to return per page. Defaults to 10 if None
  • status - Optional filter for transaction status. Defaults to Success if None
§Returns

A Result containing a vector of transaction status data or an error

Source

pub async fn fetch_transactions( &self, transaction_id: u64, ) -> PaystackResult<TransactionStatusData>

Gets details of a specific transaction

§Arguments
  • transaction_id - The ID of the transaction to fetch
§Returns

A Result containing the transaction status data or an error

Source

pub async fn charge_authorization( &self, charge_request: ChargeRequest, ) -> PaystackResult<ChargeResponseData>

Charges a reusable authorization

§Arguments
  • charge_request - The charge request data containing authorization details. Should be created with the ChargeRequestBuilder struct.
§Returns

A Result containing the charge response data or an error

Source

pub async fn view_transaction_timeline( &self, identifier: TransactionIdentifier, ) -> PaystackResult<TransactionTimelineData>

Views the timeline of a transaction

§Arguments
  • identifier - The transaction identifier (either ID or reference)
§Returns

A Result containing the transaction timeline data or an error

Source

pub async fn total_transactions(&self) -> PaystackResult<TransactionTotalData>

Gets the total amount received on your account

§Returns

A Result containing the transaction total data or an error

Source

pub async fn export_transaction( &self, status: Option<Status>, currency: Option<Currency>, settled: Option<bool>, ) -> PaystackResult<ExportTransactionData>

Exports a list of transactions

§Arguments
  • status - Optional status filter for transactions to export. Defaults to Success
  • currency - Optional currency filter. Defaults to NGN
  • settled - Optional filter for settled transactions. Defaults to false
§Returns

A Result containing the export transaction data or an error

Source

pub async fn partial_debit( &self, partial_debit_transaction_request: PartialDebitTransactionRequest, ) -> PaystackResult<TransactionStatusData>

Performs a partial debit on a transaction

§Arguments
  • partial_debit_transaction_request - The request data for the partial debit. Must be created with the PartialDebitTransactionBuilder Struct.
§Returns

A Result containing the transaction status data or an error

Trait Implementations§

Source§

impl<T: Clone + HttpClient + Default> Clone for TransactionEndpoints<T>

Source§

fn clone(&self) -> TransactionEndpoints<T>

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<T: Debug + HttpClient + Default> Debug for TransactionEndpoints<T>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,