P2PService
public struct P2PService : P2PServicing
A service implementation for managing P2P (Person-to-Person) operations.
-
Initializes the
P2PService
with the specified repository.Declaration
Swift
public init( repository: P2PRepositoryProtocol )
Parameters
repository
The repository for accessing P2P data.
-
Fetches a P2P request as a payer.
Declaration
Swift
@MainActor public func fetchP2PRequestAsPayer( _ id: String, response: LoadableSubject<P2PRequestAsPayerResponse> )
Parameters
id
The ID of the P2P request.
response
The loadable subject to track the response. The loadable subject tracks the state of the P2P request retrieval operation as a payer, representing the success state with the loaded
P2PRequestAsPayerResponse
value or the failure state with the associatedNetworkError
. -
Fetches a P2P request as a payee.
Declaration
Swift
@MainActor public func fetchP2PRequestAsPayee( _ id: String, response: LoadableSubject<P2PRequestAsPayeeResponse> )
Parameters
id
The ID of the P2P request.
response
The loadable subject to track the response. The loadable subject tracks the state of the P2P request retrieval operation as a payee, representing the success state with the loaded
P2PRequestAsPayeeResponse
value or the failure state with the associatedNetworkError
. -
Fetches received P2P requests.
Declaration
Swift
@MainActor public func fetchReceivedP2PRequests( fetchData: P2PRequestsFetchData, response: LoadableSubject<P2PReceivedRequestsFetchResponse> )
Parameters
fetchData
The data used for fetching received P2P requests.
response
The loadable subject to track the response. The loadable subject tracks the state of the received P2P requests retrieval operation, representing the success state with the loaded
P2PReceivedRequestsFetchResponse
value or the failure state with the associatedNetworkError
. -
Fetches sent P2P requests.
Declaration
Swift
public func fetchSentP2PRequests( fetchData: P2PRequestsFetchData, response: LoadableSubject<P2PSentRequestsFetchResponse> )
Parameters
fetchData
The data used for fetching sent P2P requests.
response
The loadable subject to track the response. The loadable subject tracks the state of the sent P2P requests retrieval operation, representing the success state with the loaded
P2PSentRequestsFetchResponse
value or the failure state with the associatedNetworkError
. -
Creates a P2P request as a payee.
Declaration
Swift
@MainActor public func createP2PRequest( _ request: CreateP2PRequestAsPayeeRequest, response: LoadableSubject<P2PRequestAsPayeeResponse> )
Parameters
request
The request object containing the details of the P2P request as a payee.
response
The loadable subject to track the response. The loadable subject tracks the state of the P2P request creation operation as a payee, representing the success state with the loaded
P2PRequestAsPayeeResponse
value or the failure state with the associatedNetworkError
. -
Cancels a P2P request.
Declaration
Swift
@MainActor public func cancelP2PRequest( _ id: String, response: LoadableSubject<Void> )
Parameters
id
The ID of the P2P request to cancel.
response
The loadable subject to track the response. The loadable subject tracks the state of the P2P request cancellation operation, representing the success state with a void value or the failure state with the associated
NetworkError
. -
Approves a P2P request.
Declaration
Swift
@MainActor public func approveP2PRequest( _ id: String, _ request: P2PRequestApprovalRequest, response: LoadableSubject<P2PRequestApprovalResponse> )
Parameters
id
The ID of the P2P request to approve.
request
The request object containing the details of the P2P request approval.
response
The loadable subject to track the response. The loadable subject tracks the state of the P2P request approval operation, representing the success state with the loaded
P2PRequestApprovalResponse
value or the failure state with the associatedNetworkError
. -
Rejects a P2P request.
Declaration
Swift
@MainActor public func rejectP2PRequest(_ id: String, response: LoadableSubject<Void>)
Parameters
id
The ID of the P2P request to reject.
response
The loadable subject to track the response. The loadable subject tracks the state of the P2P request rejection operation, representing the success state with a void value or the failure state with the associated
NetworkError
. -
Creates a P2P payment.
Declaration
Swift
@MainActor public func createP2PPayment( _ request: CreateP2PPaymentAsPayerRequest, response: LoadableSubject<CreateP2PPaymentAsPayerResponse> )
Parameters
request
The request object containing the details of the P2P payment.
response
The loadable subject to track the response. The loadable subject tracks the state of the P2P payment creation operation, representing the success state with the loaded
CreateP2PPaymentAsPayerResponse
value or the failure state with the associatedNetworkError
. -
Approves a P2P payment.
Declaration
Swift
@MainActor public func approveP2PPayment( _ id: String, _ request: P2PPaymentApprovalRequest, response: LoadableSubject<Void> )
Parameters
id
The ID of the P2P payment to approve.
request
The request object containing the details of the P2P payment approval.
response
The loadable subject to track the response. The loadable subject tracks the state of the P2P payment approval operation, representing the success state with a void value or the failure state with the associated
NetworkError
. -
Fetches P2P payments based on the provided fetch data.
Declaration
Swift
@MainActor public func fetchP2PPayments( _ fetchData: P2PPaymentsFetchData, response: LoadableSubject<P2PPaymentsFetchResponse> )
Parameters
fetchData
The data used to fetch P2P payments.
response
The loadable subject to track the response. The loadable subject tracks the state of the P2P payment fetching operation, representing the success state with the loaded
P2PPaymentsFetchResponse
value or the failure state with the associatedNetworkError
.