FMPTransaction

Description

The FMPTransaction class is used to describe transaction.

class FMPTransaction

Properties

Property Description

id

Transaction identifier.
var id: String { get }

resource

Resource, in which transaction is executed.
var resource: FMPResource? { get }

Methods

Method Description
get(completion:) Get response from a mobile platform server by transaction ID.
func get(completion: @escaping FMPRequestResponseHandler)

Parameters:

  • completion. Closing expression containing method execution result.

delete(completion:) Delete transaction information.
func delete(completion: @escaping FMPRequestResponseHandler)

Parameters:

  • completion. Closing expression containing method execution result.

copy() Get builder class instance for copying FMPTransaction. It returns the instance of the FMPTransaction.Builder builder class.
func copy() -> FMPTransaction.Builder

Examples

Get response from a mobile platform server by transaction ID:

// Build instance of the FMPTransaction class. For details see examples for FMPTransaction.Builder.
let transaction: FMPTransaction = fmp.transaction.build()
  
// Get server response corresponding to transaction
transaction.get { (response) in
    if response.success {
        // Display server response
        print(response.result)
    } else {
        // Display error code and description
        print(response.error?.code, response.error?.description)
    }
}

Delete information about transaction from server:

// Build instance of the FMPTransaction class. For details see examples for FMPTransaction.Builder.
let transaction: FMPTransaction = fmp.transaction.build()
  
// Delete information about transaction from server
transaction.delete { (response) in
    if response.success {
        // Display server response
        print(response.result)
    } else {
        // Display error code and description
        print(response.error?.code, response.error?.description)
    }
}

Copy FMPTransaction:

// Build instance of the FMPTransaction class. For details see examples for FMPTransaction.Builder.
let transaction: FMPTransaction = fmp.transaction.build()
  
// Copy instance of the FMPTransaction class.
let transactionCopy: FMPTransaction = transaction.copy().build()

See. also:

FMPWrapper Framework | Classes