stoiveyp / alexa.net.inskillpricing Goto Github PK
View Code? Open in Web Editor NEWA simple package built to work with Alexa In Skill Products
License: MIT License
A simple package built to work with Alexa In Skill Products
License: MIT License
So it seemed to be working well but then i got this error,
{
"errorType": "ArgumentOutOfRangeException",
"errorMessage": "Unknown request type: Connections.Response.\nParameter name: Type",
"stackTrace": [
"at Alexa.NET.Request.Type.RequestConverter.Create(String requestType)",
"at Alexa.NET.Request.Type.RequestConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)",
"at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)",
"at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)",
"at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)",
"at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)",
"at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)",
"at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)",
"at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)",
"at Amazon.Lambda.Serialization.Json.JsonSerializer.Deserialize[T](Stream requestStream)",
"at lambda_method(Closure , Stream , Stream , LambdaContextInternal )"
]
}
This was the same issue I had without the package I tried uninstalling and reinstalling but I can't figure out why it came back.
I'm struggling with adding request handler support. I tried my own implementation below and the way suggested in the docs
ConnectionRequestHandler.AddToRequestConverter();
var skillRequest = JsonConvert.DeserializeObject<SkillRequest>(requestBody);
var requestType = skillRequest.GetRequestType();
if (requestType == typeof(ConnectionResponseRequest))
{
var x = skillRequest as ConnectionResponseRequest;
}
I tried the switch statement as suggested in the docs but I get this error
The response type "Connections.Response" is used in a lot more places than In Skill Purchasing. For the alexa amzonpay integration its used for a couple different requests. The API docs are here. The responses that alexa makes to the Setup and Charge steps are both using Connections.Response. I'm adding models following this pattern for an amazonpay-alexa integration and am happy to pr them here though I'm not sure if this is the right repo for them. Is this project just intended for in app purchasing and such or all alexa purchasing integrations? The name makes it a little unclear to me.
For adding the Request Handler support, your markdown suggest using
ConnectionResponseHandler.AddToRequestConverter();
when it should be
ConnectionRequestHandler.AddToRequestConverter();
Thanks for making this library, super helpful!
In addition to the Purchase Result in 'PurchaseResult.cs':
public const string Accepted = "ACCEPTED";
public const string Declined = "DECLINED";
public const string AlreadyPurchased = "ALREADY_PURCHASED";
public const string Error = "ERROR";
There is a "PENDING_PURCHASE" option. This occurs in a kids skill where a parent needs approval. The payload is returned as a ConnectionResponse (example from my payload):
"request": {
"type": "Connections.Response",
"requestId": "amzn1.echo-api.request.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"timestamp": "2021-04-29T18:25:34Z",
"locale": "en-US",
"status": {
"code": "200",
"message": "OK"
},
"name": "Upsell",
"payload": {
"purchaseResult": "PENDING_PURCHASE",
"productId": "amzn1.echo-api.request.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"token": "correlationToken"
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.