I know this might seem like a simple question but I haven't found any answers in the documentation. Can someone please explain the difference between StripeAPI.defaultPublishableKey and STPAPIClient.shared.publishableKey. When are they used and for what specifically?
I'm new to coding so any help is appreciated! :)
StripeAPI is the top-level class that imports the rest of the Stripe iOS SDK. The documentation explains the defaultPublishableKey property on StripeAPI:
Set this to your Stripe publishable API key, obtained from https://dashboard.stripe.com/apikeys. Set this as early as possible in your application’s lifecycle, preferably in your AppDelegate or SceneDelegate. New instances of STPAPIClient will be initialized with this value. #warning Make sure not to ship your test API keys to the App Store! This will log a warning if you use your test key in a release build.
STPAPIClient, on the other hand, is the class/singleton you use to make Stripe API requests. The shared property on this class is the singleton, and the publishableKey property on that singleton defaults to the value of StripeAPI.defaultPublishableKey. You can, however, change it if you need to make a request with a different key, although doing so would be an uncommon edge case.
You can read more about STPAPIClient, including the properties mentioned above in Stripe's documentation.
Related
I have DTOs specified with Class-Validator and I am looking for a library that can be used to generate Swagger specification from it. I am not using it for a REST API, the code is addressing an IoT/MQTT scenario - I simply use Class-Validator to manage JSON.
NestJS/Swagger is the best maintained library. I would like to use it's capability to produce Swagger definitions without a NestJS Server. Ideally I would like to pass in a DTO definition and get it's Swagger schema.
I have been reading the source, but am struggling to understand which function in the framework actually does that. At best, I have been able to track it down to modelsDefinitions property in swagger-explorer class.
As best I can tell, from there, api-parameters.explorer and api-produces.explorer. The way they work is not clear to me. I was wondering of someone might help me out?
I'd like to add that I am aware of class-validator-jsonschema, but it is not maintained and no longer seems to work properly.
nestjs/swagger does not expose what you need as its public API which you cannot access it. The class you're looking for is SchemaObjectFactory and the method is exploreModelSchema.
Reference:
SwaggerObjectFactory
Test
Edited left name of a custom type instead of the direct service fabric interface.
I am trying to write an interceptor capable of interrogating the parameters being passed to a remoting service. I can intercept the IServiceRemotingRequestMessage once it gets to the service and am able extract the parameters, but ONLY if I know the position and name of the parameter at the time.
[Pseudo]
var someParam = IServiceRemotingRequestMessageBody.GetParameter(0, "request", serviceRequestInfo.RequestMessage.GetBody().GetType());
What I need is a way to simply iterate the parameters and work with them directly (currently just serialize them to a string so I can log some of the info being passed). However, the IServiceRemotingRequestMessageBody only exposes a GetParameter method that must be passed the index and the name...
I can maybe do some reflection work given the method name and the service contract but I'm hoping there is a much more straightforward way to get this directly.
Thanks for any tips,
Will
There may be an easier way using the default serialization, but the way I solved it, currently, is to replace the Service Fabric serialization providers with JSON Serialization. Then, my interceptors can work with the JSON data as necessary.
I'll assume there is a way to do something similar with the default serialization but, if so, it's not clearly documented how to work with it. If someone proposes an option I would gladly give it a try.
i would like to ask your help in relation with one issue i am facing. So basically i defined a swagger 2.0 spec for an API, and on the operation's responses i used the schema property in order to reference some definitions for objects that reflect the responses structure. I validated the spec on the Swagger Editor, and it is valid, and also if i generate the client code, using Swagger Codegen, the client app works well consuming the API. Now, the problem is. I went to the Developer Portal and on the API's details page, i checked the API definition (Open API option) and i compared the spec with my original spec that i used to import the API on the API Management service. And i noticed that the schema property is missing, so it is not referencing the schema of the response. Any idea?
Thanks
I figured out the issue. Apparently using the schema property on the responses, according to Swagger 2.0 spec, you can use nested $refs, in order to reference definitions inside each other. But apparently, it is not possible for Azure API Management Service, since it is mentioned as a limitation in the following link: API Management - API Import restrictions.
Anyway, i will try to change my API's spec in order to avoid nested $refs and workaround the issue.
Thanks
I'm trying to Integrating Optimizely with Adobe Analytics. I have followed along with this guide: https://help.optimizely.com/Integrate_Other_Platforms/Integrating_Optimizely_with_Adobe_Analytics with no success.
The props(prop51) and evars(eVar51) that i'm choosing via the experiment integrations in Optimizely are never sent. I check via the wasp chrome add-on and via the Adobe account.
All other data (props & eVars) that we set manually are sent.
We are not using s_code.js but AppMeasurement.js version: 1.5.1. I don't know if we are using custom s variable. I guess not. So I have follow the guide and used:
window.optimizely.push("activateSiteCatalyst"); with no success.
I have also tried: window.optimizely.push(['activateSiteCatalyst', {"sVariable": s_c_il[0].account)}]); where s_c_il[0].account holds the account name, but with no success.
Tried following this guid as well: http://digitalinsightsworld.com/tag-manager/dtm/optimizely-implementation-check-list-adobe-sitecatalyst/
Does anyone have an idea of what is wrong? Or how to go forward?
Br,
Johan
I had the same problem... We're using AngularJS 1.4.x. The default value for sVariable is 's'. Generally stated, Optimizely expects window.s to be the omniture object. Angular abstracts this object to its own injectable item, and is therefore not a standard DOM/element off window. My quick hack was to set window.s = s from within the Omniture directive. I'm still working out the best location to do this assignment, but I can verify that I now see the custom eVar for Optimizely outgoing in our Omniture call (using Omnibug). Hope this helps!
When you create a model/controller using sails generate user, which models are available? For instance, I know there some like basic CRUD, etc, but how to see all available methods?
PS: Unless I got it all wrong and there are no CRUD methods at all. I'm still learning Sails, so please forgive if its a silly question.
Basically, there are two groups of actions provided by Sails.js blueprints for a newly generated model/controller pair:
REST API: get /:controller/:id?, post /:controller, put /:controller/:id, delete /:controller/:id. These are classic REST set that should be the one being used in production. You can enable/disable these blueprints via rest property in config/controllers.js.
CRUD actions aka shortcuts: /:controller/find/:id?, /:controller/create, /:controller/update/:id, /:controller/destroy/:id. Inspired, by Rails' RESTful conventions, the shortcuts provide a way to call all the REST actions from browser address string, using GET HTTP method only, which can be very handy for developers. These can be enabled/disabled using shortcuts property in config/controllers.js, and it's a good idea to disable them in production (for example, using local environment settings (config/local.js)).