how to verify payment paypal on mobile sdk 2.x? - mobile

i made application on android with paypal for payment but i donot know how to verify payment paypal in my app android.
this is my responce payment from paypal on sanbox environment.
{
"response": {
"state": "approved",
"id": "PAY-27N978063W077501JKPUBNZQ",
"create_time": "2014-08-11T01:05:42Z",
"intent": "sale"
},
"client": {
"platform": "Android",
"paypal_sdk_version": "2.2.2",
"product_name": "PayPal-Android-SDK",
"environment": "sandbox"
},
"response_type": "payment"
}
{
"amount": "520.10",
"short_description": "htc one",
"details": {
"tax": "0.300000011920928955078125",
"subtotal": "519.80",
"shipping": "0"
},
"intent": "sale",
"currency_code": "AUD",
"item_list": {
"items": [
{
"quantity": "2",
"price": "259.90",
"sku": "GATE5000k",
"currency": "AUD",
"name": "htc one"
}
]
}
}
please help me if you know the solution to resolve that?

Have a look into documentation to verify payment. It should guide you step by step to call the paypal rest api with your payment id and the steps you need to verify, namely that the state is approved and transaction details match.

Related

How to add SSO to an azure bot on microsoft teams

Followed steps documented to enable bot sso
Created a bot.
Added Microsoft Teams under Channels.
Under Configuration added the messaging endpoint. e.g. (https://myproxy.proxyapp.com/teams/app/activity).
Generated a client secret for the Microsoft app id.
Added "https://token.botframework.com/.auth/web/redirect" as the Redirect URI for Web platform under Authentication for my Microsoft App.
Under API Permissions for my Microsoft App added "email offline_access openid profile". "User.Read" was available by default.
Under Expose an API added "api://botid-{Microsoft app id}". Added scope "access_as_user". Added web (1fec8e78-bce4-4aaf-ab1b-5451cc387264) and desktop (5e3ce6c0-2b1f-4285-8d4b-75ee78787346) client applications.
In the Manifest file for my Microsoft app updated "accessTokenAcceptedVersion": 2.
For my bot added an OAuth Connection as below
Created an app on Microsoft Teams and associated my Micorsoft App Id as the bot id. Attached is the manifest for my Microsoft Teams app.
When I install this app to Microsoft Teams the bot is shown in the chat tab which is expected. Further the document says as a 1st step
"The bot sends a message with an OAuthCard that contains the tokenExchangeResource property.". How can I achieve this?
When I type "Hi" for the very 1st time on the bot I receive the below JSON at my messaging endpoint
{
"text": "hi",
"textFormat": "plain",
"attachments": [
{
"contentType": "text/html",
"content": "<div>hi</div>"
}
],
"type": "message",
"timestamp": "2021-10-05T18:27:21.5454867Z",
"localTimestamp": "2021-10-05T23:57:21.5454867+05:30",
"id": "1633458441515",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/in/",
"from": {
"id": "29:1kR5UGDG5iTFhsVadKAadeYuzsLEhMYK_YFxb7_Y62nAilJVLIMiPtC8oLrGGyK7wZTaFc8-jlVxJq3q0bpoBMw",
"name": "Ashish Sood",
"aadObjectId": "3836************************be046"
},
"conversation": {
"conversationType": "personal",
"tenantId": "1734*************************bb8ecf",
"id": "a:1xMOdsbv02hfl2J4GUGA7-WemaLGCOxFlzsSNcQ9StjIMAAKn64tJ0zxKk25b02NMTl3rc7nbNffMZGXVYfraNIDKnptC01oeLRv7Ngh2WMCyOrmBT2KaDleQXSU2s4MY"
},
"recipient": {
"id": "28:18c9**********************02b9",
"name": "NOW_Virtual_Agent_SSO_Bot"
},
"entities": [
{
"locale": "en-GB",
"country": "GB",
"platform": "Mac",
"timezone": "Asia/Calcutta",
"type": "clientInfo"
}
],
"channelData": {
"tenant": {
"id": "1734************************b8ecf"
}
},
"locale": "en-GB",
"localTimezone": "Asia/Calcutta"
}
How do I use this JSON to complete the 6 steps mentioned at
add sso authentication
Microsoft Teams App manifest.json
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.11/MicrosoftTeams.schema.json",
"manifestVersion": "1.11",
"version": "1.0.0",
"id": "9a83***************************177d",
"packageName": "com.microsoft.teams.devapp",
"developer": {
"name": "SSO Bot App",
"websiteUrl": "https://www.teams.com",
"privacyUrl": "https://www.teams.com/privacy",
"termsOfUseUrl": "https://www.teams.com/termsofuse"
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"name": {
"short": "SSO Bot App",
"full": "SSO Bot App"
},
"description": {
"short": "SSO Bot App",
"full": "SSO Bot App"
},
"accentColor": "#FFFFFF",
"staticTabs": [
{
"entityId": "conversations",
"scopes": [
"personal"
]
},
{
"entityId": "about",
"scopes": [
"personal"
]
}
],
"bots": [
{
"botId": "18c9**********************02b9",
"scopes": [
"personal"
],
"supportsFiles": true,
"isNotificationOnly": false
}
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"token.botframework.com"
],
"webApplicationInfo": {
"id": "18c9**********************02b9",
"resource": "api://botid-18c9**********************02b9"
}
}
We ran into the same issue and spit through the nodejs/.net bot framework code to find what JSON is exactly sent for an OAuth card. We ended up with the follow JSON:
{
"attachments": [
{
"content": {
"connectionName": "<name of your sso oauth connection>",
"text": "<some text, is not shown>",
"tokenExchangeResource": {
"id": "<some random id, for validation in invoke request>"
}
},
"contentType": "application/vnd.microsoft.card.oauth"
}
],
"channelId": "msteams",
"conversation": {
"id": "<conversation ID>"
},
"from": {
"id": "<your conversation bot id>"
},
"recipient": {
"id": "<conversation user id>"
},
"serviceUrl": "<service URL of conversation>",
"type": "message"
}

Teams adaptive card wait for respons in Logic App

I'm trying out adaptive cards in an attempt to integrate warnings through logic apps with teams. the question i'm about to ask is related to having the connector in Logic app wait for an response from the adaptive card in Teams after being sent from the Logic app.
I've managed to create my adaptive card and in that card i have the necessary information and two actions at the bottom that i want my logic app to react on so to speak.
My Adaptive card looks something like this:
{
"type": "AdaptiveCard",
"version": "1.0",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"body": [
{
"type": "TextBlock",
"text": "Alert - Employee email differences found:",
"weight": "Bolder",
"size": "Medium",
"horizontalAlignment": "Left",
"spacing": "Medium",
"maxLines": 0
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "New Email",
"weight": "Bolder"
},
{
"type": "TextBlock",
"text": "Test.Person21#mail.com"
},
{
"type": "TextBlock",
"text": "Test.Person22#mail.com"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Old Email",
"weight": "Bolder"
},
{
"type": "TextBlock",
"text": "Test.Person11#mail.com"
},
{
"type": "TextBlock",
"text": "Test.Person12#mail.com"
}
]
}
],
"separator": true
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Update Now",
"style": "positive",
"data": true
},
{
"type": "Action.Submit",
"title": "Dismiss",
"style": "destructive",
"data": false
}
]
}
As you can se when i push on "update now" i get the error message saying "there is no backend/app to connect to" (in swedish - "Can't reach application, try again") basically.
So again what i'm trying to do is for the Logic app to wait for the respons.
After the logic app has sen the message it "completes".
So is this possible? If so, how do i get this to work?
while logic apps can send cards to MS Teams they can not listen on actions performed on those cards.
To be able to use card actions you need to have a custom service made that listens and acts on those activities.

I keep receiving an empty message error when trying to post a webhook

This is my first time using Discord embeds, let alone, making a webhook. Having a little bit of trouble trying to figure out what I'm doing wrong. Hopefully someone can help!
When I try to send an embed with a message with this code:
{
"username": "Official Discord Servers",
"avatar_url": "https://imgur.com/a/Cl3zspb",
"embeds": [{
"description": "Here is a list of official Discord servers maintained by our State. Note that most of these servers may restrict full access to those who are members of their respective departments:",
"color": 16007990,
"fields": [
{
"name": "State of Atoll",
"value": "[Discord Server](https://discord.gg/5KKgb2z)"
},
{
"name": "Atoll Law Enforcement Training Academy",
"value": "[Discord Server](https://discord.gg/GJnbavz)"
},
{
"name": "Atoll Department of Homeland Security",
"value": "[Discord Server](https://discord.gg/acnPFa7)"
},
{
"name": "Palm County Sheriff's Office",
"value": "[Discord Server](https://discord.gg/uYFANDs)"
},
{
"name": "Atoll State Police",
"value": "[Discord Server](https://discord.gg/WNHKtra)"
},
{
"name": "Atoll Department of Corrections",
"value": "[Discord Server](https://discord.gg/VbFew9s)"
},
{
"name": "Atoll National Guard",
"value": "[Discord Server](https://discord.gg/6zE9HyW)"
}]
}
I get this error:
{
"code": 50006,
"message": "Cannot send an empty message"
}
You need to send "content" as a key value pair containing the content of the message being sent.
"content": "Just testing webhooks"
It requires header Content-Type with value application/json. Also try setting content field.
Your issue is invalid JSON, so try using JSON validator
The JSON referred in the question cannot be parsed, it is not properly formed, it is missing closing brackets. Please find last set of }] brackets in my answer below, try this,
{
"username": "Official Discord Servers",
"avatar_url": "https://imgur.com/a/Cl3zspb",
"embeds": [{
"description": "Here is a list of official Discord servers maintained by our State. Note that most of these servers may restrict full access to those who are members of their respective departments:",
"color": 16007990,
"fields": [
{
"name": "State of Atoll",
"value": "[Discord Server](https://discord.gg/5KKgb2z)"
},
{
"name": "Atoll Law Enforcement Training Academy",
"value": "[Discord Server](https://discord.gg/GJnbavz)"
},
{
"name": "Atoll Department of Homeland Security",
"value": "[Discord Server](https://discord.gg/acnPFa7)"
},
{
"name": "Palm County Sheriff's Office",
"value": "[Discord Server](https://discord.gg/uYFANDs)"
},
{
"name": "Atoll State Police",
"value": "[Discord Server](https://discord.gg/WNHKtra)"
},
{
"name": "Atoll Department of Corrections",
"value": "[Discord Server](https://discord.gg/VbFew9s)"
},
{
"name": "Atoll National Guard",
"value": "[Discord Server](https://discord.gg/6zE9HyW)"
}]
}]
}
In my case, I was sending a plain text directly instead of JSON in the request. Then when I changed the message to the below it worked.
{content: "This is the message"}
If you are sending embeds, you can still keep the content set to null.

Returning 404 error when asking for userboostrap in microservices

I'm trying to develop microservices on cumulocity.
I'm following this https://cumulocity.com/guides/microservice-sdk/java/.
I'm able to create the application having this response
"availability": "MARKET",
"id": "23",
"key": "TESTMICRO-microservice-key",
"manifest": {
"imports": [],
"noAppSwitcher": true
},
"name": "TESTMICRO",
"owner": {
"self": "my_tenant/tenant/tenants/management",
"tenant": {
"id": "management"
}
},
"requiredRoles": [
"ROLE_INVENTORY_READ"
],
"roles": [
"ROLE_CUSTOM_MICROSERVICE"
],
"self": "my_tenant/application/applications/23",
"type": "MICROSERVICE"
}
Nevertheless when I try the GET URL/application/applications/23/bootstrapUser it returns me 404 Error.
Anyone that can help me?
You probably need to subscribe the application to the tenant:
POST {{url}}/tenant/tenants/{{tenant}}/applications
Body
{
"application": {
"id": "{APPLICATION_ID}"
}
}

$elemMatch query in looback-angularjs sdk with loopback-mongodb-connector?

I have a collection called Dish in mongodb the sample data is -
[{
"_id": ObjectId("56c839b969431a9913cafa65"),
"name": "Dish 01",
"description": "Dish 01 description",
"ingredients": [{
"id": "56c4a40bf97c039d44e89185",
"name": "onion",
}, {
"id": "56c4a40bf97c039d44e89145",
"name": "salt",
}, {
"id": "56c4a40bf97c039d44e89176",
"name": "spices",
}],
"category": "entree",
"image": "https://s3-ap-southeast-1.amazonaws.com/sichu-bucket/2016-02-20T13:10:31.334Zapi.js"
}, {
"_id": ObjectId("56c839b969431a9913cafa70"),
"name": "Dish 02",
"description": "Dish 02 description",
"ingredients": [{
"id": "56c4a40bf97c039d44e89185",
"name": "onion",
}, {
"id": "56c4a40bf97c039d44e89145",
"name": "oil",
}],
"category": "main",
"image": "https://s3-ap-southeast-1.amazonaws.com/sichu-bucket/2016-02-20T13:10:31.334Zapi.js"
}]
now I want dishes which has onion in it and I want to get result by using loopback-angularjs-sdk
I have added this to my Dish.json file
"settings": {
"mongodb": {
"allowExtendedOperators": true
}
}
I don't know how it should be done. Please guide me into this.
In your ngApp controller pass the Dish object, and then you can use the Dish.find filter to create a filter api, which will internally search mongo for all the dishes with indegredients as onion.
Dish.find({"filter": {"where": {"indegredients.id": "56c4a40bf97c039d44e89185"}}}, function (dishes) {
});
For more on filter api, or how to call them through angular sdk you can use.
https://docs.strongloop.com/display/public/LB/Where+filter
https://docs.strongloop.com/display/public/LB/AngularJS+JavaScript+SDK
Plus you can run a local server for the loopback angular sdk documentation also.
For generating the angular sdk documentation, what you can do is
lb-ng-doc client/js/services/lb-services.js
Browse the documentation at http://localhost:3030/

Resources