Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to fetch order if payment type is leasing #106

Closed
Tasteful opened this issue Nov 23, 2022 · 2 comments
Closed

Not able to fetch order if payment type is leasing #106

Tasteful opened this issue Nov 23, 2022 · 2 comments

Comments

@Tasteful
Copy link
Contributor

Tasteful commented Nov 23, 2022

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.

@lounge
Copy link
Collaborator

lounge commented Nov 24, 2022

@Tasteful Please add steps to reproduce.

@Tasteful Tasteful changed the title Not able to confirm leasing order Not able to fetch order if payment type is leasing Nov 24, 2022
@lounge
Copy link
Collaborator

lounge commented Nov 30, 2022

@Tasteful Fixed in v3.1.0

@lounge lounge closed this as completed Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants