PaymentEngineMiddlewareDelegate

transactionComplete

-(void)transactionComplete :(PaymentEngineTransactionResponse *)transResponse;

This method is called when a transaction has completed processing: it will be called for all errors, declines or approvals. This is a required delegate method. The delegate method needs to be implemented when user starts a transaction using the middleware. See PaymentEngineTransactionResponse for a complete list fields that get returned.

Example: Extracting the RefNum from transactionComplete

The RefNum is needed if you are going to adjust/void the transaction.

-(void)transactionComplete :(PaymentEngineTransactionResponse *)transResponse
{
     NSLog(@"refNum: %@", transResponse.RefNum);
}

captureSignatureComplete

-(void)captureSignatureComplete :(PaymentEngineTransactionResponse *)transResponse

This delegate method needs to be implemented when the captureSignature method is used to capture a signature. Read PaymentEngineTransactionResponse for a complete list of returned fields.

Example

-(void)captureSignaureMethod
{
    PaymentEngineMiddleware  *middleware = [PaymentEngineMiddleware getInstance];
    middleware.delegate = self;
    [middleware setDevice:@"castle" :self];

    UIImage *signatureImg = [UIImage imageNamed:@"signatureImg.png"];
    NSData *imgData = UIImageJPEGRepresentation(signatureImg, 0.5f);
    NSString *imgBase64 = [imgData base64EncodedStringWithOptions:0];

    NSMutableDictionary *transDict = [NSMutableDictionary new];

    [transDict setObject:imgBase64 forKey:@"signature"];

    //Reference number of the transaction that we want to capture the signature
    [transDict setObject:@"1296965885" forKey:@"refNum"];

   //The amount of the transaction that we want to capture the signature
    [transDict setObject:@"12.01" forKey:@"amount"];
    [transDict setObject:@"capture" forKey:@"command"];

    [middleware captureSignature:transDict];
}

-(void)captureSignatureComplete :(PaymentEngineTransactionResponse *)transResponse
{
    NSLog(@"signature captured:%@ ", transResponse.Status);
    NSLog(@"signature error reason: %@", transResponse.Error);

}

adjustTranstionComplete

-(void)adjustTranstionComplete :(PaymentEngineTransactionResponse *)transResponse

This delegate method needs to be implemented when the adjustTransaction method is used to adjust a transaction. Read PaymentEngineTransactionResponse for a complete list of returned fields.

Example

-(void)adjustTransMethod
{
NSMutableDictionary *transDict = [NSMutableDictionary new];

/**
* Reference number of the the transaction that we want to adjust
* Below is a test reference number
*/
[transDict setObject:@"1919214943" forKey:@"refNum"];

//total amount including tip
[transDict setObject:@"50" forKey:@"amount"];
[transDict setObject:@"10" forKey:@"tip"];
[transDict setObject:@"adjust" forKey:@"command"];

[middleware adjustTransaction:transDict];
}

-(void)adjustTranstionComplete :(PaymentEngineTransactionResponse *)transResponse
{
NSLog(@"transaction adjusted status:%@ ", transResponse.Status);
NSLog(@"transaction adjusted error: %@", transResponse.Error);

}

printCompleted

-(void)printCompleted:(NSString *)msg

This method is called after all printText operations have been completed

deviceConnected

-(void)deviceConnected

This method is called when a connection to the payment terminal is established. It's an optional delegate method.

deviceDisconnected

-(void)deviceDisconnected

This method is called when a connection to the payment terminal is lost. It's an optional delegate method.

startUpdatingTerminal

-(void)startUpdatingTerminal

This method is called when the terminal is updating. It's an optional delegate method.

updateTerminalConfigComplete

-(void)updateTerminalConfigComplete

This method is called when all the terminal files has been updated. It's an optional delegate method.

readDeviceInfoComplete

-(void) readDeviceInfoComplete :(NSDictionary *)deviceInfoDict

This delegate method needs to be implemented when the readDeviceInfo method is used to retrieve device information.

returnReceiptCompleted

-(void)returnReceiptCompleted :(NSString *)receiptValue

This delegate method needs to be implemented when the getReceipt method is used to retrieve receipt information.

Example

-(void)getReceiptEventMethod
{

    PaymentEngineMiddleware  *middleware = [PaymentEngineMiddleware getInstance];
    middleware.delegate = self;
    [middleware setDevice:@"castle" :self];

    NSMutableDictionary *receiptDict = [NSMutableDictionary new];

    // The reference number of the EMV transaction we want to get the receipt of
    [receiptDict setObject:@"964096669" forKey:@"refnum"];

    [middleware getReceipt:receiptDict];
}

-(void)returnReceiptCompleted :(NSString *)receiptValue
{
    NSLog(@"Receipt value: %@", receiptValue);

}

getV3ReceiptCompleted

-(void)getV3ReceiptCompleted :(NSString *)receiptValue

This delegate method needs to be implemented when the getV3Receipt method is used to retrieve receipt information.

Example

-(void)getReceiptEventMethod
{

    PaymentEngineMiddleware  *middleware = [PaymentEngineMiddleware getInstance];
    middleware.delegate = self;
    [middleware setDevice:@"castle" :self];

    [middleware getV3Receipt:@"964096669"];
}

-(void)getV3ReceiptCompleted :(NSString *)receiptValue
{
    NSLog(@"Receipt value: %@", receiptValue);

}

getMerchantCapabilitiesComplete

-(void)getMerchantCapabilitiesComplete: (NSDictionary *)merchantCapDict

This delegate method needs to be implemented when the getMerchantCapEvent method is used to retrieve merchant capability information.

Example

/**
* Use this method to get the merchant capability from the gateway
*/
-(void)getMerchantCapEvent
{
    /**
     * Setting the value to false so we don't automatically updates the terminal
     */
    [EBizChargeMiddlewareClass getMerchantCapabilities:false];

}

-(void)getMerchantCapabilitiesComplete: (NSDictionary *)merchantCapDict
{
    NSLog(@"get merchant capability dict completed: %@", merchantCapDict);
}

merchantCapDict Values

Values doesn't always get returned, make sure to check if value is nil or empty.

Key Type Description
contactless int If 1 is returned, merchant supports contactless, otherwise merchant doesn't support it
debit int If 1 is returned, merchant supports debit, otherwise merchant doesn't support it
quickchip int If 1 is returned, merchant supports quickchip, otherwise merchant doesn't support it
tip_adjust int If 1 is returned, merchant supports tip_adjust, otherwise merchant doesn't support it

getDeviceTimeoutCompleted

-(void)getDeviceTimeoutCompleted :(int) seconds

This delegate method needs to be implemented when the getDeviceTimeout method is used to retrieve device timeout duration.

Example


/**
* Use this method to get the device timeout duration in seconds
*/
-(void)getDeviceTimeoutEvent
{
    [EBizChargeMiddlewareClass getDeviceTimeout];
}

-(void)getDeviceTimeoutCompleted :(int) seconds
{
    NSLog(@"timeout in seconds: %i", seconds);
}

runQueuedTransCompleted

-(void)runQueuedTransCompleted :(PaymentEngineTransactionResponse *)transResponse

This delegate method is optional when runQueuedTrans method is used to process an offline queued transaction. See PaymentEngineTransactionResponse for a complete list fields that get returned.

Example


/**
* Use this method process offline queued transaction
*/
-(void)runOfflineQueueTrans
{

    /*
        If an identifier is passed in, it will run the queued transaction for that specific identifier
        else it will run all the queued transacitons
    */
    [EBizChargeMiddlewareClass runQueuedTrans:@""];
}

-(void)runQueuedTransCompleted :(PaymentEngineTransactionResponse *)transResponse
{
    NSLog(@"run queue trans completed: %@", transResponse.Status);
    NSLog(@"run queue trans completed message: %@", transResponse.Error);
}

removeQueuedTransCompleted

-(void)removeQueuedTransCompleted :(NSString *)status message:(NSString *)msg

This delegate method is optional when removeQueuedTrans method is used to remove an offline queued transaction.

Example


/**
* Use this method process offline queued transaction
*/
-(void)removeOfflineQueueTrans
{

    /*
        If an identifier is passed in, it will remove the queued transaction for that specific identifier
        else it will remove all the queued transacitons
    */
    [EBizChargeMiddlewareClass removeQueuedTrans:@""];
}

-(void)removeQueuedTransCompleted :(NSString *)status message:(NSString *)msg
{
    NSLog(@"remove queue trans completed: %@", status);
    NSLog(@"remove queue trans completed message: %@", msg);
}

updateQueuedTransCompleted

-(void)updateQueuedTransCompleted:(NSString *)status message:(NSString *)msg

This delegate method is optional when updateQueuedTrans method is used to update an existing queued transaction.

Example


-(void)updateQueuedTransEvent
{

    NSMutableDictionary *updateQueuedDict = [[NSMutableDictionary alloc]init];
    [updateQueuedDict setObject:@"8" forKey:@"tip"];
    [updateQueuedDict setObject:@"first name" forKey:@"billfname"];
    [updateQueuedDict setObject:@"last name" forKey:@"billlname"];
    [updateQueuedDict setObject:@"2136528232" forKey:@"billphone"];
    [updateQueuedDict setObject:@"update@EBizCharge.com" forKey:@"email"];


    if([EBizChargeMiddlewareClass retrieveQueuedTrans].count > 0)
    {
        PaymentEngineResultQueue *resultQueue = (PaymentEngineResultQueue *)[[EBizChargeMiddlewareClass retrieveQueuedTrans] objectAtIndex:0];

        NSLog(@"identifier: %@", resultQueue.identifier);
        NSLog(@"request total amount: %f", resultQueue.totalAmount);
        NSLog(@"card num: %@", resultQueue.cardNum);

        [EBizChargeMiddlewareClass updateQueuedTrans:updateQueuedDict :resultQueue.identifier];

    }
}

-(void)updateQueuedTransCompleted:(NSString *)status message:(NSString *)msg
{
    NSLog(@"update queue trans completed: %@", status);
    NSLog(@"update queue trans completed message: %@", msg);
}

/*
    If an identifier is passed in, it will run the queued transaction for that specific identifier
    else it will run all the queued transacitons
*/
[EBizChargeMiddlewareClass runQueuedTrans:@""];

}

-(void)runQueuedTransCompleted :(PaymentEngineTransactionResponse *)transResponse { NSLog(@"run queue trans completed: %@", transResponse.Status); NSLog(@"run queue trans completed message: %@", transResponse.Error); }


## removeQueuedTransCompleted

```c
-(void)removeQueuedTransCompleted :(NSString *)status message:(NSString *)msg

This delegate method is optional when the removeQueuedTrans method is used to remove an offline queued transaction.

Example


/**
* Use this method process offline queued transaction
*/
-(void)removeOfflineQueueTrans
{

    /*
        If an identifier is passed in, it will remove the queued transaction for that specific identifier
        else it will remove all the queued transacitons
    */
    [EBizChargeMiddlewareClass removeQueuedTrans:@""];
}

-(void)removeQueuedTransCompleted :(NSString *)status message:(NSString *)msg
{
    NSLog(@"remove queue trans completed: %@", status);
    NSLog(@"remove queue trans completed message: %@", msg);
}