sveawebpay / svea-sdk-dotnet Goto Github PK
View Code? Open in Web Editor NEWSvea WebPay SDK for .NET
Svea WebPay SDK for .NET
Svea have released to use VIPPS in Norway. I can't find any references to this in the SDK.
Is there any plan to add this?
If I don't navigate wrong I think the commits for the ZeroSum is missing in the latest release, can you dobbel check?
While using order action order.Actions.DeliverOrder
the order is delivered as expected but I also get the following error at the same time.
Svea.WebPay.SDK.Exceptions.HttpResponseException
HResult=0x80131500
Message=GET: https://paymentadminapistage.svea.com/api/v1/orders/*orderid* failed with error code Unauthorized using bearer token *token*. Request body: . Response body:
Source=Svea.WebPay.SDK
StackTrace:
at Svea.WebPay.SDK.SveaHttpClient.<SendHttpRequestAndProcessHttpResponse>d__10`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Svea.WebPay.SDK.SveaHttpClient.<HttpGet>d__4`1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Svea.WebPay.SDK.SveaHttpClient.<ExecuteResourceRequest>d__9`2.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Svea.WebPay.SDK.SveaHttpClient.<HttpPost>d__8`2.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Svea.WebPay.SDK.PaymentAdminApi.OrderActions.<>c__DisplayClass0_0.<<-ctor>b__3>d.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
Steps to reproduce.
client.Checkout.CreateOrder
order.Actions.DeliverOrder
Basic procedure for step 4.
var order = await client.PaymentAdmin.GetOrder(checkoutOrderId);
var orderRowIds = order.OrderRows.Select(r => r.OrderRowId).ToArray();
var delivery = new Svea.WebPay.SDK.PaymentAdminApi.Request.DeliveryRequest(orderRowIds);
var polling = new Svea.WebPay.SDK.PaymentAdminApi.PollingTimeout();
await order.Actions.DeliverOrder(delivery, polling);
If SWISH
PaymentType is used during checkout I'm unable to fetch the order after the payment has been completed.
The JSON value could not be converted to Svea.WebPay.SDK.CheckoutApi.Data. Path: $.PaymentType | LineNumber: 0 | BytePositionInLine: 3349.
at System.Text.Json.ThrowHelper.ThrowJsonException(String message)
at System.Text.Json.Serialization.Converters.EnumConverter`1.ReadWithQuotes(Utf8JsonReader& reader)
at System.Text.Json.Serialization.Converters.EnumConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.Converters.NullableConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.TryReadAsObject(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state, Object& value)
at System.Text.Json.Serialization.Converters.LargeObjectWithParameterizedConstructorConverter`1.ReadAndCacheConstructorArgument(ReadStack& state, Utf8JsonReader& reader, JsonParameterInfo jsonParameterInfo)
at System.Text.Json.Serialization.Converters.ObjectWithParameterizedConstructorConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadCore[TValue](Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, Type returnType, JsonSerializerOptions options)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at Svea.WebPay.SDK.SveaHttpClient.<SendHttpRequestAndProcessHttpResponse>d__10`1.MoveNext()
In the https://paymentadminapi.svea.com/documentation/#/?id=deliver-order it is described that the CancelRemaining
can be set when the order is marked as delivered but that property is missing in the SDK. Is there some other method that should be used to achieve the same behavior?
The deliver order have the parameter to cancelRemaining to release the amount that not should be delivered, this seams only to work with payment types Invoice, PaymentPlan and AccountCredit.
Is there any plan to implement the deliver order with lower amount to be able to adjust and return/release the amount that not will be delivered for other payment types?
The HttpResponseException
have accessibility internal
, this make it hard to catch the exception because we need to catch on Exceptoion
and then use reflection to get the correct result back.
Can the HttpResponseException
be changed to public
accessibility?
I am currently using await client.PaymentAdmin.GetOrder(checkoutOrderId);
to retrieve order information, but occasionally I encounter a JsonException error. The JSON response contains the following data: "OrderStatus": "Expired"
However, the "Expired" value does not appear in the OrderStatus enum, I guess this might be causing the issue.
The error message I receive is:
JsonException: The JSON value could not be converted to Svea.WebPay.SDK.PaymentAdminApi.Response.OrderResponseObject. Path: $.OrderStatus | LineNumber: 0 | BytePositionInLine: 81.
Additionally, it would be great if the ExpirationDate mentioned in the documentation could be added as well 😄
We have a customer that trying to use MOBILEPAY in DK and the SDK throws exception. I can see that the missed types in the enums was added like 6 hours ago. Do we have any plan on release date for this?
// Patric @ Litium
In the integration code that using the Svea SDK we are getting error logs that not contains to full stacktrace and have found this exception that not will include the original exception as inner exception for the new exception that is created. Should be good if that can be included as well.
// Patric @ Litium
In the following row it defined that the payment type for leasing is LEASINGMANUAL
In the json-response for a leasing order we instead got the payment type as LEASING
{
"Gui": {
"Layout": "desktop",
"Snippet": "...reducted..."
},
"MerchantSettings": {
"CheckoutValidationCallBackUri": "https://...reducted.../api/svea/7e1b794a-9f6c-4485-9191-be935c41d706/validation",
"PushUri": "https://...reducted.../api/svea/7e1b794a-9f6c-4485-9191-be935c41d706/pushNotification?order_id={checkout.order.uri}",
"WebhookUri": "",
"TermsUri": "https://...reducted.../api/svea/7e1b794a-9f6c-4485-9191-be935c41d706/terms",
"CheckoutUri": "https://...reducted.../api/svea/7e1b794a-9f6c-4485-9191-be935c41d706/checkout",
"ConfirmationUri": "https://...reducted.../api/svea/7e1b794a-9f6c-4485-9191-be935c41d706/confirmation",
"ActivePartPaymentCampaigns": [],
"PromotedPartPaymentCampaign": 0
},
"Cart": {
"Items": [
{
"ArticleNumber": "DirectShipment:standardPackage",
"Name": "DirectShipment:standardPackage",
"Quantity": 100,
"UnitPrice": 299875,
"DiscountPercent": 0,
"DiscountAmount": 0,
"VatPercent": 2500,
"Unit": null,
"TemporaryReference": null,
"RowNumber": 2,
"MerchantData": null,
"ShippingInformation": null,
"RowType": "Row"
},
{
"ArticleNumber": "E0001",
"Name": "Ramställning 3x4,5m ALU",
"Quantity": 100,
"UnitPrice": 1601280,
"DiscountPercent": 0,
"DiscountAmount": 0,
"VatPercent": 2500,
"Unit": "st",
"TemporaryReference": null,
"RowNumber": 1,
"MerchantData": null,
"ShippingInformation": null,
"RowType": "Row"
}
]
},
"Customer": {
"Id": 39298,
"NationalId": "165590326186",
"CountryCode": "SE",
"IsCompany": true,
"VatNumber": null
},
"ShippingAddress": {
"FullName": "Codify Venture Capital AB",
"FirstName": null,
"LastName": null,
"StreetAddress": "Djupviksvägen 66",
"StreetAddress2": null,
"StreetAddress3": null,
"CoAddress": null,
"PostalCode": "26186",
"City": "Ludvika",
"CountryCode": "SE",
"IsGeneric": false,
"AddressLines": []
},
"BillingAddress": {
"FullName": "Codify Venture Capital AB",
"FirstName": null,
"LastName": null,
"StreetAddress": "Djupviksvägen 66",
"StreetAddress2": null,
"StreetAddress3": null,
"CoAddress": null,
"PostalCode": "26186",
"City": "Ludvika",
"CountryCode": "SE",
"IsGeneric": false,
"AddressLines": []
},
"Locale": "sv-SE",
"Currency": "SEK",
"CountryCode": "SE",
"ClientOrderNumber": "...reducted...",
"OrderId": 8793809,
"EmailAddress": "...reducted...",
"PhoneNumber": "...reducted...",
"PaymentType": "LEASING",
"Payment": {
"PaymentMethodType": "Leasing"
},
"Status": "Final",
"CustomerReference": "testref",
"SveaWillBuyOrder": null,
"IdentityFlags": null,
"MerchantData": null,
"PeppolId": null,
"ShippingInformation": null
}
This will end up in the following exception
The JSON value could not be converted to Svea.WebPay.SDK.CheckoutApi.Data. Path: $.PaymentType | LineNumber: 0 | BytePositionInLine: 3639. System.Text.Json.JsonException at System.Text.Json.ThrowHelper.ThrowJsonException(String message)
at System.Text.Json.Serialization.Converters.EnumConverter`1.ReadAsPropertyNameCore(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.Converters.EnumConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.Converters.NullableConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.TryReadAsObject(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state, Object& value)
at System.Text.Json.Serialization.Converters.LargeObjectWithParameterizedConstructorConverter`1.ReadAndCacheConstructorArgument(ReadStack& state, Utf8JsonReader& reader, JsonParameterInfo jsonParameterInfo)
at System.Text.Json.Serialization.Converters.ObjectWithParameterizedConstructorConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable`1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at Svea.WebPay.SDK.SveaHttpClient.SendHttpRequestAndProcessHttpResponse[TResponse](HttpRequestMessage httpRequest, Boolean configureAwait)
Checkout.CreateOrder(payload)
-method.LEASING
payment type.Checkout.GetOrder(orderId)
Expected: Get the order from for the ckeckout to be able to validate the status on the order.
Actual: When the Checkout.GetOrder(orderId)
should deserialize the response the above exception is thrown.
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.