P2PRepositoryProtocol
public protocol P2PRepositoryProtocol
A protocol for performing P2P (Peer-to-Peer) operations.
-
Retrieves a P2P request as a payee with the specified ID.
Declaration
Swift
func fetchP2PRequestAsPayee(_ id: String) -> AnyPublisher<P2PRequestAsPayeeResponse, NetworkError>
Parameters
id
The ID of the P2P request.
Return Value
A publisher that emits the retrieved
P2PRequestAsPayeeResponse
or an error of typeNetworkError
. -
Retrieves a P2P request as a payer with the specified ID.
Declaration
Swift
func fetchP2PRequestAsPayer(_ id: String) -> AnyPublisher<P2PRequestAsPayerResponse, NetworkError>
Parameters
id
The ID of the P2P request.
Return Value
A publisher that emits the retrieved
P2PRequestAsPayerResponse
or an error of typeNetworkError
. -
Fetches received P2P requests based on the provided fetch data.
Declaration
Swift
func fetchReceivedP2PRequests(fetchData: P2PRequestsFetchData) -> AnyPublisher<P2PReceivedRequestsFetchResponse, NetworkError>
Parameters
fetchData
The fetch data specifying the criteria for received P2P requests.
Return Value
A publisher that emits the fetched
P2PReceivedRequestsFetchResponse
or an error of typeNetworkError
. -
Fetches sent P2P requests based on the provided fetch data.
Declaration
Swift
func fetchSentP2PRequests(fetchData: P2PRequestsFetchData) -> AnyPublisher<P2PSentRequestsFetchResponse, NetworkError>
Parameters
fetchData
The fetch data specifying the criteria for sent P2P requests.
Return Value
A publisher that emits the fetched
P2PSentRequestsFetchResponse
or an error of typeNetworkError
. -
Creates a P2P request as a payee using the provided request payload.
Declaration
Swift
func createP2PRequest(_ request: CreateP2PRequestAsPayeeRequest) -> AnyPublisher<P2PRequestAsPayeeResponse, NetworkError>
Parameters
request
The request payload containing the details of the P2P request.
Return Value
A publisher that emits the created
P2PRequestAsPayeeResponse
or an error of typeNetworkError
. -
Cancels a P2P request with the specified ID.
Declaration
Swift
func cancelP2PRequest(_ id: String) -> AnyPublisher<Void, NetworkError>
Parameters
id
The ID of the P2P request to cancel.
Return Value
A publisher that emits a success value of
Void
or an error of typeNetworkError
. -
Approves a P2P request with the specified ID using the provided approval request.
Declaration
Swift
func approveP2PRequest(_ id: String, _ request: P2PRequestApprovalRequest) -> AnyPublisher<P2PRequestApprovalResponse, NetworkError>
Parameters
id
The ID of the P2P request to approve.
request
The approval request containing the details of the approval.
Return Value
A publisher that emits the approval response of type
P2PRequestApprovalResponse
or an error of typeNetworkError
. -
Rejects a P2P request with the specified ID.
Declaration
Swift
func rejectP2PRequest(_ id: String) -> AnyPublisher<Void, NetworkError>
Parameters
id
The ID of the P2P request to reject.
Return Value
A publisher that emits a success value of
Void
or an error of typeNetworkError
. -
Creates a P2P payment as a payer using the provided payment request payload.
Declaration
Swift
func createP2PPayment(_ request: CreateP2PPaymentAsPayerRequest) -> AnyPublisher<CreateP2PPaymentAsPayerResponse, NetworkError>
Parameters
request
The request payload containing the details of the P2P payment.
Return Value
A publisher that emits the created
CreateP2PPaymentAsPayerResponse
or an error of typeNetworkError
. -
Approves a P2P payment with the specified ID using the provided approval request.
Declaration
Swift
func approveP2PPayment(_ id: String, _ request: P2PPaymentApprovalRequest) -> AnyPublisher<Void, NetworkError>
Parameters
id
The ID of the P2P payment to approve.
request
The approval request containing the details of the approval.
Return Value
A publisher that emits a success value of
Void
or an error of typeNetworkError
. -
Fetches P2P payments based on the provided fetch data.
Declaration
Swift
func fetchP2PPayments(fetchData: P2PPaymentsFetchData) -> AnyPublisher<P2PPaymentsFetchResponse, NetworkError>
Parameters
fetchData
The fetch data specifying the criteria for P2P payments.
Return Value
A publisher that emits the fetched
P2PPaymentsFetchResponse
or an error of typeNetworkError
.