Paypal adaptive payment error 58001 - paypal

I am currently developing an adaptive payment system using paypal however a 58001 error keeps occurring
Paypal Response:
{
"responseEnvelope": {
"timestamp": "2013-09-05T23:38:25.762-07:00",
"ack": "Failure",
"correlationId": "a72d1f30e37d4",
"build": "6941298"
},
"error": [
{
"errorId": "580001",
"domain": "PLATFORM",
"subdomain": "Application",
"severity": "Error",
"category": "Application",
"message": "Invalid request: {0}"
}
]
}
Paypal Request:
$createPacket = array(
"actionType" => "PAY",
"currencyCode " => "USD",
"receiverList" => array(
"reveiver" => array(
array(
"amount" => "1.00",
"email" => USER_EMAIL1
),
array(
"amount" => "3.00",
"email" => USER_EMAIL2
)
)
),
"returnUrl" => "http://localhost/",
"errorUrl" => "http://localhost/",
"cancelUrl" => "http://localhost/",
"requestEnvelope" => array(
"errorLanguage" => "en_US",
"detailLevel" => "ReturnAll"
)
);
And I can't figure out what's wrong. I have double checked everything.

I figured it out. I just had and extra space after currencyCode. It was "currencyCode " => "USD" when is should have been "currencyCode" => "USD" :)

Related

TYPO3 8.7.27: Segment was not a keyword for a postVarSet

I'm installing an existing TYPO3 project. After a lot of trying, we managed to get the typo3 backend ready. However, when I go to the website I always get this error message. This probably has something to do with the multilingualism of the website and with the realurl extension.
composer.json (at root /var/www/html/typo3)
{
"repositories": [{
"type": "composer",
"url": "https://composer.typo3.org/"
},
{
"type": "package",
"package": {
"name": "Bm/ah-contentapi",
"version": "0.0.1",
"type": "typo3-cms-extension",
"source": {
"url": "https://user#bitbucket.org/comp/ah_config_typo3.git",
"type": "git",
"reference": "master"
}
}
},
{
"type": "package",
"package": {
"name": "Bm/ah-contentelements",
"version": "0.0.1",
"type": "typo3-cms-extension",
"source": {
"url": "https://user#bitbucket.org/comp/ah_contentelements_typo3.git",
"type": "git",
"reference": "master"
}
}
}
],
"name": "typo3/cms-base-distribution",
"description": "TYPO3 CMS Base Distribution",
"license": "GPL-2.0-or-later",
"require": {
"helhum/typo3-console": "^4.9.3 || ^5.2",
"typo3/cms-about": "^8.7.10",
"typo3/cms-belog": "^8.7.10",
"typo3/cms-beuser": "^8.7.10",
"typo3/cms-context-help": "^8.7.10",
"typo3/cms-documentation": "^8.7.10",
"typo3/cms-felogin": "^8.7.10",
"typo3/cms-fluid-styled-content": "^8.7.10",
"typo3/cms-form": "^8.7.10",
"typo3/cms-func": "^8.7.10",
"typo3/cms-impexp": "^8.7.10",
"typo3/cms-info": "^8.7.10",
"typo3/cms-info-pagetsconfig": "^8.7.10",
"typo3/cms-rte-ckeditor": "^8.7.10",
"typo3/cms-setup": "^8.7.10",
"typo3/cms-sys-note": "^8.7.10",
"typo3/cms-t3editor": "^8.7.10",
"typo3/cms-tstemplate": "^8.7.10",
"typo3/cms-viewpage": "^8.7.10",
"typo3/cms-wizard-crpages": "^8.7.10",
"typo3/cms-wizard-sortpages": "^8.7.10",
"typo3/cms": "^8.7",
"dmitryd/typo3-realurl": "2.*",
"GridElementsTeam/Gridelements": "8.2.*",
"clickstorm/cs_seo": "3.*",
"Bm/ah-contentapi": "0.0.1",
"Bm/ah-contentelements": "0.0.1"
},
"scripts": {
"typo3-cms-scripts": [
"typo3cms install:fixfolderstructure",
"typo3cms install:generatepackagestates"
],
"post-autoload-dump": [
"#typo3-cms-scripts"
]
},
"extra": {
"typo3/cms": {
"web-dir": "public"
},
"helhum/typo3-console": {
"comment": "This option is not needed ay more for helhum/typo3-console 5.x",
"install-extension-dummy": false
}
},
"autoload": {
"psr-4": {
"Bm\\AhContentelements\\": "public/typo3conf/ext/ah_contentelements/Classes",
"Bm\\AhContentapi\\": "public/typo3conf/ext/ah_contentapi/Classes"
}
}
}
realurl_autoconf.php at location:
/var/www/html/typo3/public/typo3conf/ext/ah_contentapi
<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array(
'_DEFAULT' => array(
'init' =>
array(
'appendMissingSlash' => 'ifNotFile,redirect',
'emptyUrlReturnValue' => '/',
),
'pagePath' =>
array(
'rootpage_id' => '1',
),
'fileName' =>
array(
'defaultToHTMLsuffixOnPrev' => 0,
'acceptHTMLsuffix' => 0,
'index' =>
array(
'print' =>
array(
'keyValues' =>
array(
'type' => 98,
),
),
),
),
'postVarSets' => array(
'_DEFAULT' => array(
'api' => array(
array(
'GETvar' => 'tx_ahcontentapi_api[type]',
'valueMap' => array(
'json' => 'json',
),
),
array(
'GETvar' => 'tx_ahcontentapi_api[controller]',
'valueMap' => array(
'pages' => 'Pages',
),
),
array(
'GETvar' => 'tx_ahcontentapi_api[action]',
),
array(
'GETvar' => 'tx_ahcontentapi_api[uid]'
),
),
),
),
),
);
realurl extension conf:
as you have multiple realurl files it is important to know which one is used.
in the TYPO3 BackEnd go to the extension manager module, (1)
filter for 'realurl' (2)
and enter the configuration for the extension (3).
then have a view to the configuration:
in the first field (Path to configuration file / basic.configFile (string)) you find the active file.
for a better readability you should select "PHP source (slow)" in the field Automatic configuration file format/ basic.autoConfFormat (options) (it is not noticable slower).
Please show that active realurl config file.

Not Receiving AccessToken on Simulator

My Fulfilment End Point isnt receiving accessToken. Is this normal?
Becouse when im on the simulator it doesnt really ask to login to my authorization end point thus, it wont get a access token. My Oauth is working perfectly after tesing with Oauth Play Ground.
action.json
{
"accountLinking": {
"clientId": "", // SENSITIVE INFORMATION BLANK
"clientSecret": "", // SENSITIVE INFORMATION BLANK
"grantType": "AUTH_CODE",
"authenticationUrl": "", // SENSITIVE INFORMATION BLANK
"accessTokenUrl": "" // SENSITIVE INFORMATION BLANK
},
"actions": [{
"description": "",
"name": "MAIN",
"fulfillment": {
"conversationName": "PASS TEXT"
},
"intent": {
"name": "actions.intent.MAIN",
"trigger": {
"queryPatterns": [
"talk to APP NAME"
]
}
}
}],
"conversations": {
"PASS TEXT": {
"name": "PASS TEXT",
"url": "" // MY FULFILLMENT END POINT
"fulfillmentApiVersion": 2
}
}
}
Fulfilment Received Request
The request was logged into a text file
jsondata = file_get_contents('php://input');
$postdata = json_decode($jsondata, true);
$RAWfile = print_r($postdata, true);
file_put_contents('RAWfile.txt', $RAWfile);
RAWfile.txt
Array
(
[user] => Array
(
[userId] => APhe68HH0PP0nTYnY8jBJed31WqF
[locale] => en-US
)
[conversation] => Array
(
[conversationId] => 1500924702161
[type] => NEW
)
[inputs] => Array
(
[0] => Array
(
[intent] => actions.intent.MAIN
[rawInputs] => Array
(
[0] => Array
(
[inputType] => VOICE
[query] => ask APP NAME to bla bla
)
)
[arguments] => Array
(
[0] => Array
(
[name] => trigger_query
[rawText] => bla bla
[textValue] => bla bla
)
)
)
)
[surface] => Array
(
[capabilities] => Array
(
[0] => Array
(
[name] => actions.capability.AUDIO_OUTPUT
)
)
)
[device] => Array
(
)
[isInSandbox] => 1
)
Simulator Request
{
"query": "bla bla",
"accessToken": "ya29.Gl2TBLrbKjcgK-6jsARmc4Zvkx8qT2X2rE3vsuwEVc_Ey2-q4OUqNWaJPBlXzIjONb_u2MbrE-rgnfwQSZpbZReXsmZjoGOy18Tvp7xzzSJb-cW9SjZ32uLBaKO7vGE",
"expectUserResponse": true,
"conversationToken": "CiZDIzU5O...",
"surface": "GOOGLE_HOME",
"inputType": "VOICE",
"locale": "en-US",
"location": {
"address": "Googleplex, Mountain View, CA, United States",
"position": {
"lat": 37.421980615353675,
"lng": -122.08419799804688
},
"zipCode": "94043",
"city": "Mountain View"
},
"debugInfo": {
"assistantToAgentDebug": {
"assistantToAgentJson": {
"user": {
"userId": "bla",
"locale": "en-US"
},
"conversation": {
"conversationId": "1501004260313",
"type": "NEW"
},
"inputs": [
{
"intent": "actions.intent.MAIN",
"rawInputs": [
{
"inputType": "VOICE",
"query": "bla"
}
],
"arguments": [
{
"name": "trigger_query",
"rawText": "bla",
"textValue": "bla"
}
]
}
],
"surface": {
"capabilities": [
{
"name": "actions.capability.AUDIO_OUTPUT"
}
]
},
"device": {},
"isInSandbox": true
}
}
}
}
Simulator Response
{
"response": "Sure. Here's the test version of bla.\nsure\n",
"conversationToken": "bla",
"audioResponse": "//NExAASS...",
"debugInfo": {
"agentToAssistantDebug": {
"agentToAssistantJson": {
"conversationToken": "{\"state\":null,\"data\":{}}",
"expectUserResponse": false,
"finalResponse": {
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "sure",
"displayText": "sure"
}
}
],
"suggestions": []
}
}
}
}
}
}
Account linking is done through the Actions Console at https://console.actions.google.com/
From the "Overview" menu item, you'll need to get to step 5: Account Linking.
In there, you can set your endpoints, scopes required, etc.
Think you have to manually complete that part - if you look in the response, you'll see a URL - copy/paste and run that, it should complete the account linking process -
https://developers.google.com/actions/identity/account-linking
"In the Log area, copy and paste the URL from the debugInfo.sharedDebugInfo.debugInfo field into your web browser. You will be redirected to the authentication URL for your own server that was specified in API.AI or in the Actions Console."

PayPal Plus Sandbox - Pay upon Invoice

I'm integrating PayPal Plus, successfully on my site, except "Pay upon Invoice".
Here's my JavaScript code for integrating the payment wall:
<script src="https://www.paypalobjects.com/webstatic/ppplus/ppplus.min.js"
type="text/javascript"></script>
<script type="application/javascript">
var ppp = PAYPAL.apps.PPP({
"approvalUrl": "<?= $createPaymentArr['links'][1]['href']; ?>",
"placeholder": "ppplus",
"language": "de_DE",
"mode": "sandbox",
"showPuiOnSandbox": "true",
"country": "DE"
});
</script>
When I try to use "Pay upon Invoice" I get this error message:
"Unfortunately we can not process your purchase."
My API call:
$fields = '{
"intent":"sale",
"redirect_urls":{
"return_url":"http://XYZ.info/ABC/paypal/index.php",
"cancel_url":"http://XYZ.info/ABC/paypal/index.php"
},
"payer":{
"payment_method":"paypal"
},
"transactions":[
{
"amount":{
"total":"7.47",
"currency":"EUR",
"details":{
"subtotal":"7.41",
"tax":"0.03",
"shipping":"0.03"
}
},
"item_list":{
"items":[
{
"quantity":"1",
"name":"XYZ",
"price":"7.41",
"currency":"EUR"
}
],
"shipping_address":{
"line1":"XYZ Straße 587",
"city":"OPA",
"postal_code":"12345",
"country_code":"DE"
}
},
"description":"XYZ.info Warenkorb"
}
]
}';
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api".$mode.".paypal.com/v1/payments/payment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $fields,
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer ".$arr['access_token'],
"Content-Type: application/json"
),
));
You need to patch the payment before showing the iframe.
During the patch, simply supply the shipping address.
Then payment upon invoice works, even in the sandbox.

Facebook graph query different results in browser and script

When I run the following query https://graph.facebook.com/search?q=Oinoscent&type=place&center=37.973880,23.732035&distance=100&access_token=$AUTHTOKEN in my browser I get the following result back
{
"data": [
{
"category": "Local business",
"category_list": [
{
"id": "192661127431931",
"name": "Wine Bar"
}
],
"location": {
"street": "45-47 Voulis street",
"city": "Athens",
"state": "",
"country": "Greece",
"zip": "10558",
"latitude": 37.974037344191,
"longitude": 23.732089657161
},
"name": "Oinoscent",
"id": "198585923485643"
},
<-- cut here -->
as you can see the name is Oinoscent as we expect and the id is 198585923485643.
If I run the same query inside a php script I get this back
Array
(
[data] => Array
(
[0] => Array
(
[category] => Local business
[category_list] => Array
(
[0] => Array
(
[id] => 2500
[name] => Local Business
)
)
[location] => Array
(
[street] =>
[city] => Athens
[state] =>
[country] => Greece
[zip] =>
[latitude] => 37.9739041863
[longitude] => 23.7320465521
)
[name] => Oinoscent-Wine Bar
[id] => 262001553922414
)
Different Name and different ID though it is exactly the same query. Does anybody know why this is happening?

Google Calendar API - PATCH returning 200 OK but not actually updating event

I'm attempting to integrate my webapp's calendar with Google Calendar. I'm successfully authenticating the user, able to read events from Google and delete events from Google. I'm having trouble updating events from my app to Google.
I'm using the PATCH method described here as I only want to modify the fields that I send in the API call (as opposed to the PUT call which requires all fields for the event).
My Perl code create a JSON object representing what I want to change. I then submit a PATCH request to Google, and I receive status 200 OK and the event resource back from Google. What I receive back is supposed to be the modified event resource, but the fields I have modified are not modified in the response. When I check in Google Calendar itself, once again I see the event is not modified.
I'm confused as to why I'm getting the 200 OK response instead of an error, when the event is not updating. Curiously, in the response, the "updated" timestamp property has been updated, but the summary field has not.
my $ua = LWP::UserAgent->new;
my $url = "https://www.googleapis.com/calendar/v3/calendars/primary/events/${id}?access_token=${access_token}";
my $resource{"summary"} = "$g{summary}";
$resource = encode_json(\%resource);
my $headers = HTTP::Headers->new();
$headers->header(If_Match => "$etag");
my $request = HTTP::Request->new('PATCH',$url,$headers,$resource);
my $response = $ua->request($request);
my $status = $response->status_line;
my $result = decode_json($response->decoded_content);
The "etag" value from the result is updated as I expect, which indicates that the calendar event is being (somewhat) modified in Google.
Some Data::Dumper tracing:
The request:
$VAR1 = bless( {
'_content' => '{"summary":"End of season function MODIFIED"}',
'_uri' => bless( do{\(my $o = 'https://www.googleapis.com/calendar/v3/calendars/primary/events/<eventID>?access_token=<access_token>')}, 'URI::https' ),
'_headers' => bless( {
'if-match' => '<etag>'
}, 'HTTP::Headers' ),
'_method' => 'PATCH'
}, 'HTTP::Request' );
The response:
$VAR1 = bless( {
'_protocol' => 'HTTP/1.1',
'_content' => '{
"kind": "calendar#event",
"etag": "<etag>",
"id": "<eventID>",
"status": "confirmed",
"htmlLink": "<suppressed>",
"created": "2012-03-08T05:06:04.000Z",
"updated": "2012-03-25T09:18:49.000Z",
"summary": "End of season function",
"creator": {
"email": "<suppressed>"
},
"organizer": {
"email": "<suppressed>"
},
"start": {
"date": "2012-03-24"
},
"end": {
"date": "2012-03-24"
},
"iCalUID": "<suppressed>",
"sequence": 1,
"reminders": {
"useDefault": true
}
}
',
'_rc' => '200',
'_headers' => bless( {
'connection' => 'close',
'cache-control' => 'no-cache, no-store, max-age=0, must-revalidate',
'date' => 'Sun, 25 Mar 2012 09:18:49 GMT',
'client-ssl-cert-issuer' => '/C=US/O=Google Inc/CN=Google Internet Authority',
'client-ssl-cipher' => 'ECDHE-RSA-RC4-SHA',
'client-peer' => '173.194.72.95:443',
'client-date' => 'Sun, 25 Mar 2012 09:18:49 GMT',
'pragma' => 'no-cache',
'content-type' => 'application/json; charset=UTF-8',
'x-xss-protection' => '1; mode=block',
'server' => 'GSE',
'client-ssl-socket-class' => 'IO::Socket::SSL',
'client-response-num' => 1,
'etag' => '<etag>',
'x-frame-options' => 'SAMEORIGIN',
'x-content-type-options' => 'nosniff',
'client-ssl-cert-subject' => '/C=US/ST=California/L=Mountain View/O=Google Inc/CN=*.googleapis.com',
'expires' => 'Fri, 01 Jan 1990 00:00:00 GMT'
}, 'HTTP::Headers' ),
'_msg' => 'OK',
'_request' => bless( {
'_content' => '{"summary":"End of season function MODIFIED"}',
'_uri' => bless( do{\(my $o = 'https://www.googleapis.com/calendar/v3/calendars/primary/events/<eventID>?access_token=<access_token>')}, 'URI::https' ),
'_headers' => bless( {
'user-agent' => 'libwww-perl/6.01',
'if-match' => '<etag>'
}, 'HTTP::Headers' ),
'_method' => 'PATCH',
'_uri_canonical' => $VAR1->{'_request'}{'_uri'}
}, 'HTTP::Request' )
}, 'HTTP::Response' );
Can anyone see what I'm doing wrong? I'm sure that Google is accepting my PATCH request, but for some reason not exactly seeing the field I want to modify. I've tried submitting the exact same JSON object on their testing page and have no problem getting that to work...
I found the solution purely by trial and error - adding the "Content-Type" header to the HTTP header seemed to do the trick:
my $headers = HTTP::Headers->new();
$headers->header(If_Match => "$etag");
$headers->header(Content_Type => "application/json");
Adding the header accept = application/json fixed it for me