Paypal Internal Server Error when capturing payment with rest api - rest

I have this issue in a C#-based project, but I can reproduce it with curl as well. The code was working a few days ago but now it isn't and I'm pretty sure I haven't changed it.
I have a payment that has been authorized and I have its ID, which is correct (when I close the transaction with their online tool I get AUTHORIZATION_ALREADY_COMPLETED instead of Server 500 error).
Here's what I do with curl to repro it, sensitive info redacted:
// check if the AUTHIDHERE code is correct:
curl -v -X GET https://api.paypal.com/v1/payments/authorization/AUTHIDHERE -H "Content-Type:application/json" -H "Authorization:Bearer BEARER123"
the above call works and returns:
{
"id": "AUTHIDHERE",
"create_time": "2013-07-17T21:17:58Z",
"update_time": "2013-07-17T21:18:00Z",
"state": "authorized",
"amount": {
"total": "1.35",
"currency": "USD",
"details": {
"subtotal": "1.35"
}
},
"parent_payment": "PAY-SOMELONGIDHERE",
"valid_until": "2013-08-15T21:17:58Z",
"links": ...whole bunch here]}
}
then I call the capture
curl -v https://api.paypal.com/v1/payments/authorization/AUTHIDHERE/capture \
-H "Content-Type:application/json" -H "Authorization:Bearer BEARER123" \
-d '{"amount":{"currency":"USD","total":"1.32"},"is_final_capture":true}
and I get this with HTTP 500 status:
{
"name": "INTERNAL_SERVICE_ERROR",
"message": "An internal service error has occurred",
"information_link": "https://developer.paypal.com/webapps/developer/docs/api/#INTERNAL_SERVICE_ERROR",
"debug_id": "7edadeba20509"
}
Some other debug_id values are: 062fc6964d9a8, 6eebc751504eb

quick update: interestingly they all failed in the underlying acquirer call - trying to figure out what went wrong.
Are these all debug_ids associated with the same authorization_id ?

Related

Getting the latest execution for a job via the Rundeck API

I'm using the latest version of Rundeck (3.3.10) and I'm having trouble getting the latest execution for a job via the Rest API.
If I call api/38/job//executions?max=1 it doesn't seem to bring back the latest execution if it is still running. Ideally, I'd also like to be able get the latest execution Start Time, End Time, User and result for each job in a single API call, but I'd resigned myself to calling the API once per job. There doesn't seem to be any way to sort the executions you get back from the API - they seem to be sorted by status first, so the running jobs appear at the end of the list.
Does anyone know a way around this? Thanks.
Yo can get that information using: executions?status=running&max=1 call.
Script example:
#!/bin/sh
# protocol
protocol="http"
# basic rundeck info
rdeck_host="localhost"
rdeck_port="4440"
rdeck_api="38"
rdeck_token="YRVaZikt64Am85RyLo1nyq8U1Oe4Q8J7 "
# specific api call info
rdeck_job="03f28add-84f2-4013-b8f5-e48feaf5977c"
# api call
curl --location --request GET "$protocol://$rdeck_host:$rdeck_port/api/$rdeck_api/job/$rdeck_job/executions?status=running&max=1" \
--header "Accept: application/json" \
--header "X-Rundeck-Auth-Token: $rdeck_token" \
--header "Content-Type: application/json"
Output:
{
"paging": {
"count": 1,
"total": 1,
"offset": 0,
"max": 1
},
"executions": [
{
"id": 7,
"href": "http://localhost:4440/api/38/execution/7",
"permalink": "http://localhost:4440/project/ProjectEXAMPLE/execution/show/7",
"status": "running",
"project": "ProjectEXAMPLE",
"executionType": "user",
"user": "admin",
"date-started": {
"unixtime": 1617304896289,
"date": "2021-04-01T19:21:36Z"
},
"job": {
"id": "03f28add-84f2-4013-b8f5-e48feaf5977c",
"averageDuration": 13796,
"name": "HelloWorld",
"group": "",
"project": "ProjectEXAMPLE",
"description": "",
"href": "http://localhost:4440/api/38/job/03f28add-84f2-4013-b8f5-e48feaf5977c",
"permalink": "http://localhost:4440/project/ProjectEXAMPLE/job/show/03f28add-84f2-4013-b8f5-e48feaf5977c"
},
"description": "sleep 20; echo \"hi\"",
"argstring": null,
"serverUUID": "630be43c-e71f-4102-be96-d017dd22233e"
}
]
}

Invalid story format failed to parse story while posting Rasa X Http API

I am trying to create a story using POST in Postman tool and below is my story format .
I am using below format because in GET request I got the story in the same format.
{
"id": 65,
"name": "interactive_story_65",
"story": "35 interactive_story_65\n* emp_info\n - utter_employee",
"annotation": {
"user": "me",
"time": 1597919151.8836874962
},
"filename": "data\\stories.md"
}
But, I am getting below error:
{
"version": "0.31.0",
"status": "failure",
"message": "Failed to parse story.",
"reason": "StoryParseError",
"details": "Invalid story format. Failed to parse '## {\r\n \"id\": 65,\r\n \"name\": \"interactive_story_65\",\r\n \"story\": \"## interactive_story_65\\n* emp_info\\n - utter_employee\",\r\n \"annotation\": {\r\n \"user\": \"me\",\r\n \"time\": 1597919151.8836874962\r\n },\r\n \"filename\": \"data\\\\stories.md\"\r\n }'",
"help": null,
"code": 400
}
Attached is below screenshot:
enter image description here
Please help.
This endpoint is actually expecting plain markdown, with text/x-markdown as the content-type header. If you look closely at the docs, you'll see that you're using the response schema as the request schema - I did that too at first. The request schema is just a markdown string e.g.
curl --request PUT \
--url http://localhost:5002/api/stories \
--header 'authorization: Bearer <Token>' \
--header 'content-type: text/x-markdown' \
--data '## greet
* greet
- utter_greet\n'

Cannot Post Hyperledger Transaction on Rest API

I am having some trouble posting a transaction on my ReST server. When I try to POST a transaction, I always get a 422 error. If I delete any fields, I will get a 500 error. It seems like whatever transaction id is there is invalid, and I do not know why it is invalid. In my original .cto files, I did not ask for there to be a transactionID field, so I am assuming this is a default field. Here is a screenshot of my POST method:
Here is my input that I put in:
{
"$class": "models.transactionsModel.InvalidateCertificate",
"certificate": "#cert2",
"transactionId": "string",
"timestamp": "2018-06-18T16:57:45.644Z"
}
I made the certificate identifiable by a hash string
Here is the resulting curl, body, and header respectively,
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \
"$class": "models.transactionsModel.InvalidateCertificate", \
"certificate": "#cert2", \
"transactionId": "string", \
"timestamp": "2018-06-18T16:57:45.644Z" \
}' 'http://localhost:3000/api/models.transactionsModel.InvalidateCertificate'
{
"error": {
"statusCode": 422,
"name": "ValidationError",
"message": "The `models_transactionsModel_InvalidateCertificate` instance is not valid. Details: `transactionId` can't be set (value: \"string\").",
"details": {
"context": "models_transactionsModel_InvalidateCertificate",
"codes": {
"transactionId": [
"absence"
]
},
"messages": {
"transactionId": [
"can't be set"
]
}
},
"stack": "ValidationError: The `models_transactionsModel_InvalidateCertificate` instance is not valid. Details: `transactionId` can't be set (value: \"string\").\n at /Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/dao.js:398:12\n at models_transactionsModel_InvalidateCertificate.<anonymous> (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/validations.js:578:11)\n at models_transactionsModel_InvalidateCertificate.next (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/hooks.js:93:12)\n at models_transactionsModel_InvalidateCertificate.<anonymous> (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/validations.js:575:23)\n at models_transactionsModel_InvalidateCertificate.trigger (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/hooks.js:83:12)\n at models_transactionsModel_InvalidateCertificate.Validatable.isValid (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/validations.js:541:8)\n at /Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/dao.js:394:9\n at doNotify (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at doNotify (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at doNotify (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at doNotify (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at Function.ObserverMixin._notifyBaseObservers (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:178:5)\n at Function.ObserverMixin.notifyObserversOf (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:153:8)\n at Function.ObserverMixin._notifyBaseObservers (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:176:15)\n at Function.ObserverMixin.notifyObserversOf (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:153:8)\n at Function.ObserverMixin._notifyBaseObservers (/Users/harshdeshpande/.nvm/versions/node/v8.11.2/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:176:15)"
}
}
{
"date": "Mon, 18 Jun 2018 18:23:47 GMT",
"content-encoding": "gzip",
"x-content-type-options": "nosniff",
"x-download-options": "noopen",
"x-frame-options": "DENY",
"content-type": "application/json; charset=utf-8",
"access-control-allow-origin": "http://localhost:3000",
"transfer-encoding": "chunked",
"connection": "keep-alive",
"access-control-allow-credentials": "true",
"vary": "Origin, Accept-Encoding",
"x-xss-protection": "1; mode=block"
}
What is even stranger is that I can submit a valid transaction via the Composer playground. In the composer playground, though, it does not ask for a transactionID or timestamp - it automatically generates while the transaction is being submitted.
See the answer here -> error executing hyperledger fabric code on localhost:3000 (through REST) - transactionId - it is really a Loopback issue.
Post your same transaction as follows (but remove the transactionId and timestamp - these are generated for you and the former represents the transaction Id on the ledger):
{
"$class": "models.transactionsModel.InvalidateCertificate",
"certificate": "#cert2"
}
cheers

Ionic 2.0 push security profile not found error

I'm making android push service.
I enrolled security profile and add fcm server key and my keystore file
ionic security profiles list
name | tag | android | ios
skout90| skout90 | V |
And i requested below
curl -X POST -H "Authorization: Bearer my_api_key" -H "Content-Type:
application/json" -d '{
"tokens": ["my_device_key"],
"profile": "skout90",
"notification": {
"message": "Alert!"
}
}' "https://api.ionic.io/push/notifications"`
but
I got response
{
"meta": {
"request_id": "1b855552-195e-4dd3-cd36-ae49b19490a4",
"status": 400,
"version": "2.0.0-beta.0"
},
"error": {
"type": "BadRequest",
"link": null,
"message": "Security Profile 'skout90' not found."
}
}
I can't find what is wrong.
What do i have to?
please help me...
I solved this problem myself.
-H "Authorization: Bearer my_api_key"
I input wrong my_api_key.

Do Quick Replies Work in Messenger Bot Welcome Message?

Do quick replies work in Facebook Messenger Bot Welcome Message? This is the message that is displayed after you press the "Get Started" button.
It might not be supported, but if it is, am I doing something wrong?
Here's what I'm trying:
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"message": {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [{
"title": "Hi dad",
"subtitle": "Hi mom",
"item_url": "www.google.com",
"image_url": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png",
}]
}
}
},
"quick_replies":[
{
"content_type":"text",
"title":"option1",
"payload":"option1payload"
},
{
"content_type":"text",
"title":"option2",
"payload":"option2payload"
}
]
}
]
}' "https://graph.facebook.com/v2.6/13333333337/thread_settings?access_token=THISISMYCOOLTOKEN"
The error I'm receiving is:
Invalid Keys \"message, quick_replies\" were found in param \"call_to_actions[0]\"."type":"OAuthException","code":100
Nope. payload is only for string text. see https://developers.facebook.com/docs/messenger-platform/thread-settings/get-started-button
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":"USER_DEFINED_PAYLOAD"
}
]
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"
call_to_actions is limited to 1 call_to_actions must contain at least
one payload string.
This data will be sent back to you via webhook.