PCSDKModule Documentation Beta

Class PCOperations​Manager

public class PCOperationsManager

Processes PCOperation objects

Methods

import​Operation(from:​)

public static func importOperation(from json: String) throws -> PCOperation

Imports operation from server response.

Parameters

json String

The source json string which contains the operation's data

Returns

The new PCOperation object

get​Operation​List(for:​target​Queue:​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

user PCUser

The user which operations should be fetched for

target​Queue Dispatch​Queue

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

get​Operation(for:​user:​target​Queue:​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

operation​ID String

The operation's identifier

user PCUser

User which operations's data should be fetched for

target​Queue Dispatch​Queue

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

PCOperation object or error

process(operation:​to​Confirm:​to​Decline:​user:​ext​Auth:​target​Queue:​completion:​)

public static func process(operation: PCOperation, toConfirm: [PCTransaction], toDecline: [PCTransaction], user: PCUser, extAuth: PCExtendedAuthTemplate? = 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

operation PCOperation

The transaction to be processed

to​Confirm [PCTransaction]

Transactions to confirm

to​Decline [PCTransaction]

Transactions to decline

user PCUser

The user to process

ext​Auth PCExtended​Auth​Template?

Extended authentication template

target​Queue Dispatch​Queue

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

confirm​Entire​Operation(_:​user:​ext​Auth:​target​Queue:​completion:​)

public static func confirmEntireOperation(_ operation: PCOperation, user: PCUser, extAuth: PCExtendedAuthTemplate? = nil, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<Void, Error>) -> Void)

Confirms each transaction in the operation

Parameters

operation PCOperation

The transaction to be processed

user PCUser

The user to confirm

ext​Auth PCExtended​Auth​Template?

Extended authentication template

target​Queue Dispatch​Queue

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

decline​Entire​Operation(_:​user:​ext​Auth:​target​Queue:​completion:​)

public static func declineEntireOperation(_ operation: PCOperation, user: PCUser, extAuth: PCExtendedAuthTemplate? = nil, targetQueue: DispatchQueue = .main, completion: @escaping (_ result: Result<Void, Error>) -> Void)

Declines each transaction in the operation

Parameters

operation PCOperation

The transaction to be processed

user PCUser

The user to decline

ext​Auth PCExtended​Auth​Template?

Extended authentication template

target​Queue Dispatch​Queue

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