Class
PCOperationsManager
public final class PCOperationsManager
Processes PCOperation objects
Methods
importOperation(from:)
public static func importOperation(
from json: String
) throws -> PCOperation
Imports operation from server response.
Parameters
| Name | Type | Description |
|---|---|---|
| json | String |
The source json string which contains the operation's data |
Returns
The new PCOperation object
getOperationList(for:targetQueue:completion:)
public static func getOperationList(
for user: PCUser,
targetQueue: DispatchQueue = .main,
completion: @escaping (_ result: Result<[String], Error>) -> Void
)
Gets list of operations identifiers from PCSDK Server.
Parameters
| Name | Type | Description |
|---|---|---|
| user | PCUser |
The user which operations should be fetched for |
| targetQueue | DispatchQueue |
The queue where a completion will be invoked on |
| completion | @escaping (_ result: Result<[String], Error>) -> Void |
A closure to be invoked after finishing the fetching process |
| result | Operations identifiers or error |
getOperation(for:user:targetQueue:completion:)
public static func getOperation(
for operationID: String,
user: PCUser,
targetQueue: DispatchQueue = .main,
completion: @escaping (_ result: Result<PCOperation, Error>) -> Void
)
Gets operation data from PCSDK Server.
Parameters
| Name | Type | Description |
|---|---|---|
| operationID | String |
The operation's identifier |
| user | PCUser |
User which operations's data should be fetched for |
| targetQueue | DispatchQueue |
The queue where a completion will be invoked on |
| completion | @escaping (_ result: Result<PCOperation, Error>) -> Void |
A closure to be invoked after finishing the fetching process |
| result |
|
process(operation:toConfirm:toDecline:user:extAuth:keysProcessor:targetQueue:completion:)
public static func process(
operation: PCOperation,
toConfirm: [PCTransaction],
toDecline: [PCTransaction],
user: PCUser,
extAuth: PCExtendedAuthTemplate? = nil,
keysProcessor: KeysProcessor? = nil,
targetQueue: DispatchQueue = .main,
completion: @escaping (_ result: Result<Void, Error>) -> Void
)
Processes the operation
Transaction to confirm/decline must be specifyied using toConfirm and toDecline parameters.
Each transaction in toConfirm or toDecline must be the reference to one of transactions returned
by PCOperation.transactions.
Parameters
| Name | Type | Description |
|---|---|---|
| operation | PCOperation |
The transaction to be processed |
| toConfirm | [PCTransaction] |
Transactions to confirm |
| toDecline | [PCTransaction] |
Transactions to decline |
| user | PCUser |
The user to process |
| extAuth | PCExtendedAuthTemplate? |
Extended authentication template |
| keysProcessor | KeysProcessor? |
The processor to process operation |
| targetQueue | DispatchQueue |
The queue where a completion will be invoked on |
| completion | @escaping (_ result: Result<Void, Error>) -> Void |
A closure to be invoked after finishing the signing process |
| result | Returns nothing when success. Otherwise return error |
confirmEntireOperation(_:user:extAuth:keysProcessor:targetQueue:completion:)
public static func confirmEntireOperation(
_ operation: PCOperation,
user: PCUser,
extAuth: PCExtendedAuthTemplate? = nil,
keysProcessor: KeysProcessor? = nil,
targetQueue: DispatchQueue = .main,
completion: @escaping (_ result: Result<Void, Error>) -> Void
)
Confirms each transaction in the operation
Parameters
| Name | Type | Description |
|---|---|---|
| operation | PCOperation |
The transaction to be processed |
| user | PCUser |
The user to confirm |
| keysProcessor | KeysProcessor? |
The processor to process operation |
| extAuth | PCExtendedAuthTemplate? |
Extended authentication template |
| targetQueue | DispatchQueue |
The queue where a completion will be invoked on |
| completion | @escaping (_ result: Result<Void, Error>) -> Void |
A closure to be invoked after finishing the signing process |
| result | Returns nothing when success. Otherwise return error |
declineEntireOperation(_:user:extAuth:keysProcessor:targetQueue:completion:)
public static func declineEntireOperation(
_ operation: PCOperation,
user: PCUser,
extAuth: PCExtendedAuthTemplate? = nil,
keysProcessor: KeysProcessor? = nil,
targetQueue: DispatchQueue = .main,
completion: @escaping (_ result: Result<Void, Error>) -> Void
)
Declines each transaction in the operation
Parameters
| Name | Type | Description |
|---|---|---|
| operation | PCOperation |
The transaction to be processed |
| user | PCUser |
The user to decline |
| extAuth | PCExtendedAuthTemplate? |
Extended authentication template |
| keysProcessor | KeysProcessor? |
The processor to process operation |
| targetQueue | DispatchQueue |
The queue where a completion will be invoked on |
| completion | @escaping (_ result: Result<Void, Error>) -> Void |
A closure to be invoked after finishing the signing process |
| result | Returns nothing when success. Otherwise return error |