OnCancel getting called immediately after onvalidatemerchant - applepay

I'm trying to set up a POC for applepay processing on the web. I have a site on Azure that is a verified merchant domain, and am able to generate payment sessions that look valid as far as I can tell, e.g.
{
"epochTimestamp": 1618320255698,
"expiresAt": 1618323855698,
"merchantSessionIdentifier": "some identifier",
"nonce": "some nonce",
"merchantIdentifier": "some identifier",
"domainName": "myVerifiedDomain.azurewebsites.net",
"signature": "a nice long signature",
"operationalAnalyticsIdentifier": "display name:the merchant session identifier above",
"retries": 0
}
This is generated in the onvalidatemerchant event handler, and passed into session.completeMerchantValidation.
Using a sandbox account or a live Apple account with linked cards, the next thing that happens is an immediate "payment not completed" message in the ApplePay popup on the page, and the oncancel event is hit Inspecting the event, I don't see anything that hints at the issue. There is a sessionError object, but its code is "unknown" and the info object is empty.
What could be causing this? Other reports I've found seem to be mostly about the domain being unverified, but it definitely matches what is verified, and I've tried a few variations (including the https://, and the full page URL rather than just the domain) and I get the same symptoms

I've figured it out. The displayName property was missing in my model so wasn't being deserialised from the JSON

Related

Delete "Other Contact" using Python with Google People API

I used Google People API v1.otherContacts.copyOtherContactToMyContactsGroup (reference) to copy a contact from "Other Contacts" to "myContacts" contact group. I now want to delete the original contact from "Other Contacts" using the same API.
REST Resource v1.otherContacts (reference) does not list a DELETE action.
I tried using v1.people.deleteContact (reference) passing the resource name of my "Other Contact":
import pickle
from googleapiclient.discovery import build
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
people_api = build('people', 'v1', credentials=creds)
people_service = people_api.people()
response = people_service.deleteContact(resourceName='otherContacts/c1971897568350947161').execute()
But I got an error saying:
TypeError: Parameter "resourceName" value "otherContacts/c1971897568350947161" does not match the pattern "^people/[^/]+$"
Looks like v1.people.deleteContact does not work for deleting a contact in "Other Contacts".
How can I programmatically delete a contact from "Other Contacts"?
EDIT: Based on #DaImTo's suggestion below, I tried replacing otherContacts/ in the resource name with people/ and invoking the v1.people.deleteContact API, but I got an error saying:
googleapiclient.errors.HttpError: <HttpError 404 when requesting https://people.googleapis.com/v1/people/c1971897568350947161:deleteContact?alt=json returned " generic::NOT_FOUND: Contact person resources are not found.". Details: "[{'#type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'field': 'resourceNames[0]', 'description': 'Resource not found.'}]}]">
I advice consulting the documentation for people.deleteContact
Required. The resource name of the contact to delete.
DELETE https://people.googleapis.com/v1/{resourceName=people/*}:deleteContact
That means it should be people/c1971897568350947161 assuming that is the id of the user you want to delete c1971897568350947161.
Looks like Other Contacts are read only, according to this announcement from Google: https://developers.google.com/contacts/v3/announcement
The new People API has the same functionality as the legacy Contacts
API for all features, with the following exceptions for “Other
Contacts”:
Administrators have read-only permissions for “Other Contacts” through
the new scope. As sending mutate/write signals back to “Other
Contacts” is not supported, your users will have to add the Other
Contact as a My Contact if they wish to update its data fields.

Adaptive Card Action.OpenUrl not working for certain URLs in Microsoft Teams bot

I am working on a Microsoft Teams chat bot using Microsoft Bot Framework. The bot sends an Adaptive Card containing some text and the following Action:
{
"type": "ActionSet",
"actions": [
{
"type": "Action.OpenUrl",
"title": "View in dashboard",
"url": "${url}"
}
]
},
The URL is of the following form (edited to remove identifying info):
https://internaldomain.net/dashboard/share/134590h9?overrides=[{"query":"//dataSources","key":"account","replacement":"accountName"},{"query":"//*[id='Cluster']","key":"value","replacement":"clusterId"},{"query":"//*[id='NodeId']","key":"value","replacement":"nodeId"},{"query":"//*[id='ContainerId']","key":"value","replacement":"containerId"}]&globalStartTime=1591552800000&globalEndTime=1592460000000&pinGlobalTimeRange=true
The URL is generated and passed into the url property using a JSON templating library, and I can print the URL in the console so I know it is set properly. Also, I can run the bot in the Emulator and open the link that way. However, when I run the bot in Teams and try to open the same exact link by clicking the action button, nothing happens. If I change what URL is passed in, e.g. using https://internaldomain.net/dashboard, the link works correctly.
One thought is that the generated URL is formatted improperly so Teams doesn't recognize it or open it. But I can paste it into a browser and it opens properly.
Another thought is that the URL length (almost 500 chars) exceeds some limit for Adaptive Cards, but I haven't been able to find any info about that in the documentation or online.
I would appreciate any other ideas about what might be causing this.
Thanks!
It looks like you're needing to encode the urls before embedding them - probably the {"query" etc. is conflicting with the final Json. It looks like you're using .Net, so you could call WebUtility.UrlEncode, on everything from "?" onwards (i.e. "?overrides...")

The like-button show my like-count, but it's not visible in the facebook api

If i go to https://developers.facebook.com/docs/plugins/like-button/ and enter https://www.ballantinesbarproject.fr/?name=epicerie and select box-count as layout.
the like-button shows a like count, as expected, since I liked the page. However, if I look in facebook api:
REST:
https://api.facebook.com/method/links.getStats?urls=https://ballantinesbarproject.fr/?name=epicerie&format=json
FQL:
https://graph.facebook.com/fql?q=select%20url,%20like_count%20from%20link_stat%20where%20url=%22https://ballantinesbarproject.fr/?name=charlatan%22
(though one user claims, he can se counts in the fql-api)
It says there is 0 likes. How come?
Following query is the proper FQL Query for retrieving like or comments count for a link
select url, like_count from link_stat where url="https://ballentines.herokuapp.com/?name=charlatan"
I have debugged the above Query with Graph Explorer
Reference : https://developers.facebook.com/tools/explorer/145634995501895/?fql=SELECT%20like_count%20FROM%20link_stat%20WHERE%20url%20%3D%20%27https%3A%2F%2Fballentines.herokuapp.com%2F%3Fname%3Dcharlatan%27
If you check on above link, you would get proper like_count (now 3). Screenshot below
If you check above Screenshot the application selected is "Graph API Explorer" which is the default App while debugging with Graph API explorer.
If you are logged in with your proper Developer Account. the application Dropdown would also have your Application.
So after switching to your Application, click "Get App Token" and then submit the Query.
Now the like_count would come 0 for the same query. See Below Screenshot.
Now click on "Get Access Token", this would ask you to Allow the App if you not already done so. After "Allow App" proper User Access Token would be loaded in "Access token" box and now again Submit your Query. Now the "like_count" would be 3 as expected.
So you would need proper User Access Token to retrieve proper information from "link_stat" FQL table and App access token wont work for it
Hope this helps.
I guess you should use the following FQL:
select url, like_count from link_stat where url="https://ballentines.herokuapp.com/?name=charlatan"
Gives me
{
"data": [
{
"url": "https://ballentines.herokuapp.com/?name=charlatan",
"like_count": 1
}
]
}
as result...
The Open Graph debugger shows that the og:type meta-data is missing. That could be related to the problem. Can you add it?
https://developers.facebook.com/tools/debug/og/object?q=https%3A%2F%2Fwww.ballantinesbarproject.fr%2F%3Fname%3Depicerie

MsgBox on server side

I am trying to display a popup message on my web app. When i run my app normally on my local pc, i get the pop up message boxes appear. However when i publish the app they dont.
here's how it will work:
a button is pressed, it will pick up a file from a directory, then it will check another directory to see if the file the exists...if the file exists then a pop up is needed to inform "File already exists. do you want to continue?" if the user clicks yes it carried on with the code, if they click no then the process is ended.
do anyone have any idea how to do this?
my code so far:
If System.IO.File.Exists(acceptedExistsuNKNOWN) And System.IO.File.Exists(rejectedExistsUNKNOWN) Then
'IF BOTH EXIST
If MsgBox(acceptedExistsuNKNOWN & " & " & rejectedExistsUNKNOWN & "files already exists, do you want to rerun the process?", MsgBoxStyle.YesNo, "Files Exists") = MsgBoxResult.Yes Then
(continur
else
System.Diagnostics.Process.GetCurrentProcess.Kill()...
many thanks
The problem with your idea is that someone would need to sit logged in to the server to interact with the modal popup boxes; that is, if this was even possible, since it would need to be that person on the server who does the action on the page in order to be the recipient of the popup, so it's not like other users can issue a popup to him.
What you do on the server side executes on the server side.
I think you really want ti to show on the client side, but want the logic to make it happen on the server side. It doesn't work this way. Instead, what you might do is output something n the response that indicates a client-side popup should be shown. For instance, you could have a hidden field on the page and set a value, then use JavaScript to show an alert if that value meets your criteria.
Think about what you are asking. If a dialog pops on the server side, the user will not be able to see it (they are on the client side). Moreover, the code will be at a standstill until someone dismisses that dialog, which the user cant see. Only individuals with access to the server will be able to see this. Do you intend to have someone watching the server 24/7? Instead, you probably want to alert the user. This can be done my returning a response from the server code to the client code to display a dialog. The simplest method would be to throw an error and redirect the user to a new page to display an error. If you want something more fluid, you can use updated panels and the AjaxControlToolkit's modal pop up extender. Another way would be to use ClientScript, like this:
try
{
//check for files here
}
catch (Exception ex)
{
string script = "<script>alert('" + ex.Message + "');</script>";
if (!Page.IsStartupScriptRegistered("myErrorScript"))
{
Page.ClientScript.RegisterStartupScript("myErrorScript", script);
}
}

Rails: How to post on my main facebook page through API?

I have the following permissions:
create_note, email, offline_access, photo_upload, publish_stream, read_stream, share_item, status_update, manage_notifications, read_friendlists, video_upload, user_relationships, user_status, user_photos
I can do post on the user timeline (www.facebook.com/username) but I can't see how to post on the user's wall (www.facebook.com)
To post on the user timeline, I use a code something like:
if I need to attach an image to the post
client.put_connections("me", "feed", attachments, attachments)
and
if I don't need to attach an image to the post
client.put_connections("me", "links", attachments, attachments)
both are working nice, but none of them really publish the message on the wall (www.facebook.com as a logged in user)
So, I just wondering if it is a normal behaviour or am I just missing something?
Thank you.
The same behavior I can see for other users those are sharing update from API. I think it's normal and we need not to worry about it.
As per me : We can't not say this is required because getting our own feed in 'News Feed' section is not beneficial at all.

Resources