ActiveMerchant use Cyber Source flex token for payment - activemerchant

I am implementing Cyber Source with ActiveMerchant. I have the flex token I received when I tokenized the card via the Cyber Source Documentation
I am then using this token in the purchase method of the gateway
gateway = ActiveMerchant::Billing::CyberSourceGateway.new(login: 'x', password: 'x')
gateway.purchase(100, 'THETOKEN')
However, when I submit this I get the following error in CyberSource:
the subscription () could not be found
This isn't a subscription payment so I had a look through the code and saw that it does this automatically if the payment method is a string Github link
Am I doing something wrong in the way I am specifying this token?

Related

how to receive Issuer field from payment method of Stripe API

When I visit show page of Payment Method (pm_1MZe3SEoS7yEEpyZtE8jW9JC) from dashboard.stripe .com then I can see the "Issuer" field that equal "Stripe Payments UK Limited", but CAN NOT receive this data from Stripe API.
use stripe-ruby client
use last api version: 2022-11-15
screenshots:
show page of Payment Method
require 'stripe'
Stripe.api_key = "api_key"
payment_method = Stripe::PaymentMethod.retrieve('pm_1MZe3SEoS7yEEpyZtE8jW9JC')
payment_method.?
could you please insert documentation API are you reading?
generally, it is not obvious that this information is exposed by API, so you have to read documentation before.

How to use this Guesty Api and how to get data from it

I m using guesty.com api.
Adding a a payment about reservation
see this link
https://docs.guesty.com/#update-a-reservation
anyone can tell me what is the
"stripePaymentMethodToken" here
In order to create a Stripe token you'll need to send a call to Stripe using Guesty’s public Stripe key: pk_live_P0FSIEtbwU1GSvgvEM3DYuUZ, than send the received object to POST https://api.guesty.com/api/v2/guests//payment-methods

Getting the right token for embedding PowerBi Angular 8

I am following this example to embed report in Angular 6 app. I need to make some tweeks to make it work on Angular 8.
https://www.c-sharpcorner.com/article/how-to-embed-powerbi-report-in-angular-6/
The last thing was the access token.
To get the short term token I used Postman with the following endpoint:
https://login.microsoftonline.com/38efd35e-da65-4e47-8656-876039ad15b1/oauth2/token
Where 38efd35e-da65-4e47-8656-876039ad15b1 is my TenantId.
I provided App ID and client_secret. The resource is https://analysis.windows.net/powerbi/api
I am able to generate token with the call.
The Report ID is in new Workspace. In the access control, app ID is added as administrator (Service Principal). In the code I am providing Report Id and Group ID.
The App has permission for Power Bi service.
When I use the token generated in Postman as access_token I get 403 error displayed in the Angular Console.
What I could be doing wrong? What is missing?
Is it a wrong Bearer Token? Should I use something else?
MS does not provide clear step by step guide for the process.
Preferably I would like to stick to Javascript/typescript stack and not involve .NET or C#.
The answer is yes, you are missing one step that is generating embed token using access token that you have generated on Postman. Instead of using access token directly to embed your report, you need to use embed token because you are using Service Principal as a method for embedding.
And you also need to provide the type of token to be used for embedding in embed config as following:
var models = window['powerbi-client'].models;
var config = {
type: 'report',
tokenType: models.TokenType.Embed,
accessToken: accessToken,
embedUrl: embedUrl,
id: embedReportId,
settings: {}
};
Since 'service principal' and 'master user' falls under 'Embed for your customers' where embed token must be generated. Whereas, if you want to use only access token, you can use 'Embed for your organization' where user (with pro account) needs to sign-in (if not already) for generating access token.
You can refer this link to understand embedding with Power BI.
There are two type of embedding, you can refer to these links:
Embedding for your organization
Embedding for your customers
You can also refer to this all new sample created on React technology for 'embed for your organization' embed type.

How to post to a webchat using direct line in Microsoft Bot Service?

In the test web chat in azure portal, I get the bot to speak back to me the conversation id by getting it from session.message.address.conversation.id.
I wish to then view activities for this conversation id using the method described here:
https://learn.microsoft.com/en-us/bot-framework/rest-api/bot-framework-rest-direct-line-3-0-send-activity
(POST https://directline.botframework.com/v3/directline/conversations/abc123/activities
)
However, I get the following error:
{
"error": {
"code": "BadArgument",
"message": "Unknown conversation"
}
}
I have also tried:
POST https://webchat.botframework.com/v3/directline/conversations/9323c31ab1ba42328edc9191621f9c9c/activities
Any help on how I can use direct line to post/view activities for a webchat?
Thanks!
Explain your issue
I cannot reproduce your issue with POST conversations. Actually, I can only reproduce your issue with following step:
generate directline token => leverage the response conversationId and token directly call Retrieve activities with HTTP GET with:
GET https://directline.botframework.com/v3/directline/conversations/abc123/activities
Authorization: Bearer token
The correct steps are:
generate token => POST to Start a conversation => GET to Retrieve activities with HTTP GET.
For your requirement
I don't think we can interrupt outside of the conversion, as the description of Generate a Direct Line token
To generate a Direct Line token that can be used to access a single conversation.
So the token you asked from anywhere else, cannot request the activities in webchat.
An work around
You can leverage BotFramework-WebChat to quickly build up a web site bot testing environment. And generate the token in your own server for the bot client authentication. Then you can use the generated token and conversationId for requesting all the activites between bot and this bot client web site outside of the box.

Using Google API's for one's own account without OAuth

Specifically, I'd like to use the Gmail API to access my own mail only. Is there a way to do this without OAuth and just an API key and/or client id and secret?
Using an API key like:
require('googleapis').gmail('v1').users.messages.list({ auth: '<KEY>', userId: '<EMAIL>') });
yields the following error:
{ errors:
[ { domain: 'global',
reason: 'required',
message: 'Login Required',
locationType: 'header',
location: 'Authorization' } ],
code: 401,
message: 'Login Required' }
I suppose that message means they want a valid OAuth "Authorization" header. I would do that but I suppose that's not possible without presenting a webpage.
The strict answer to "Is there a way to do this without OAuth and just an API key and/or client id and secret?" is no.
However, you can achieve what you are looking for using OAuth. You simply need to store a Refresh Token, which you can then use any time to request an Auth Token to access your gmail.
In order to get the refresh token, you can either write a simple web app to do a one time auth, or follow the steps here How do I authorise an app (web or installed) without user intervention? (canonical ?) which allows you to do the whole auth flow using the Oauth Playground.
The question is rather old, but the problem is not. For now Google API has an option to create service accounts. I think it suits for everybody who wants "just connect application to its own google workspace" and not to do some actions on users behalf. Google documentation writes about it:
Typically, an application uses a service account when the application uses Google APIs to work with its own data rather than a user's data. For example, an application that uses Google Cloud Datastore for data persistence would use a service account to authenticate its calls to the Google Cloud Datastore API.
Here is the example in Java (there was no JS, but the meaning is clear):
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.services.sqladmin.SQLAdminScopes;
GoogleCredential credential = GoogleCredential.fromStream(new FileInputStream("MyProject-1234.json"))
.createScoped(Collections.singleton(SQLAdminScopes.SQLSERVICE_ADMIN));
SQLAdmin sqladmin =
new SQLAdmin.Builder(httpTransport, JSON_FACTORY, credential).build();
SQLAdmin.Instances.List instances =
sqladmin.instances().list("exciting-example-123").execute();

Resources