Payment APIs without server-side requirements - angularjs

Are there any Payment APIs, preferably in Javascript/Angular that can be directly used on the client side, and thus require no server side implementation?
The best example is Stripe. It both requires setting up the client side (Checkout and retrieval of StripeToken) and then actually processing the payment on the server (Charge).

I found a service that allows you to process Stripe payments without setting up the server-side yourself: Noodlio Pay.
You simply send HTTP requests to the API hosted on Mashape.
Here is an example of a request in cURL:
curl -X POST --include 'https://noodlio-pay.p.mashape.com/charge/token'
\ -H 'X-Mashape-Key: <required>'
\ -H 'Content-Type: application/x-www-form-urlencoded'
\ -H 'Accept: application/json'
\ -d 'amount=100'
\ -d 'currency=usd'
\ -d 'description=Purchase with Noodlio Pay'
\ -d 'source=tok_181ER0E9p71uHfeG90clN2MH'
\ -d 'stripe_account=acct_12abcDEF34GhIJ5K'

Related

How to pass SSL cert and key in Gatling Script

I have to create one script in gatling where I need to pass ssl CERT AND KEY.Curl is in below format.I am not sure how to pass it in my simulation .Can someone please help.
curl -E abc.crt --key cde.key --location --request POST 'https://a/b' \
--header 'Content-Type: application/json'

How to deploy Mule application jar file in Runtime Fabric with Anypoint Runtime Manager REST API without going though Anypoint Exchange

I want deploy a jar file which is availble for me in my pc to RTF Mule server managed by AKS.I want use ARM rest api.
curl --location --request POST 'https://anypoint.mulesoft.com/hybrid/api/v1/applications' \
--header 'x-anypnt-env-id: e21c3d' \
--header 'x-anypnt-org-id: 321d5ac3e' \
--header 'Authorization: Bearer 4f4e0ce1340c29f7baf9' \
--header 'Content-Type: multipart/form-data' \
--header 'Cookie: XSRF-TOKEN=TLy3BYtp-pshrqU42; mulesoft.sess=eyJpeyJ1c2VyX2lkIjoiZmU2YWZlMGQtMTZhZC00NDEwLTk1YTUtNDQ5MzUyZTgwMmUzIn19fQ==; mulesoft.sess.sig=IlvX_h9vp_ijZt_hAh0gM5WXoEs' \
--form 'file=#"/C:/Users/wb587070/AnypointStudio/s7-12-workspace/test-project/target/test-project-5.0.0-dev393-mule-application.jar"' \
--form 'artifactName="test-project"' \
--form 'targetId="30683393-4494-4d21-87c6-be27679ed021"' \
I am using curl to deploy jar file but I am getting "403 forbidden error"
In this knowledge article the application is deployed first to Exchange, and then from Exchange to the Runtime Fabric server. Is there any way by using Anypoint Runtime Manager REST API to deploy application straight to server with out using Exchange
No. Application deployments must go through the Anypoint Exchange repository first.
You can use Anypoint CLI as an alternative to the REST API however it still requires deploying to Exchange first: https://docs.mulesoft.com/anypoint-cli/3.x/runtime-fabric-apps#runtime-mgr-application-deploy

Failed to add a new replica to SiriDB

My Set-up
I've started two SiriDB server on the same node, but using different ports:
First server:
server_name: %HOSTNAME:9010
listen_client_port: 9000
http_api_port: 9020
Second server:
server_name: %HOSTNAME:9011
listen_client_port: 9001
http_api_port: 9021
Situation
I've created a new replica using the following curl command:
curl --location --request POST 'http://localhost:9021/new-replica' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic c2E6c2lyaQ==' \
--header 'Content-Type: text/plain' \
--data-raw '{
"dbname": "dbtest",
"username": "iris",
"password": "siri",
"host": "localhost",
"port": 9000,
"pool": 0
}'
The response from the command above was OK.
But in the server logging I see the following error message:
Connecting to back-end server 'my-hostname-xxx:9010' failed (error: connection refused)
When performing a list servers query, it seems that the servers are not able to find each other:
curl --location --request POST 'http://localhost:9021/query/dbtest' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic aXJpczpzaXJp' \
--header 'Content-Type: text/plain' \
--data-raw '{"q": "list servers"}'
This is the response:
{"columns":["status"],"servers":[["offline"],["running | synchronizing"]]}
I can't find what's wrong, as the servers run on the same host. Therefore, they should be able to find each other right?
Most likely your binding is incorrect. Can you check if this is the case?
By default SiriDB binds only to 127.0.0.1 (localhost) for security reasons.
Since %HOSTNAME is used, it might be so that SiriDB is listening on another interface.
If you are using a configuration file, you probably need to change both bind_server_address and bind_client_address to :: (any).
Note: the same setting can be done using the environment variable SIRIDB_BIND_SERVER_ADDRESS and SIRIDB_BIND_CLIENT_ADDRESS.

IAP from Service account OIDC Token : 401 Unauthorized

Hello, in a sh script i try to call an api in App Engine Standard (with a POST) behind an IAP.
I use a service account who have the "IAP-secured Web App user" permission.
The service account is from an another account that the IAP.
I first generate an OpenId connect :
OIDC_token_response=$(curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer "$(gcloud auth print-access-token) \
-H "Accept: application/json" \
--data '{"audience":"{CLIENT_ID_IAP","includeEmail":true}' \
-s --write-out "HTTP_CODE:%{http_code}" \
https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${MY_SERVICE_ACCOUNT:generateIdToken)
Then i use the token :
api_response=$(curl -X POST -H "Authorization: Bearer "${OIDC_token} -s --write-out "HTTP_CODE:%{http_code}" https://{MY-APP}.appspot.com/my-api/)
The answer is :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>401 Unauthorized</title>
<h1>Unauthorized</h1>
<p>Unauthorized</p>
HTTP_CODE:401
Any idea ?
Regards
The error was not at the IAP Level : the 401 error was returned by the app engine application.
The IAP connection is OK.
Sorry for this post.

Authenticated Rest calls in Zeppelin

I have enables authentication in Zeppelin. I am able to authenticate Zeppelin from curl:
curl -i --data 'userName=admin&password=admin' -X POST http://ip_address:port/api/login
It is giving me response properly with JSESSIONID.
How can I use the same session in my next API calls like
http://ip_address:port/api/notebook
Thanks.
Write the response cookies to local file during login api call
curl -c cookies.txt -i --data 'userName=admin&password=admin' -X POST http://ip_address:port/api/login
and pass the cookies to next API calls
curl -b cookies.txt http://ip_address:port/api/notebook
Example for run note
curl -i -b 'JSESSIONID=ad51301f-a13b-4b8d-a6c7-b684dc453f8f; Path=/; HttpOnly' -X POST -H "Content-Type: application/json" http://ip_address:port/api/notebook/job/note_id

Resources