CCAveneue payment intergration with WebView - ios

I have searched lot about that implement CCAveneue payment intergration . i have also checked on CCAveneue websiter but did't get any information. if anybody have implemented CCAvenue in IOS then please provide any solution for that.
* backend in JAVA
what i'm doing is just getting rsa key from server then what i have to do with that.
Thanks in advance

Integration with CCAvenue was a difficult task. After long conversations with the support team and back-end teams, this is how we achieved integration with iOS app :
iOS app sends all the data (POST body key-value dictionary) to your backend server
Backend server redirects to the CCAvenue payment gateway by passing all the relevant information required by CCAvenue (please check CCAvenue integration guide for this)
User on iOS app fills in the payment details on the CCAvenue page and completes the payment
After payment completion, CCAvenue redirects to your backend server url (provided in the "redirect_url" key of POST data)
Here your backend server can process the payment response
Now is the important step
Your backend server after processing the response, should then redirect to a decided URL (YOUR_TRACKING_URL), which your iOS app will track to notify the completion of payment flow. This URL will be a server-client contract and must remain same in the iOS app.
In your iOS app, you can check this URL using UIWebView's delegate method as
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if ([[request.URL absoluteString] isEqualToString:YOUR_TRACKING_URL])
{
// Payment flow complete.
// You can close the UIWebView here, or do whatever you want on payment completion
// Do not allow redirect to this URL
return NO;
}
return YES;
}

Related

Twitter API: How Do I Create a Protocol Only Callback URL?

In Twitter's Developer Documentation we can read the following:
Mobile apps with app-specific protocols must use just the protocol
Example:
You want to use example://authorize as your callback URL
Add this to both your Twitter app dashboard and your call to oauth/request_token: example://
However; in the Developer's Dashboard I am not able to enter a protocol only URL, or any URL beginning with other than http or https.
My reason for wanting a protocol only URL is so that I can use in an iOS app that uses OAuthSwift to access web APIs.
Any ideas anybody?
I haven't found the answer to the original question but I do have an excellent work around. So, for anyone else who might land here:
The web app at https://oauthswift.herokuapp.com/callback
will perform redirections. If you access that web site with the url https://oauthswift.herokuapp.com/callback/target then it will redirect to oauth-swift://oauth-callback/target.
So:
In the Twitter Dashboard enter https://oauthswift.herokuapp.com/callback/SomeName for your app's callback URL
Register oauth-swift as a URL scheme in your iOS app's URL Types
In your iOS app, use https://oauthswift.herokuapp.com/callback/SomeName as the callback URL for the OAuth authorization request.
Voila. Twitter will redirect to https://oauthswift.herokuapp.com/callback/SomeName which will in turn redirect to oauth-swift://oauth-callback/SomeName, allowing your iOS app to regain control of the flow.
If you find any of this confusing then this might help: http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

How do you detect a redirect in an UIWebView iOS

I am using Xcode for a social media network site and I have a quick about the login/ signup process. For instance, I have a UIWebView that is linked to the login API page. (ex. www._.com/api_login.php?) When the user logs in with their credentials on that page the website redirects them to the success page (www._.com/api_success.php?) with the API authentication token that is stored in the iOS app for user specific tasks embedded in the website source code.
Here is my question: How can I tell Xcode to execute Javascript to grab the authentication token once it is on the (www._.com/api_success.php?) page? Keep in mind that the URL is specific to the user and has a user specific api key at the end of the link. (www._.com/api_success.php?apiconnectkey=123456789)
Thanks in advance for help with this,
Technology Guy
I'm not sure I follow 100%, but here are some things to look at:
Implement UIWebViewDelegate in your view controller and set the delegate property, then implement this message
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:
Docs
https://developer.apple.com/library/ios/documentation/uikit/reference/UIWebViewDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIWebViewDelegate/webView:shouldStartLoadWithRequest:navigationType:
This will let you see each URL that is being set on the web view. So, you could grab apiconnectkey.
Also, you can execute JavaScript on the page with
[self.webView stringByEvaluatingJavaScriptFromString:#"getToken()"]
where getToken() is a function on the page. This will return a string.
https://developer.apple.com/library/ios/documentation/uikit/reference/UIWebView_Class/Reference/Reference.html

Facing issues while trying to receive Real Time Updates from Facebook

I have a Mvc-facebook Application. I have configured my Facebook-Sample app in the Facebook Site.
Purpose of Sample Facebook App
Whenever I make some change in the first Name. Facebook should send the changes to my Web-Server in the form of JSon.
I have successfully configured the Subscription.
Facebook sent the token. Matched it with my code and my code sent the same token to Facebook. It's very good so far.
Issues 1 - In my Web-Server, I have Fiddler installed. When Facebook sends token to my Web-Server IIS, Fiddler is not showing the request.
Issue 2 - when I made some changes in my First Name, Facebook is not sending the data to my Web Server.
Please tell me what is missing in these issues.
Code
[HttpGet]
[FacebookSubscriptionVerify("MyToken")]
public void Verify(FacebookClient fb)
{
Response.Write(fb.AccessToken);
var verifiedResult = new FacebookSubscriptionVerifiedResult();
verifiedResult.ExecuteResult(ControllerContext);
}
[HttpPost]
[FacebookSubscriptionReceived]
[ActionName("Verify")]
public void ReceiveUserUpdates(object subscription)
{
}
In my Web-Server, I have Fiddler installed. When Facebook sends token to my Web-Server IIS, Fiddler is not showing the request.
Well, that does not sound as if your debugging/monitoring was successful, does it? You say before, that Facebook has actually sent you the token.
Find other means of debugging, f.e. have a look into the server’s access log.
when I made some changes in my First Name, Facebook is not sending the data to my Web Server.
If you deduce that the same way as you did above, then you probably deduced wrong …?
Be aware, that the POST requests Facebook sends for Realtime Updates are not in the “normal” format you would expect from f.e. an HTML form post, that means not as Content-Type: application/x-www-form-urlencoded.
Use wireshark to check what is sent, that will give you a correct view. Just capture everything and check http protocol.

RestKit - Handling authentication

I've begun working on the proof-of-concept for an iOS application that we'll be developing that leverages REST-based web services (implemented in Java using restEASY). I will be using RestKit as my client-side services library, and have been reading up on the documentation and some examples.
The vast majority of the services will require that a user be authenticated with a username and password. We have authentication services in place that accept a JSON object containing the credentials, so that part is easy. My question is, how do we handle the iOS piece when a service says that authentication is required?
Imagine this scenario...
A user starts up our app and it recognizes that the user needs to authenticate. A modal view controller pops up, prompts the user for authentication, and submits the request. The user is then able to make a bunch of REST calls with no problem. Eventually, they turn off their phone (app is still active) and come back to it an hour or so later. They click a button to fire off another REST call, but by this time the server-side session has expired.
Ideally, we'd like to be able to recognize that the server has indicated authentication is required, and pop up the modal view controller again. But, does RestKit have support for this? Is there any way for us to register a "global response handler" that is able to recognize that the server has responded this way?
We can return a status code in JSON or use an HTTP status code. We have flexibility on our services. The real question is how to handle this in the ideal way on the client. And, once we've reauthenticated the user, is there any way to replay the request they originally tried to submit? Or, would they have to kick off the action again?
Sorry if this doesn't make sense or if it's a very simple problem to solve. As I'm just getting started with RestKit, I wanted to make sure I was doing this the right way to avoid future problems. Any advice, code samples, tutorials, etc. that you can provide would be GREATLY appreciated.
I would suggest that you make a request to the server in your AppDelegate
- (void)applicationDidBecomeActive:(UIApplication *)application or
- (void)applicationWillEnterForeground:(UIApplication *)application method that sends the old authentication token. The server can then provide a response if the token is valid or invalid.
If your AppDelegate adopts the RKObjectLoaderDelegate protocol then it can handle the response. That way, whenever the application becomes active, the user is prompted to re-authenticate if necessary.

Secure Authentication: Rails WebApp and iOS App

i searched a long time but could only find really basic information, so i decided to ask here:
The simple thing is, that I wanna authenticate an iOS Application against a rails web Application.
I thought about something like HTTP Basic or Token based - but this isn't what I really want.
I wanna authenticate against OAuth from Facebook, Twitter and so on.
On the rails side this is really easy. Device with omniAuth did this job great.
But how shall I authenticate the iOS App with this method?
It would be great if anybody could give an more detailed view on how to do this.
I think you have two solutions.
1: WebView
Use WebView for OAuth request/response.
SHKOAuthView of ShareKit will help your understanding.
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
// "OAUTH_DID_FINISH_SUCCESS_URL" is URL your wab app display after finishing OAuth authentication successfully.
if ([request.URL.absoluteString isEqualToString:OAUTH_DID_FINISH_SUCCESS_URL])
{
// OAuth success
return NO;
}
return YES;
}
After finishing OAuth authentication with WebView, iOS app automatically save cookie(if web app save cookie), so iOS app can normally request/response to web app. Incidentally Android may not save cookie automatically, so token based authentication is better if you have to support Android app too.
2: RestKit
RestKit support OAuth.
I think Device is not the best solution for iOS Application with OAuth.
I think scratch authentication with omniAuth is better.

Resources