如何在 ios 中的 CCAvenue 集成中将数据传递到 webview?

How to pass data to webview in CCAvenue integration in ios?

我是 CCAvenue 集成的新手,我想将所有客户数据传递到 webview,但我不知道如何传递它。谁能帮我解决一下?

CCAvenue webview Controller 的 viewDidLoad 中尝试以下代码,如果您的应用程序需要,您也可以在此处传递账单地址。

//Getting RSA Key
        NSString *rsaKeyDataStr = [NSString stringWithFormat:@"access_code=%@&order_id=%@",accessCode,orderId];
        NSData *requestData = [NSData dataWithBytes: [rsaKeyDataStr UTF8String] length: [rsaKeyDataStr length]];
        NSMutableURLRequest *rsaRequest = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString: rsaKeyUrl]];
        [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];
        NSLog(@"%@",rsaKey);

        //Encrypting Card Details
        NSString *myRequestString = [NSString stringWithFormat:@"amount=%@&currency=%@",amount,currency];
        CCTool *ccTool = [[CCTool alloc] init];
        NSString *encVal = [ccTool encryptRSA:myRequestString key:rsaKey];
        encVal = (NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(NULL,
                                                                                       (CFStringRef)encVal,
                                                                                       NULL,
                                                                                       (CFStringRef)@"!*'();:@&=+$,/?%#[]",
                                                                                       kCFStringEncodingUTF8 ));

        //Preparing for a webview call
        NSString *urlAsString = [NSString stringWithFormat:@"https://secure.ccavenue.com/transaction/initTrans"];
        NSString *Name=[NSString stringWithFormat:@"%@ %@",billing_Fname,billing_Lname];
        NSString *encryptedStr = [NSString stringWithFormat:@"merchant_id=%@&order_id=%@&redirect_url=%@&cancel_url=%@&enc_val=%@&access_code=%@&billing_name=%@&billing_address=%@&billing_city=%@&billing_state=%@&billing_zip=%@&billing_country=India&billing_tel=%@&billing_email=%@&delivery_name=%@&delivery_address=%@&delivery_city=%@&delivery_state=%@&delivery_zip=%@&delivery_country=India&delivery_tel=%@",merchantId,orderId,redirectUrl,cancelUrl,encVal,accessCode,Name,billing_address,billing_city,billing_state,billing_zip,billing_tel,billing_email,Name,billing_address,billing_city,billing_state,billing_zip,billing_tel];

        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];
        [_viewWeb loadRequest:request];