CCAvenue 操作后恢复到应用程序

Revert back to app after CCAvenue action

下面是我集成 CCAvnenue 的代码,我搜索了但没有得到任何关于如何在交易失败、交易取消和交易成功等操作后恢复到应用程序的有效答案。

//Getting RSA Key
NSString *rsaKeyDataStr = [NSString stringWithFormat:@"access_code=%@&order_id=%@",access_code,order_id];
NSData *requestData = [NSData dataWithBytes: [rsaKeyDataStr UTF8String] length: [rsaKeyDataStr length]];
NSMutableURLRequest *rsaRequest = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString:rsa_key_url]];
[rsaRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
[rsaRequest setHTTPMethod: @"POST"];
[rsaRequest setHTTPBody: requestData];
NSData *rsaKeyData = [NSURLConnection sendSynchronousRequest: rsaRequest returningResponse: nil error: nil];
NSString *rsaKey = [[NSString alloc] initWithData:rsaKeyData encoding:NSASCIIStringEncoding];
rsaKey = [rsaKey stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
rsaKey = [NSString stringWithFormat:@"-----BEGIN PUBLIC KEY-----\n%@\n-----END PUBLIC KEY-----\n",rsaKey];

//Encrypting Card Details

NSString *myRequestString = [NSString stringWithFormat:@"amount=%@&currency=%@",PayText.text,currency];
CCTool *ccTool = [[CCTool alloc] init];
NSString *encVal = [ccTool encryptRSA:myRequestString key:rsaKey];
encVal = (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL,
                                                                               (CFStringRef)encVal,
                                                                               NULL,
                                                                               (CFStringRef)@"!*'();:@&=+$,/?%#[]",
                                                                               kCFStringEncodingUTF8 ));
[ProgressHUD show:@"Please wait..."];
//Preparing for a webview call

NSString *urlAsString = [NSString stringWithFormat:@"https://secure.ccavenue.com/transaction/initTrans"];
NSString *encryptedStr = [NSString stringWithFormat:@"merchant_id=%@&order_id=%@&redirect_url=%@&cancel_url=%@&enc_val=%@&access_code=%@&billing_name=%@&billing_address=%@&billing_country=India&billing_tel=%@&billing_email=%@&billing_zip=110092&billing_state=Delhi&billing_city=New Delhi",merchant_id,order_id,redirect_url,cancel_url,encVal,access_code,billing_name,billing_address,billing_tel,billing_email];

NSData *myRequestData = [NSData dataWithBytes: [encryptedStr UTF8String] length: [encryptedStr length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString: urlAsString]];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
[request setValue:urlAsString forHTTPHeaderField:@"Referer"];
[request setHTTPMethod: @"POST"];
[request setHTTPBody: myRequestData];
[_Web loadRequest:request];

}
NSString *string = webView.request.URL.absoluteString;

if ([string rangeOfString:@"/ccavResponseHandler.php"].location != NSNotFound) {
    NSString *html = [webView stringByEvaluatingJavaScriptFromString:@"document.documentElement.outerHTML"];

    NSString *transStatus = @"Not Known";

    if (([html rangeOfString:@"Aborted"].location != NSNotFound) ||
        ([html rangeOfString:@"Cancel"].location != NSNotFound)) {


        transStatus = @"Transaction Cancelled";

    }
  else if (([html rangeOfString:@"Success"].location != NSNotFound)) {

        transStatus = @"Transaction Successful";


    }
   else if (([html rangeOfString:@"Fail"].location != NSNotFound)) {


        transStatus = @"Transaction Failed";

    }
}