Paypal REST API - Description/Item name missing - ruby

I am using paypal ruby sdk in order to process credit cards via rest api. Everything is working fine from perspective of credit card processing. Credit cards are processed properly without any kind of issues.
Unfortunately, when i preform the csv export of transactions on the sandbox (or live) merchant paypal account, the "Item Title" field is not populated and also I cannot see that description field is used anywhere.
Request to the paypal:
Request[post]: https://api.sandbox.paypal.com/v1/payments/payment
Request.body={
"intent":"sale",
"payer":{
"payment_method":"credit_card",
"funding_instruments":[{
"credit_card":{
"number":"xxxxxxxxxxxxxxxx",
"type":"visa",
"expire_month":10,
"expire_year":2020,
"first_name":"First Name",
"last_name":"Last Name"
}
}]
},
"transactions":[{
"amount":{
"currency":"USD",
"total":"1"
},
"description":"This is item description",
"item_list":{
"items":[{
"quantity":"1",
"name":"This is item description",
"price":"1",
"currency":"USD",
"sku":"This is item description"
}]
}
}]
}
Within the successful paypal response I am getting all of these data back including the fields populated with "This is item description".
My question is, which parameter we need to provide for this api call in order to populate "Item Title" field within transactions csv export?
What is the purpose of "description" field within this api request and where this field is used on paypal side (showed) after we process payment with credit card?
EDITED
Tried with PHP SDK as well (just to be sure that this is not an issue with specific SDK). At the end it seems that question is "Is there a field to be used as part of REST API which corresponds to 'Item Title' column within paypal export?"

Indeed answer from pp_pduan answers on initial bounty question (related with specific report). I am adding an update related with this specific report and other reports as well.
For credit card processing you can use following API's on paypal side:
Rest API
DoDirect Payment Api (Pro 3.0)
Payflow Gateway Api (Pro 1.5-2.0)
As per my discussion with paypal side and quite a detailed research, it is not possible to populate Item Name for some of the reports using REST API.
For credit card processing (in order to avoid issues in general with reporting systems) I suggest to go with DoDirect Payment Api if you have Pro accounts. Seems that this specific API is "older" then REST API credit card processing hence it is more stable and do not have any kind of issues with reporting system.
Having in mind that DoDirect Payment Api have weird documentation (at least for me this is not covered properly) I suggest to check following php repository with working solution (examples).

Try put a sample request payload like this,
{
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"redirect_urls": {
"return_url": "http://localhost:80/getpaypal",
"cancel_url": "http://localhost:80/cancel"
},
"transactions": [
{
"description": "Transaction Desc Text",
"amount": {
"total":"80",
"currency":"USD"
},
"item_list": {
"items": [
{
"name": "Test Ticket 1",
"currency": "USD",
"quantity": "1",
"sku": "55a460ff65f13",
"price": "10"
},
{
"name": "Test Ticket 2",
"currency": "USD",
"quantity": "2",
"sku": "55a460ff66c7a",
"price": "20"
},
{
"name": "Test Ticket 3",
"currency": "USD",
"quantity": "3",
"sku": "55a460ff66ce2",
"price": "10"
}
]
},
"invoice_number": "55a460ff696br"
}
]
}
And when you download transaction history (csv) from your PayPal profile,
If you've ticked the option "Include Shopping Cart details",
the "name" field under each item object will display in the "Item Title" col; and the description field in transaction object will be in that col as well
If you leave the option of "Include Shopping Cart details", the transaction will be a single record in the csv without the cart item rows, and you'll only see ""description": "Transaction Desc Text"," (description field in transaction object) in the Item Title col

Related

Dynamic typeahead in Adaptive Card Task flow

I'm trying to implement the dynamic typeahead search as was shown on the below resources:
https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/dynamic-search?tabs=desktop%2Ccsharp
https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/bot-type-ahead-search-adaptive-cards/csharp
I'm having the following Adaptive Card returned from the OnTeamsMessagingExtensionFetchTaskAsync (from message action):
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"id": "choiceSelect",
"type": "Input.ChoiceSet",
"choices": [
{
"title": "Choice 1",
"value": "Choice 1"
},
{
"title": "Choice 2",
"value": "Choice 2"
}
],
"placeholder": "Placeholder text",
"style": "filtered",
"choices.data": {
"type": "Data.Query",
"dataset": "cases"
}
}
]
}
Card is rendered correctly, but when I start typing, I'm getting the following results:
No request is being made. I was trying to debug the JS, but it is troublesome for me - I couldn't pinpoint the exact place it fails, but got these symbols to lookup: executeSearchInvoke, enableAppPermissionEnforcement and enableTenantSettingsForBots in 3.2-app.min.js.
Can anyone point me in the right direction? Is there some kind of dependency or permission I should add to the bot? Some setting in Teams Admin Center? I can add that static typeahead works flawlessly, but I need the dynamic one (big data collection to query).
EDIT:
I have confirmed that the app is added to the team (it is visible on the list of apps in team settings); I've removed and added it again just in case. I am still getting the same results.
List of permissions visible from the App details page:
This app will have permission to:
Receive messages and data that I provide to it.
Send me messages and notifications.
Access my profile information such as my name, email address, company name, and preferred language.
Receive messages and data that team members provide to it in a channel.
Send messages and notifications in a channel.
Access this team's information such as team name, channel list and roster (including team member's names and email addresses) - and use this to contact them​.

how to Detect Marketing and Role based emails programmatically?

I have requirements where I would have to distinguish emails whether it is regular email, Marketing email, or Role based email.
Marketing Emails: Emails that correspond to a marketing campaign. Typically sent to a batch of users and composed with tools like
MailChimp, etc...
Role-Based Emails: Emails addresses that are not associated with a particular person, but rather with a company, department, position, or
group of recipients (ex: noreply#, marketing#, support#, etc).
Can I identify this by email header information? Or is there any other way to achieve this?
Technology using:
Gmail API: to get email information
Spring boot: to process emails
By using the Gmail API you can retrieve the emails by using the following request:
GET https://gmail.googleapis.com/gmail/v1/users/{userId}/messages/{id}
Which will end up returning the body of a Message with the following similar structure:
{
"id": ID,
"threadId": THREAD_ID,
"labelIds": [
"CATEGORY_PROMOTIONS",
"UNREAD",
"INBOX"
],
"payload": {
"headers": [{
"name": "Reply-To",
"value": "NAME \u003cnewsletter#email.com\u003e"
},
{
"name": "Subject",
"value": "Week 9 Newsletter"
},
{
"name": "From",
"value": "NAME \u003csupport#email.com\u003e"
},
"body": {
"size": SIZE,
"data": ""
}
},
}
So depending on how you want to process these afterwards, you can use some of the following fields from the returned email:
labelIds - this field will contain all the labels attached to the incoming email which means that (depending on the settings you have for your inbox) you can easily check this email for instance as being a promotional email because of the CATEGORY_PROMOTIONS label attached to it;
Reply-To header - you can retrieve the email address here and later analyze it;
Subject header - assuming you have a list of keywords set up, you can search the subject of the email and later mark it based on the results;
From header - you can retrieve this email address here and again, based on a list of keywords, you can decided of which type this email is.
Reference
Gmail API Message Resource.

How to fetch user's email address associated with Apple Pay Account from Apple Pay using JavaScript

I wanted to know if Apple has an API which we can use to fetch user's email address associated with apple pay account.
FYI I am using apple pay js (ApplePaySession) for apple pay.
Or is there another way to fetch user's email address from Apple pay in JavaScript.
Thank You!
The email address is provided within the onpaymentauthorized callback of your ApplePaySession.
Note: It is an inherited property, so it may be somewhat difficult to find in your developer console (in Chrome you've got to drill down into the event's __proto__ property).
You must specifically ask for the email address by including a requiredShippingContactFields property in your payment request:
requiredShippingContactFields: [
'phone',
'email'
]
And the email address will be available like so:
var session = new ApplePaySession(2, myPaymentRequest);
session.onpaymentauthorized = function(event){
console.log(event.payment.shippingContact.shippingAddress);
};
Once the user authorizes the transaction, you will get the shippingContact Object like this:-
{
"locality": “India",
"country": "India",
"postalCode": "95014-2083",
"administrativeArea": "CA",
"emailAddress": “sachin#example.com”,
"familyName": “Tendulkar",
"addressLines": [
"1 Infinite Loop"
],
"givenName": “Sachin",
"countryCode": "INDIA",
"phoneNumber": "(408) 555-5555"
}
from this object you can access the email id.

Correct id to send message to a skype account

I am trying to test my bot by sending a message to my skype account. I can't find a way how to contact myself what is the members.id id suppossed to be? I tried Skype Name but can't find any other id suitable and the docs are not very helpful.
I started a conversation:
{
"bot": {
"id": "2",
"name": "bot's name"
},
"isGroup": false,
"members": [
{
"id": "123", <----------------- WHAT SHALL BE HERE?
"name": "My Account"
}
],
"topicName": "News Alert"
}
The id for the conversation is { "id": "123" }.
I could find the bot from the Skype app but I never receive anything.
You can get the ID of user by checking the Activity.From.Id property when s/he sends a message.
Also please note that in case of Skype and Facebook user IDs are altered for each user.
So each user has different ID for each Bot, and that ID is not the Skype (or Facebook) ID, as mentioned in documentation

Finding cleaned/bounced email addresses for a MailChimp campaign or list

I'd like to automate the gathering of unsubscribe and cleaned email accounts for a given campaign.
In the API playground, I see all the methods available on the List entity.
Unsubscribes
I see that it's in the LIST API
GET reports/xxxxxx/unsubscribed
Cleaned
Where can I find the cleaned/bounced emails from a list or campaign? I know I can see the count of bounced in various places, but I'd like to find the email addresses that actually bounced, and the first and last names of the list member. Basically I'd like the API same as the 'export cleaned to csv' available on the website.
How can I use the MailChimp 3.0 API to do this?
You can do
GET lists/list_id/members?status=unsubscribed
to get unsubscribed users
GET lists/list_id/members?status=cleaned
to get cleaned/bounced users
For the bounced emails in a specific campaign you need to do this:
GET /3.0/reports/campaign_id/email-activity
and iterate though all recipients in the campaign, manually locating actions with type=bounce.
{
"email_address": "xxx#example.com",
"activity": [
{
"action": "bounce",
"type": "hard",
"timestamp": "2019-04-08T00:00:00+00:00"
}
]
},
Unfortunately MailChimp has very bad performance on this endpoint, approximately 25 seconds to return activity for a campaign with 500 recipients.
Since soft bounce will not change status inside the list(audience), to get soft bounce email from the list without specific campaign, you can use
GET lists/{list-id}/members/{subscriber_hash}/activity
This endpoint will only return for single email(contact), so you need to iterate through all email(contact) in the list.
Sample response:
"activity": [
{
"action": "bounce",
"timestamp": "2019-05-01T23:02:26+00:00",
"type": "soft",
"campaign_id": "xxxxxxxxxx",
"title": "Xxxx Xxxxxxx"
},
{
"action": "sent",
"timestamp": "2019-05-01T23:00:00+00:00",
"type": "regular",
"campaign_id": "xxxxxxxxxx",
"title": "Xxxx Xxxxxxx"
}
],

Resources