How to do 3-D Secure Authentication in Mastercard Gateway Android SDK? - android

I followed https://github.com/Mastercard-Gateway/gateway-android-sdk/wiki this to make payment in my application.
Used test Merchant Id initially to create session by below API.
https://mtf.gateway.mastercard.com/api/rest/version/56/merchant/DB***/session/SESSION000****
Which gave session id in response and with that updated my card details in update session API.
Got success message like
{"session":{"updateStatus":"SUCCESS","version":"cd9f6b9602"}}
After that I generate a random 3DSecureId for testing and passed sessionId, AMOUNT, CURRENCY, 3dSecureId in check3DSecureEnrollment API.
But getting - Error Unexpected response code 400. I couldn't able to figure what is the issue in this params?
Another try is -
https://github.com/Mastercard-Gateway/gateway-android-sdk/wiki/3D-Secure-Authentication
Checked for option 1 & 2 in the above link. Showing Error inflating class layout InflateException.
Needed help to resolve these issues?

Me too was facing the same issue. Since there is no good documentation its hard to fix these kinds of issues. To solve the issue you mentioned, my approach was to take Gateway3DSecureActivity out of the library
Intent intent = new Intent(this, Gateway3DSecureActivity.class);
intent.putExtra(Gateway3DSecureActivity.EXTRA_HTML, html);
intent.putExtra(Gateway3DSecureActivity.EXTRA_TITLE, title); // optional
startActivityForResult(intent, YOUR_3DS_REQUEST_CODE);
So I replaced Gateway3DSecureActivity in the code above with my custom activity
I was working on Kotlin so I created my own activity to handle the response which works fine. The Exception is due to the structure of the layout. The layout starts with layout tag which is the reason for the crash. So we can create our own activity without this tag that's what I have done.
Please have a look at my gist

Related

Pass custom variable to Bitrise flow through the API

I am setting up a Bitrise on an Android app. I have everything set that is related to the flow, the thing is that I have a custom python builder which requires a parameter. My build-flow is triggered through API, which is working as expected - the only thing missing is passing that parameter to the build script.
What I have currently:
I have added an env-variable; named PARAM
My JSON body, that triggers the build
{
"hook_info":{
"type":"bitrise"
},
"build_params":{
"branch":"master",
"workflow_id":"test_args_script",
"commit_message":"Triggered from postman",
"environments":[
{
"mapped_to":"PARAM",
"value":"123456",
"is_expand":true
}
]
}
}
On the Bitrise flow I have a script step which is actually calling the python script as follows: python builder.py $PARAM
EXPECTATIONS:
My expectations are that the value that will be passed to the script will be the same as the one in the API payload (123456).
If anyone has recently worked on something similar, or if any of you guys can point me out to documentation that will help me to achieve the above I will be really thankful!
I actually found the way. The problem on my end was that I had an env-variable already named the same as the one variable that has been passed from the API. After changing the name to a different one, I was able to get the parameter and pass it to the build script. If anyone needs more info, give me a shout and I can post the payload along with the flow settings.

How to use Facebook's new LoginManager.createLogInActivityResultContract properly?

Facebook added a new API (LoginManager.createLogInActivityResultContract) for handling login using the ActivityResultContract APIs in SDK version 13.2.0 (https://github.com/facebook/facebook-android-sdk/blob/main/CHANGELOG.md#1320)
So far I've been able to work out how to launch the activity with the requested scopes thanks to the documentation here: https://github.com/facebook/facebook-android-sdk/commit/9cc564990b9512d767201b74136d71a5ea13fc64
But what I'm not able to do is understand how to access the result of the login activity.
For example: In this block:
val launcher = registerForActivityResult(
loginManager.createLogInActivityResultContract(callbackManager)) { activityResult ->
// activityResult is of type CallbackManager.ActivityResultParameters, how do I know if the login was successful? Or a failure occurred? Or the user canceled?
}
The best I've been able to find is that you can get the CallbackManager.ActivityResultParameters intent value, and then look at the extras via the com.facebook.LoginFragment:Result key and the value returned is of type LoginClient.Result but that is marked as restricted (via #RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) ) so I'm not sure that is... correct.
It works, and I can suppress the associated lint warnings that come from this, but having to:
Use a hard coded string rather than a value from the FB sdk to access the intent extra bundle value
Ignore a lint warning talking about how a restricted API/class is being used
to get this to work seems incomplete/wrong.
Am I missing anything here? Or is this still incomplete end to end?

Crashlytics custom key not appearing in crash

I am trying to figure out how to link each and every crash with application user id. I got to know we can achieve this functionality with firebase customized key logs.
For POC purpose, I have added custom key after logged in completion and then I am crashing app on next screen. But Custom keys are not getting logged on console.
Here, how I am adding custom key :
FirebaseCrashlytics.getInstance().setCustomKey("userId", serverLoginResponse.getBody().getUserId());
And I am crashing application on next screen using divide by 0.
int i = 2;
int j = i / 0;
But keys are not gettging tagged to crash. Please see screenshots.
On Dashboard.
on Crash Details Screen :
Please let me know if I am doing anything wrong here.
You should enable the collection in your activity but preferable in the Main Application Class
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
Follow this guide:
FirebaseCrashlytics
I noticed that key/values set using setCustomValue(_,_) didn't persist between app relaunches. I had to call the setCustomValue code everytime on app relaunch aka appDidFinishingWithOptions(_). See related solution and answer here: https://stackoverflow.com/a/68097562/4970749
Note that setCustomValue here affects Crashlytics dashboard which is the second screenshot you showed here, under "Crash Details Screen." It doesn't update Firebase Analytics keys/properties (first screenshot), thats a separate method (try: Analytics.setUserProperty(value, forName: name) for that first screenshot).

Testing if my assertion using Ruby and Appium is correct

I wonder if someone can help?
I have created snippets using Ruby for my appium test.
The test passes if the correct page has loaded but I want to know that my fail assertion works as well.
If the below element (mobile_number_text) is on the page I get the 'Correct page is showing' message.
However, what do I have to do to have 'incorrect page is showing' message appear?
I have tried changing the elements' name to 'mobile_text' to trigger the incorrect message but instead my test fails as it cannot find the element.
if find_element(id: "mobile_number_text").displayed?
puts("Correct page is showing")
else
puts("incorrect page is showing")
end
end
Many thanks for your time
Zaif
In Java we would have to wrap find_element(id: "mobile_number_text").displayed? in a try/catch block so that it does not throw an exception when it cannot find the element. The equivalent in Ruby should work.

TapJoy offer list in Fragment

I am currently developing a Android application for a client who wants TapJoy integration, and wants to show only the offer list provided by TapJoy.
The app has Actionbar sherlock integrated and has five tabs, and one of the tabs should display this offer list.
So I downloaded the jar and the attached documentation and followed their examples on how to display the offer list.
While doing this I came to the conclusion that when you execute the following code.
Hashtable<String, String> flags = new Hashtable<String, String>();
flags.put(TapjoyConnectFlag.ENABLE_LOGGING, "true");
// Connect with the Tapjoy server. Call this when the application first starts.
// REPLACE THE SECRET KEY WITH YOUR SECRET KEY.
TapjoyConnect.requestTapjoyConnect(getSherlockActivity().getApplicationContext(), "bba49f11-b87f-4c0f-9632-21aa810dd6f1", "yiQIURFEeKm0zbOggubu", flags);
TapjoyConnect.getTapjoyConnectInstance().showOffers();
TapjoyConnect connect = TapjoyConnect.getTapjoyConnectInstance();
note: the value of the keys are from the examples from tapjoy self
It launches an new Activity with a Webview, I know this for a fact because you had to declare the activity with the com identifier of the tapjoy class in my Android manifest.
If I use the code provided above, every time when the tab on the left/right and the actually offer list displaying tab gets loaded, it launches a new Activity and this is kinda a unusual workflow. And totally not Fragment pager like behaviour.
Now for my question !
Did somebody managed to get.
the complete ruquested URL (So I can load it in my own webview)
Let it return a Webview component so I can add it to my Fragment.
Hit me with something else that will works.
I already tried to extend some of the classes, but the class the launches the activity is a singleton class and I get a an error on in the constructor on the super.
thanks in advance.
Nope this cant be doen, lets hope that tapjoy will consider the android UI guidline in the future and include fragments in the new libs

Categories

Resources