iOS SDK Implementation

Init

This method is used for sdk initialization.

func Init ()

ActivateDevice

This method used for activate device on powerfactor.

func activateDevice(_ otp:String, userData: PWFUserContract, pin:String, onActivationSuccess:@escaping ()-> Void, onActivationFailure:@escaping ([Result]) ->Void )

Method Parameters  
otp This parameter is the activation otp sent to the customer via SMS.
userData Customer unique data as PWFUserContract.
pin The 6 digit value that the user input.
onActivationSuccess This callback parameter is called automatically when the operation success.
onActivationFailure This callback parameter is called automatically with error details ([Result]) when the operation failed.

Login

This method used for secure login via PowerFactor with just only 6 digits pin.

func login(_ userData: PWFUserContract, pin: String, onLoginSuccess:@escaping (_ loginOtp: String)-> Void, onLoginFailure:@escaping ([Result]) ->Void )

Method Parameters  
userData Customer unique data as PWFUserContract.
pin The 6 digit value that the user input.
onActivationSuccess This callback parameter is called automatically when the operation success.
onActivationFailure This callback parameter is called automatically with error details ([Result]) when the operation failed.

Logout

This method used for secure logout.

func logout(_ logoutSuccess: @escaping () -> Void = { })

Method Parameters  
LogoutSuccess This callback parameter is called automatically when the logout success.

GetUserList

This method used for get activation list on current device.

func getUserList() -> [PWFUserContract]?

Method Result  
[PWFUserContract] Array of PWFUserContract.

ChangePin

This method used to change the user’s pin.

func changePIN (_ userData: PWFUserContract, pin: String, newPIN : String, onPINChanged:@escaping ()-> Void, onPINChangeFailure:@escaping ([Result]) ->Void )

Method Parameters  
userData Customer unique data as PWFUserContract.
pin The 6 digit current pin value.
newPin The 6 digit new pin value.
onPINChanged This callback parameter is called automatically when the operation success.
onPINChangeFailure This callback parameter is called automatically with error details ([Result]) when the operation failed.

DeleteUser

This method used for delete activation from current device.

func deleteUser(_ userData: PWFUserContract) -> Bool

Method Parameters  
userData Customer unique data as PWFUserContract.

BeginTransaction

This method is used for begin the transaction.

func beginTransaction(_ onTransactionBegin:@escaping (_ data: PWFTransactionContract)-> Void, onTransactionFailure:@escaping ([Result]) ->Void = { (error:[Result]) in } )

Method Parameters  
onTransactionBegin This callback parameter is called automatically when the transaction begins.
onTransactionFailure This callback parameter is called automatically when the transaction failure.

CompleteTransaction

This method is used for complete transaction. Started transactions should complete even if unexpected cases.

func completeTransaction(_ status: TransactionStatusNames, onTransactionFailure:@escaping ([Result]) ->Void)

Method Parameters  
status Transaction Status. (Approved, Rejected, Timeout vs….)
onTransactionFailure This callback parameter is called automatically when the transaction failure.

Common Types

PWFUserContract

Properties  
CustomerId This field should be unique identifier for customer.
UserName This field should be unique identifier for customer. UserName should use when there is more than one person using the same customer number.

Result

Method Parameters  
ErrorCode Unique error code.
ErrorMessage User friendly error message.
Exception Exception details.
IsFriendly Is Exception or user friendly error?