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);

}

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.

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);

}

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