0

Here i have issue in my code for request.

    webViewMakePaymnets.delegate = self
    //Getting RSA Key

    MyViewState.rsaKey = "-----BEGIN PUBLIC KEY-----\n\( MyViewState.rsaKey)\n-----END PUBLIC KEY-----\n"
    print("\( MyViewState.rsaKey)")
    //Encrypting Card Details
    var myRequestString = "amount=\(MyViewState.amount)&currency=\(MyViewState.currency)"

    var ccTool = CCTool()

    var encVal = ccTool.encryptRSA(myRequestString, key: MyViewState.rsaKey)

    encVal = (CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(nil, (encVal as! CFString), nil, ("!*'();:@&=+$,/?%#[]" as! CFString), kCFStringEncodingUTF8)) as! String)

    //Preparing for a webview call
    var urlAsString = String(format: "https://secure.ccavenue.com/transaction/initTrans")

    var encryptedStr = "merchant_id=\(MyViewState.merchantId)&order_id=\(MyViewState.orderId)&redirect_url=\(MyViewState.redirectUrl)&cancel_url=\(MyViewState.cancelUrl)&enc_val=\(encVal)&access_code=\(MyViewState.accessCode)"

    var myRequestData = NSData(bytes: encryptedStr.UTF8String(), length: encryptedStr.length())!

    var request = NSMutableURLRequest(URL: NSURL(string: urlAsString)!)
    request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "content-type")
    request.setValue(urlAsString, forHTTPHeaderField: "Referer")
    request.HTTPMethod = "POST"
    request!.HTTPBody = myRequestData!
    webViewMakePaymnets.loadRequest(request)

I have above code and i am facing issue that is shown in the attached image.enter image description here

Code Different
  • 90,614
  • 16
  • 144
  • 163
ZetrixWeb
  • 47
  • 1
  • 8
  • Please tell us exacly which Xcode version you're using. There have been many changes almost each of the latest swift 3 betas. – Gerd Castan Aug 24 '16 at 18:14
  • i am using xcode 7.3.1 – ZetrixWeb Aug 24 '16 at 18:26
  • 1
    Take a look at these two questions: http://stackoverflow.com/q/25786226/1718685 and http://stackoverflow.com/questions/37087325/how-to-convert-string-to-unicodeutf-8-string-in-swift They may have the info that you need. – Stephen Aug 24 '16 at 18:53

0 Answers0