Giter VIP home page Giter VIP logo

svea-sdk-dotnet's People

Contributors

clement-joye avatar dependabot[bot] avatar lounge avatar mankeyx avatar mergify[bot] avatar tasteful avatar zunkas avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

svea-sdk-dotnet's Issues

Dash in Finnish company organization number disappears at checkout

I'm using preset values and specifying 9999999-2 as the value for the NationalId field.
Upon reaching the checkout process the dash in the national id disappears, leading to a validation error.

Could this behavior be attributed to the library, or might it be a problem with the API itself?

image

Unauthorized error while using `DeliverOrder` action for order

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.

  1. Create order with client.Checkout.CreateOrder
  2. Render Gui.Snippet
  3. Select Invoice payment
  4. Deliver order with 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);

Unable use `GetOrder` if swish payment type is used

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()

Plan to implement Deliver order with lower amount?

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?

JsonException for expired orders

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 😄

Mobile pay

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

Include original exception as inner exception

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.

var ex = new HttpRequestException($"Resource object was not returned: {e.Message}");

// Patric @ Litium

Not able to fetch order if payment type is leasing

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)

Repro steps

  1. Create order Checkout.CreateOrder(payload)-method.
  2. Render html-snippet to the client.
  3. Place an order with the LEASING payment type.
  4. User will be redirected to the confirmation URL.
  5. In the confirmation endpoint try to fetch the order 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.