Passing custom parameters in paypal express checkout NVP - paypal

I'm trying to find a way to pass a custom parameter through paypal's express checkout using NVP.
I've tried using the deprecated PAYMENTREQUEST_n_CUSTOM, the supposedly not deprecated PAYMENTREQUEST_0_CUSTOM and the CUSTOM parameters but none of them worked.
The only ways I can see right now (which I'd rather not use) are:
1. use one of the other parameters that I'm not using (like shipping)
2. use the return url and add to it the parameter as a GET parameter
3. use sessions.
According to the error page my version is 92.0.
And the rest of the parameters are:
$nvpstr="&SHIPPINGAMT=0&L_SHIPPINGOPTIONNAME0=test&L_SHIPPINGOPTIONAMOUNT0=0&REQCONFIRMSHIPPING=0&NOSHIPPING=1&L_SHIPPINGOPTIONISDEFAULT0=true&ADDRESSOVERRIDE=1$shiptoAddress&".
"&ALLOWNOTE=0&CUSTOM=".$CUSTOM.
"&L_NAME0=".$L_NAME0."&L_AMT0=".$L_AMT0."&L_QTY0=".$L_QTY0.
"&MAXAMT=".(string)$maxamt."&AMT=".(string)$amt."&ITEMAMT=".(string)$itemamt.
"&CALLBACKTIMEOUT=4&CALLBACK=https://www.ppcallback.com/callback.pl&ReturnUrl=".$returnURL."&CANCELURL=".$cancelURL .
"&CURRENCYCODE=".$currencyCodeType."&PAYMENTREQUEST_0_PAYMENTACTION=".$paymentType;

Don't mix PAYMENTREQUEST_0_* variables and their deprecated counterparts -- use one or the other. (E.g., don't use PAYMENTREQUEST_0_PAYMENTACTION and AMT in the same API call -- either use PAYMENTREQUEST_0_PAYMENTACTION and PAYMENTREQUEST_0_AMT, or use PAYMENTACTION and AMT.)
This appears to be the SetExpressCheckout call. You can pass a CUSTOM value in here, but if you do, the only place it will show up is in the response to your GetExpressCheckoutDetails call. You need to supply the CUSTOM value in your DoExpressCheckoutPayment call in order for it to be recorded to your account.

Related

QLIK Sense - REST api chain call

I need to integrate data in my Qlik Sense project using cloud REST api.
I need to call a chain of API as I firstly need the Token
Basically:
1) "Token" REST passing user+psw getting token
2) "API2" REST passing token received from 1 in the BODY
I think I need to use the data script feature, I'm able to create separately the 2 REST call, but how can I pass tokn dinamically in the Body?
Is there a specific code to be added?
Thx
Find an answer here:
https://community.qlikview.com/thread/224957
Basically just edit and parse Body variable:
let vRequestBody = '{"call":"ListarCategorias","app_key":"XXXXXXXX","app_secret":"XXXXXXXXXX","param":[{"pagina":"$(vPagina)","registros_por_pagina":100,"apenas_importado_api":"N"}]}';
let vRequestBody = replace(vRequestBody,'"', chr(34)&chr(34));
and use this at the end of "RestConnectorMasterTable" default scripting snippet WITH CONNECTION(BODY "$(vRequestBody)"):
RestConnectorMasterTable:
SQL SELECT
"__KEY_root",
(SELECT
"codigo",
"totalizadora",
"transferencia",
"__FK_categoria_cadastro"
FROM "categoria_cadastro" FK "__FK_categoria_cadastro")
FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION(BODY "$(vRequestBody)");

How to get the activation ID of the action invoked in OpenWhisk?

When we invoke an action through the CLI, we get the activation ID as the result. But when we generate the API for the action in Bluemix and try to invoke the API, I receive only the result of the action. How can we get the activation ID of the action after the invocation? Should we be able to get the response later by using the activation ID?
An action, in its execution context has its activation id available: it's available in the environment variables as __OW_ACTIVATION_ID.
You can return this value in your response - if you're using a web action or API gateway and have the ability to send custom headers as a result you can use that as a mechanism to return the id. Or simply return the id itself.
Given an activation id, you can use it later with the activation API to retrieve the result.
It sounds like you want a non-blocking activation as opposed to request/response style. For that if you aren't using a webaction or API gateway, the default invoke mechanism is non blocking which return to you the activation id.
Here is a reference to the API https://github.com/apache/incubator-openwhisk/blob/master/docs/rest_api.md
If you are invoking from the CLI using the following, you should get back the activation ID and the result:
wsk action invoke --blocking the-action-name
You can get a list of activations ordered from the most recent to the oldest:
wsk activation list
ThereĀ“s a very nice documentation with a bunch of details and using diff languages --> https://console.ng.bluemix.net/docs/openwhisk/openwhisk_actions.html#openwhisk_actions_polling

what API Gateway methods support Authorization?

When I create a resource/method in AWS API Gateway API I can create one of the following methods: DELETE, GET, HEAD, OPTIONS, PATCH or POST.
If I choose GET then API Gateway doesn't pass authentication details; but for POST it does.
For GET should I be adding the cognito credentials to the URL of my GET? or just never use GET and use POST for all authenticated calls?
My set-up in API Gateway/Lambda:
I created a Resource and two methods: GET and POST
Under Authorization Settings I set Authorization to AWS_AIM
For this example there is no Request Model
Under Method Execution I set Integration type to Lambda Function and I check Invoke with caller credentials (I also set Lambda Region and Lambda Function)
I leave Credentials cache unchecked.
For Body Mapping Templates, I set Content-Type to `application/json' and the Mapping Template to
{ "identity" : "$input.params('identity')"}
In my Python Lambda function:
def lambda_handler(event, context):
print context.identity
print context.identity.cognito_identity_id
return True
Running the Python function:
For the GET context.identity is None
For the POST context.identity has a value and context.identity.cognito_identity_id has the correct value.
As mentioned in comments: all HTTP methods support authentication. If the method is configured to require authentication, authentication results should be included in the context for you to access via mapping templates to pass down stream as contextual information.
If this is not working for you, please update your question to reflect:
How your API methods are configured.
What your mapping template is.
What results you see in testing.
UPDATE
The code in your lambda function is checking the context of the Lambda function, not the value from API Gateway. To access the value passed in from API Gateway, you would need to use event.identity not context.identity.
This would only half solve your problem as you are not using the correct value to access the identity in API gateway. That would be $context.identity.cognitoIdentityId (assuming you are using Amazon Cognito auth). Please see the mapping template reference for a full guide of supported variables.
Finally, you may want to consider using the template referenced in this question.

Why does one HTTP GET request retrieve the required data and another retrieve []

I'm currently working on ng-admin.
I'm having a problem retrieving user data from my REST API (connected to a MongoDB) and displaying it.
I have identified the problem as the following:
When I enter http://localhost:3000/users into my browser, I get a list of all users in my database.
When I enter http://localhost:3000/users?_page=1&_perPage=30&_sortDir=DESC&_sortField=id,
I get [] as a result.
I am quite new to this, I used both my browser and the POSTMAN Chrome extension to test this and get the same result.
http://localhost:3000/users_end=30&_order=DESC&_sort=id&_start=0
This (/users_end) is a different request than /users.
It should be:
http://localhost:3000/users?end=30&_order=DESC&_sort=id&_start=0
Or, by looking at the other parameters:
http://localhost:3000/users?_end=30&_order=DESC&_sort=id&_start=0
with end or _end being the first parameter (mark the ?).
Update (it is ? and before the _, I have edited.):
If adding parameters to the request returns an empty list, try adding only one at a time to narrow down the problem (there's probably an error in the usage of those parameters - are you sure you need those underscores?).
Your REST API must have a way to handle pagination, sorting, and filtering. But ng-admin cannot determine exactly how, because REST is a style and not a standard. So ng-admin makes assumptions about how your API does that by default, that's why it adds these _end and _sort query parameters.
In order to transform these parameters into those that your API understands, you'll have to add an interceptor. This is all thoroughly explained in the ng-admin documentation: http://ng-admin-book.marmelab.com/doc/API-mapping.html

Omnipay - How do I pass 'custom' or 'invoice' parameters to Paypal?

In the past I have used html forms to pass hidden 'custom' and 'invoice' parameters to Paypal during Credit Card transactions, using Paypal-Pro, so that I can use them in the IPN response later. However I can't seem to work out how to set/send these two parameters using Omnipay. If anyone could point me in the right direction here it would be appreciated.
See duplicate posting:
https://github.com/omnipay/paypal/issues/10
You can use:
$request->setTransactionId();
$request->setDescription();
or
$data = $request->getData();
$data['RANDOM_DATA'] = 'hello';
$request->sendData($data);
instead of simply calling $request->send().