Google Pay + Sberbank integration error 10 - google-pay

I have made integration by google pay tutorial. Everything is fine, but after i sent payment signature from google pay api response to Sberbank gateway i've got error response about signature verifying problem. What is can be a reason of this error?
function onGooglePaymentButtonClicked() {
getGooglePaymentsClient().loadPaymentData({
apiVersion: 2,
apiVersionMinor: 0,
allowedPaymentMethods: [
{
type: 'CARD',
parameters: {
allowedAuthMethods: allowedAuthMethods,
allowedCardNetworks: allowedCardNetworks
},
tokenizationSpecification: tokenizationSpecification
}
],
transactionInfo: {
totalPriceStatus: 'FINAL',
totalPrice: '1',
currencyCode: 'RUB',
countryCode: 'RU'
}
})
.then(function(paymentData) {
processPayment(paymentData);
})
.catch(function(err) {
console.error(err);
});
}

Related

AWS SDK cognito Custom Challenge (Missing required parameter ANSWER)

Am using AWS SDK nodejs, currently doin CUSTOM CHALLENGE with phone number as USERNAME.
Able to receive SMS using "InitiateAuth "
Request:
const input: Cognito.InitiateAuthCommandInput = {
ClientId: process.env['Cognito_clientId'],
AuthFlow: Cognito.AuthFlowType.CUSTOM_AUTH,
AuthParameters: {
USERNAME: phoneNo
},
};
Response:
{
"result": {
"$metadata": {
"httpStatusCode": 200,
"requestId": "3b657d1e-0bc9-4688-8d8d-262a15423f61",
"attempts": 1,
"totalRetryDelay": 0
},
"ChallengeName": "CUSTOM_CHALLENGE",
"ChallengeParameters": {
"USERNAME": "+60xxxxxxx"
},
"Session": "AYABeET-_lEjNtSjk92wys9dJeIAHQABAAdTZXJ2aWNlABBDb2duaXRvVXNlclBvb2xzAAEAB2F3cy1rbXMAUGFybjphd3M6a21zOmFwLXNvdXRoZWFzdC0xOjAzMTU3NzI0MDA0ODprZXkvYmEwNzA1YzktMTI0Mi00ODg1LWJhMmYtNDhiMWNjYTNiNDNmALgBAgEAeMtRirmB1qptVeI5EWSyPpLL6RXz-VVK9JVsLMBfSNNmAap9HYRwVToFU4Xvt9DcvfoAAAB-MHwGCSqGSIb3DQEHBqBvMG0CAQAwaAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAxjxbxqrEx0kP7n7g4CARCAO6LG6jTd1lWHaNb69h-_ot85fKE-RWSBUn0NbAHZY06v7HNclPRTei8NIncvXzIUGMzibmSl9OE05hotAgAAAAAMAAAQAAAAAAAAAAAAAAAAAGX9wUB-dnBMvCx0hTb_xfD_____AAAAAQAAAAAAAAAAAAAAAQAAAPNDFLwOwHcyee5zQVZ4C5oGGEw0k730misyMIysJEg4ZpKkKTdbKMHg8FJgqhlw14UmTk-y-AJqUAr3yu7XhiPhM38Aa3DKxKGPtIDxt0aKZZyPga2RVIVhA0oW_UNlbU9TRzPoG7qph1HhCCTY6XTrT8nNFtGVyuUoPLh4lrUT-3BMQwVphz6oyxrUD8kUvD-tGjyKYhStn6Tljv3ooymkHNv3CGSY93W4KNzQPM410ld24nhJXE1D_gJNhtFQblCepVKf_54BrTNQqcbTSAwZ6o28yIEHEyUYlbK1OYN70vwB1k17uPeOxfVf3YW3xisLItnIn4eAX5UwYjiJSABl-kO2"
}
}
Based on documentation, should be calling "RespondToAuthChallenge" API next. But keep getting "Missing required parameter ANSWER"
https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_RespondToAuthChallenge.html
Request:
const input: Cognito.RespondToAuthChallengeCommandInput = {
ClientId: process.env['Cognito_clientId'],
ChallengeName: ChallengeNameType.CUSTOM_CHALLENGE,
ChallengeResponses: {
USERNAME: phoneNo
},
Session: body.session
};
Response:
InvalidParameterException: Missing required parameter ANSWER
Any idea what is wrong?
Thanks
Add ANSWER to your ChallengeResponses object that you send in to RespondToAuthChallenge:
const input: Cognito.RespondToAuthChallengeCommandInput = {
ClientId: process.env['Cognito_clientId'],
ChallengeName: ChallengeNameType.CUSTOM_CHALLENGE,
ChallengeResponses: {
USERNAME: phoneNo,
ANSWER: /*add sms code or similar here..*/
},
Session: body.session
};

Agora Recording Service Query returning recording status 6 right after start

I'm trying to record a video call using the Agora APIs.
To do this I've follow Agora's documentation and created the following steps:
Get a recording resources - working
axios.post(`https://api.agora.io/v1/apps/${appId}/cloud_recording/acquire`, {
cname: cname,
uid: uid.toString(),
clientRequest: {
region: "NA",
resourceExpiredHour: 24
},
},
{
headers: {
'Authorization': authorizationField,
'Content-Type': 'application/json'
},
})
Start the recording - working
axios.post(`https://api.agora.io/v1/apps/${appId}/cloud_recording/resourceid/${resourceId}/mode/mix/start`, {
cname: cname,
uid: uid.toString(),
clientRequest: {
token: token, // token from token server
recordingConfig: {
channelType: 0, // set for non live broadcast
streamTypes: 2, // subscribes both audio and video streams
decryptionMode: 0, // the default setting
audioProfile: 0, // default setting
videoStreamType: 0, // default setting
maxIdleTime: 30, // after 30sec of no users, recording stops
transcodingConfig: {
width: 720, // default
height: 1280, // default
fps: 15, // default
bitrate: 500, // default
mixedVideoLayout: 1, // grid layout
backgroundColor: "#000000", // black background color
},
subscribeUidGroup: 0, // setup for recording 1-2 users
},
recordingFileConfig: {
"avFileType": [
"hls",
"mp4",
],
},
storageConfig: {
vendor: 1, //amazon
region: 3, // amazon US_WEST_2
bucket: "agora-practice-recording-storage",
accessKey: "*****************",
secretKey: "*****************",
},
},
},
{
headers: {
'Authorization': authorizationField,
'Content-Type': 'application/json'
},
})
Query the status - kinda working - returning status 6 before stop method is ever called/no files in filesList[]
axios.get(`https://api.agora.io/v1/apps/${appId}/cloud_recording/resourceid/${resourceId}/sid/${sId}/mode/mix/query`,
{
headers: {
'Authorization': authorizationField,
'Content-Type': 'application/json'
},
})
.then(function (response) {
console.log("Query Response", response.data.serverResponse);
})
.catch(function (error) {
console.log("Query Error", error, authorizationField);
});
})
the response is:
​
serverResponse: {
status: 6,
fileList: [],
fileListMode: "string",
sliceStartTime: 0
}
This leads the stop method to not work and return 404.
I was expecting the query status to return 5 and fileList[] to be populated with the file name of the recording. I was expecting the stop method to work.

How to resolve Cloud Function Error:401 Unauthorized

I have coded an Apps Script that creates an event in the Calendar.
Apps Script is stand alone, and event in also created in my personal Gmail account.
This Script is linked to GCP project linked to same account as Script.
Oauth consent screen is created in the GCP account and also credentials for Oauth2.0 client ID.
Now I created a cloud function to call this appsScript but it is giving an Error:401
following is code for the cloud function
let message = req.query.message || req.body.message || 'Hello World!';
const axios = require('axios');
const {google} = require('googleapis');
//Authorization
const { GoogleAuth } = require('google-auth-library');
const auth1 = new GoogleAuth({
keyFile: 'credentials.json',
scopes: ['https://www.googleapis.com/auth/drive','https://www.googleapis.com/auth/drive.metadata'
, 'https://www.googleapis.com/auth/calendar','https://www.googleapis.com/auth/calendar.events' ],
});
const drive = google.drive({version: 'v3', auth: auth1 });
const calendar = google.calendar({version : "v3"});
//calling formSchedule function with all the variables
async function formSchedule(eventDate,claimId, garageId, claimDet,startTime,cEmailG){
//Schedule Meeting Json Data
var evDurtion=30;
var startDateTime = startTime;
var endDateTime=new Date(startDateTime.getTime()+(evDurtion*60000));
// console.log(endDateTime)
var subject="Claim ID : "+claimId+' - Call';
var attendees=[{
"email": garageId,
},
];
var eventData={
"summary":subject,
'start': {
'dateTime': startDateTime,
'timeZone': 'Asia/Kolkata'
},
'end': {
'dateTime': endDateTime,
'timeZone': 'Asia/Kolkata'
},
"attendees":attendees,
"conferenceData": {
"createRequest": {
"conferenceSolutionKey": {
"type": "hangoutsMeet"
},
"status": {
"statusCode": "success"
},
"requestId": "test1235"
}
},
"description":claimDet,
"defaultReminders": [
{
"method": "popup",
"minutes": "5"
}
]
}
console.log("after all variables initialization")
// Schedule Meeting
axios({
method: "post",
url : //API Executable deployed Apps Script link,
data: {
'eventdata' : eventData,
'serviceId' : cEmailG
},
headers: {
'Content-Type': 'text/plain;charset=utf-8',
},
}).then(function (response) {
try{
console.log('Event Added Successfully.')
}
catch (error){
console.log('------error-----',error)
}
})
}
res.status(200).send(message);
};```

Infinity loop in paypal multi seller

I'm currently programming a paypal multi seller checkout with the paypal api v2. In the checkout i always get stuck in a loop after clicking continue. It just says processing and stays like that. I also tried creating another Paypal App but same problem.How can i fix this? I used the following code to generate the order:
const axios = require('axios')
axios
.post('https://api-m.sandbox.paypal.com/v2/checkout/orders', {
"intent":"CAPTURE",
"application_context":{
"return_url":"C:\Users\Felix\Desktop\index.html",
"cancel_url":"C:\Users\Felix\Desktop\index.html"
},
"purchase_units":[
{
"reference_id":"test1",
"payee": {
"email_address": "sb-lgj1x6610750#business.example.com"
},
"amount":{
"currency_code":"EUR",
"value":"100.00"
},
"payment_instruction":{
"disbursement_mode":"INSTANT",
"platform_fees":[
{
"amount":{
"currency_code":"EUR",
"value":"2.00"
}
}
]
}
},
{
"reference_id":"test2",
"payee": {
"email_address": "sb-bong06236339#business.example.com"
},
"amount":{
"currency_code":"EUR",
"value":"7.00"
},
"payment_instruction":{
"disbursement_mode":"INSTANT",
"platform_fees":[
{
"amount":{
"currency_code":"EUR",
"value":"2.00"
}
}
]
}
}
]
},{
headers:{
'Content-Type': "application/json",
'Authorization': "Bearer A21AAJwo7sZjHVhLX3jHjR3HQzE-ojoUzbJUe--WXulQqOzEoV8sF0wNgCUqhOO3N3mDQl5pjnogxOBFmwywr3iXPpj9_VmGA",
'PayPal-Partner-Attribution-Id': 'FLAVORsb-7vgls6637891_MP'
}
})
.then(res => {
console.log(`statusCode: ${res.statusCode}`)
console.log(res.data)
})
.catch(error => {
console.error(error)
})
The return_url must be valid HTTP/S
The receiving (seller) account's email must be confirmed in the sandbox environment, https://www.sandbox.paypal.com/businessprofile/settings/email -- and if they do not have a balance in the transaction's currency (EUR in this example), they must accept a payment in their account's interface to open such a balance, or enable the payment receiving preference to automatically convert received payments to their account's primary balance (often USD, depending on country)

how to apple pay through stripe in VJs?

I am trying to follow the guide here ( https://stripe.com/docs/stripe-js/elements/payment-request-button ) to setup Apple Pay for the web and Stripe. The initial steps such as verification of domain and all the pre-setup is done but I am having an issue following the steps for the payment.
The Apple Pay Button is showing up in my Safari browser. When the button is clicked, I fire an event called Paymentmethode() i am facing this error while checking live.Either you do not have a card saved to your Wallet or the current domain (pwafe.devco.pk) is not registered for Apple Pay. Visit https://dashboard.stripe.com/account/apple_pay to register this domain.
main.js:25. and button is hide I get lost after step 3 and not sure what to do. I am posting to my backend and on the backend, creating a payment intent and returning the client_secret
paymentMethod() {
// STEP 1 FROM GUIDE
var stripe = Stripe("pk_test_YxSI6F4QeV0XCofSgabilbTu00ChOmJWJ0", {
apiVersion: "2020-08-27",
stripeAccount: "CONNECTED_STRIPE_ACCOUNT_ID",
});
// STEP 2 FROM GUIDE
var paymentRequest = stripe.paymentRequest({
country: "US",
currency: "usd",
total: {
label: "Demo total",
amount: 1099,
},
requestPayerName: true,
requestPayerEmail: true,
});
// STEP 3 FROM GUIDE
var elements = stripe.elements();
var prButton = elements.create("paymentRequestButton", {
paymentRequest: paymentRequest,
});
// console.log("before api call", paymentRequest);
paymentRequest.canMakePayment().then(function (result) {
// console.log("after api called" + result);
if (result) {
prButton.mount("#payment-request-button");
} else {
//prButton.mount('#payment-request-button');
document.getElementById("payment-request-button").style.display =
"none";
}
});
// STEP 4 FROM GUIDE -- THIS RETURNS A CLIENT SECRET
let clientSecret;
axios
.post("https://pwa.devco.pk/api/Create_PaymentIntent", {})
.then((resp) => {
// Assign this previously defined variable
clientSecret = resp.client_secret;
});
paymentRequest.on("paymentmethod", function (ev) {
// Confirm the PaymentIntent without handling potential next actions (yet).
stripe
.confirmCardPayment(
clientSecret,
{
payment_method: ev.paymentMethod.id,
},
{
handleActions: false,
}
)
.then(function (confirmResult) {
if (confirmResult.error) {
// Report to the browser that the payment failed, prompting it to
// re-show the payment interface, or show an error message and close
// the payment interface.
ev.complete("fail");
} else {
// Report to the browser that the confirmation was successful, prompting
// it to close the browser payment method collection interface.
ev.complete("success");
// Check if the PaymentIntent requires any actions and if so let Stripe.js
// handle the flow. If using an API version older than "2019-02-11" instead
// instead check for: `paymentIntent.status === "requires_source_action"`.
if (confirmResult.paymentIntent.status === "requires_action") {
// Let Stripe.js handle the rest of the payment flow.
stripe.confirmCardPayment(clientSecret).then(function (result) {
if (result.error) {
let data = {
msg: "An error occurred. Please try again.",
};
this.handleShowFlashMsg(data);
// The payment failed -- ask your customer for a new payment method.
} else {
this.handleShowOrderConfirmModal();
// The payment has succeeded.
}
});
} else {
// The payment has succeeded.
}
}
});
});
var paymentRequest = stripe.paymentRequest({
country: "US",
currency: "usd",
total: {
label: "Demo total",
amount: 1099,
},
requestShipping: true,
// `shippingOptions` is optional at this point:
shippingOptions: [
// The first shipping option in this list appears as the default
// option in the browser payment interface.
{
id: "free-shipping",
label: "Free shipping",
detail: "Arrives in 5 to 7 days",
amount: 0,
},
],
});
paymentRequest.on("shippingaddresschange", function (ev) {
if (ev.shippingAddress.country !== "US") {
ev.updateWith({
status: "invalid_shipping_address",
});
} else {
// Perform server-side request to fetch shipping options
fetch("/calculateShipping", {
data: JSON.stringify({
shippingAddress: ev.shippingAddress,
}),
})
.then(function (response) {
return response.json();
})
.then(function (result) {
ev.updateWith({
status: "success",
shippingOptions: result.supportedShippingOptions,
});
});
}
});
var stripe = Stripe("pk_test_YxSI6F4QeV0XCofSgabilbTu00ChOmJWJ0", {
apiVersion: "2020-08-27",
stripeAccount: "CONNECTED_STRIPE_ACCOUNT_ID",
});
},
You should verify domain registration and add card into wallet.tha