How to complete order after successful payment opencart api android? - android

I am developing an android app using Opencart API.
I could managed to get payumoney payment responses and could verify them. But I don't understand what's next. The order status has to be updated, History to be created and the cart has to be cleared.
I guess checkout/success is meant for web and it returns html. I just need the order status updated and cart cleared.

You are looking in the wrong place.
Each stop payment has its controller to receive a response about the status of payment. Usually it lies in the controller/payment .
The payment system after payment calls this method and the entire procedure for creating and changing the status occurs in it.
Usually it simply calls the method
$this->model->checkout->order->addHistory(...);

Related

Check user auth on every Activity

Is it appropriate to check user auth to server api in every activity (i assume using base activity on resume)? It is to prevent user login on multiple device with same account. Or is there better approach for this?
There is several approach to handle this.
Push notification - When same user login in another device then you need to send push notification to first login device. When first login device get notification then you can put your logic there.
Put Logout status on every api - You need to check logout status code in every api response. When you get logout status code then you can put your logic there.
Note: For second approach you need to make one generic api calling class. So, You don't need to put this status code in every api calling code.
So I'm assuming that every successful sign-in then the server gives you back a unique auth-token which should invalidate any previously assigned token.
My approach is usually just to allow the user to continue using the app with whatever cached data that's already there until I hit a scenario that needs to do an API call. And if I get an error code like HTTP 401 or 403 because the auth token was invalidated then should send me back to the sign-in screen.
Doing an explicit API call in onResume() seems wasteful and is basically client-side polling I would only do this if it was a very strict requirement to keep the auth information fresh because the information on screen is sensitive.

Firebase RemoteConfig used for showing a message on app start

I am thinking of using RemoteConfig for these 2 purposes:
Have on the server a parameter minVersion of the app that should function. So for instance if v1.5 is broken and I release an update on Google Play as v1.6 I want to block access to 1.5 and older and force the user to update to 1.6 in order to use the app.
Have on the server, a parameter to store a message to display in the app. So for instance have a message like "We are having server maintenance, please wait a while". On app start, if the message parameter is not empty, show a dialog with it in the app.
Of course, in this case, on each app start I need to fetch the remote config values and check them.
Why use RemoteConfig? Because it's easy, it's free, it's convenient and I don't need to have another separate server for these 2 simple jobs.
So is this a valid use case?
Yes these are both valid cases.
For point 1, you can quite easily determine the users app version. I created a video detailing how to do it
https://youtu.be/McP11kcrMtk

GroupMe API Callback

So, I am trying to use GroupMe's API. The issue is that I don't really know how to get the users access_token once I send them to the site to login. I don't really know how to create a callback or how to use it. So to sum it up
I need to send users to this site
https://oauth.groupme.com/oauth/authorize?client_id=CLIENT_ID,
then they login and groupme sends them to here
https://YOUR_CALLBACK_URL/?access_token=ACCESS_TOKEN.
But I don't know how/where to create a callback url. Then I don't know how to send that access_token back to the app.
Thanks.
A callback URL is simply a url exposed by your app that groupme can redirect users to. The page can be anything, however, oftentimes it takes the user back to your app if it is a webapp, or tells the user to close the page.
The important part is that the url is one that the app controls, so that it can get the contents of the url that contain the token and other data.
If you are writing a web app, then the framework or language should a method or variable you can call or read to get the url. If you are writing a desktop/moble app, one way of creating a callback url is to listen on a tcp port and speak http to the browser. Another way is using a lightweight web server library, or use a lightweight external server like lighthttp and communicate using cgi/fastcgi. All that matters is that you can get the url that groupme se,t the user to.
If you need anymore help, you are using Oauth2 so search for help with that. Nothing that you asked about here is specfic to groupme, so you should be able to use any OAuth2 library.

how sinch callback works

i want a create a android paid calling app using sinch.
sinch includes a callback API to get details of call.
i wanted to use this but no idea how to.
i read the documentation. but it is not enough
my question is,
what are the requests to the server.?
how can i find what to what country the call is going on ?
how can i restrict calls based on the account balance in our database
Note:
i can generate the userid for calling it is a 15 digit string i will use it as username to connect a call
Configure a calling callback url in the dashboard for you app
Implement your backend details can be found here: https://www.sinch.com/docs/rest-apis/api-documentation/#callingcallbackapi
When you get the ICE event, you will get who is calling, look up the balance in your database, if the user doesnt have balance create a hangup action instead of ConnectPSTN.

Facebook SDK for Android: Trying to get a notification when one "likes/comment" the post made by my Android app

I'm fairly new to Facebook SFD for Android.
What I'm trying to achieve is an Android app that uses facebook login, post to the user timeline and gets notified whenever one is commenting or liking that post.
I went thru Facebook tutorials for login and for Publish to Feed.
All went well.
Now I'm struggling with the last part. I don't see how to be notified whenever there is a like or comments. I browsed the web and stackoverflow forum without any success. I'm guessing that there is a mechanism to be notified by Facebook and that I don't have to start a process just to monitor the post...
Anyone could give me a hint on the API to use?
I'm currently looking at "Creating Object Types" section Associating Actions with Object Creation (https://developers.facebook.com/docs/opengraph/creating-object-types) but it looks like this describes how to do for facebook web app, and not for android app.
EDIT
I've found this https://developers.facebook.com/docs/graph-api/real-time-updates/ but not quite sure how to "translate" this into Android coding.
If anyone could help me with this, it would be greatly appreciated.
I guess you have to create a page in php that will handle the responses from Facebook, it starts with a
GET response from Facebook that you retrieve with $_GET["name"] in php, and you have to send back a confirmation to Facebook to confirm that the connection works, and Facebook will send you the answer you want via
a POST request ( $_POST["name"] ) (with a json object, containing the informations about the user in object for example, and the different updates in entry).
You can put all these informations in a database, and when the user start your application, you can automatically connect him to a php script that check if the database has new informations for him.
(specifying who he is, with a user variable that he keeps in the memory of his device, and then you ask for informations from the database about this user). I haven't tested, but it should work.

Categories

Resources