Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Benji Peck 8 posts 98 karma points
    Jan 16, 2023 @ 15:13
    Benji Peck
    0

    Nullable object must have a value in RenderPaymentFormAsync

    Hello,

    Getting an odd error on Umbraco Cloud where going through the checkout process I get an error on the payment form page. Locally though this works fine. I even connected to the cloud database locally and it works fine too.

    Umbraco 11.0

    Vendr 3.0.5

    Here is the error message

    System.InvalidOperationException: Nullable object must have a value.
       at Vendr.Infrastructure.Resiliency.PollyExecutionStrategyBase.ExecuteAsync[TResult](Func`2 operation, Func`2 verifySucceeded, CancellationToken cancellationToken)
       at Vendr.Core.VendrUnitOfWorkProvider.ExecuteAsync[T](IUnitOfWorkOptions options, Func`3 action, CancellationToken cancellationToken)
       at Vendr.Extensions.HtmlHelperExtensions.RenderPaymentFormAsync(IHtmlHelper htmlHelper, OrderReadOnly order, IDictionary`2 htmlAttributes, IOrderService orderService, IPaymentMethodService paymentMethodService, IPaymentProviderService paymentProviderService, PaymentProviderContextFactory paymentProviderContextFactory, IOrderNumberGenerator orderNumberGenerator, IUnitOfWorkProvider uowProvider, IMembershipHelper membershipHelper, CancellationToken cancellationToken)
       at AspNetCoreGeneratedDocument.Views_Shared_CheckoutPaymentForm.ExecuteAsync() in C:\home\site\repository\src\Umbraco\Views\Shared\CheckoutPaymentForm.cshtml:line 14
    

    Any ideas?

    Thanks

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jan 16, 2023 @ 15:26
    Matt Brailsford
    0

    Best I could think would be to log some info out in your CheckoutPaymentForm.cshtml file and see what if any of the params passed to the RenderPaymentFormAsync method are null 🤔

  • Benji Peck 8 posts 98 karma points
    Jan 16, 2023 @ 17:10
    Benji Peck
    0

    So i'm using the BeginPaymentFormAsync helper method like so

    @using (await Html.BeginPaymentFormAsync(order, new { @id = "payment-form" }))
    {
        ...
    }
    

    I've added a log of the order to JSON to see if something is not set etc and compared between local order and cloud order they look how they should with only Guids like order id and datetimes being different. Though Tax and the decimals used are different for some reason

    here is the json of the order from cloud if you can see anything i'm missing

     {
      "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
      "orderStatusId": "dcc193a9-0673-4f3c-bb04-01840fbed866",
      "orderStatusCode": 200,
      "taxClassId": "5183e2bb-da31-4e9c-acdf-01840fbed821",
      "languageIsoCode": "en-US",
      "cartNumber": "CART-01112-044923-QYLMH",
      "orderNumber": null,
      "customerInfo": {
        "customerReference": "75b98f84-396f-4a4b-a4fd-b83b2aa4f3bb",
        "firstName": "Benji",
        "lastName": "Peck",
        "email": "[email protected]"
      },
      "paymentInfo": {
        "countryId": "716e10be-3ae0-4d7a-90c6-01840fbed7f7",
        "regionId": null,
        "paymentMethodId": "a1b613f5-211d-40f0-b88a-018480219f4f",
        "taxRate": {
          "value": 0.20000000
        },
        "totalPrice": {
          "adjustments": [
    
          ],
          "withoutAdjustments": {
            "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
            "withoutTax": 0.0000,
            "tax": 0.0000,
            "withTax": 0.0000
          },
          "adjustment": {
            "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
            "withoutTax": 0.00,
            "tax": 0.00,
            "withTax": 0.00
          },
          "value": {
            "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
            "withoutTax": 0.00,
            "tax": 0.00,
            "withTax": 0.00
          }
        }
      },
      "shippingInfo": {
        "countryId": "716e10be-3ae0-4d7a-90c6-01840fbed7f7",
        "regionId": null,
        "shippingMethodId": "fa295cc0-b1cb-49bf-8747-01842ef1f6a6",
        "taxRate": {
          "value": 0.20000000
        },
        "totalPrice": {
          "adjustments": [
    
          ],
          "withoutAdjustments": {
            "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
            "withoutTax": 1.0000,
            "tax": 0.2000,
            "withTax": 1.2000
          },
          "adjustment": {
            "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
            "withoutTax": 0,
            "tax": 0,
            "withTax": 0
          },
          "value": {
            "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
            "withoutTax": 1.00,
            "tax": 0.20,
            "withTax": 1.20
          }
        }
      },
      "transactionInfo": {
        "transactionId": null,
        "amountAuthorized": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "value": 0.0000
        },
        "transactionFee": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "value": 0.0000
        },
        "baseCurrencyExchangeRate": null,
        "paymentStatus": null
      },
      "orderLines": [
        {
          "storeId": "d4d15b11-d8d0-4d2c-960e-01840fbed70d",
          "orderId": "66f28a83-dddf-4cda-83bf-0185ba8da665",
          "parentOrderLineId": null,
          "productReference": "696b02b0-81fd-4d62-b39b-5c0a835e9706",
          "productVariantReference": "3d6f592e-e28b-4eb4-8e45-99495be9725e",
          "sku": "test-wood-ash-25",
          "name": "Test Timber Ash",
          "quantity": 1.0000,
          "taxClassId": null,
          "bundleId": "true-mm-200-20-6-Planed all round-Yes",
          "parentBundleId": null,
          "orderLines": [
    
          ],
          "properties": {
            "width": {
              "value": "20",
              "isServerSideOnly": false,
              "isReadOnly": false
            },
            "cut": {
              "value": "Yes",
              "isServerSideOnly": false,
              "isReadOnly": false
            },
            "length": {
              "value": "200",
              "isServerSideOnly": false,
              "isReadOnly": false
            },
            "orderUnits": {
              "value": "mm",
              "isServerSideOnly": false,
              "isReadOnly": false
            },
            "customCut": {
              "value": "true",
              "isServerSideOnly": false,
              "isReadOnly": false
            },
            "thickness": {
              "value": "6",
              "isServerSideOnly": false,
              "isReadOnly": false
            },
            "profile": {
              "value": "Planed all round",
              "isServerSideOnly": false,
              "isReadOnly": false
            }
          },
          "attributes": [
            {
              "name": {
                "alias": "thickness",
                "name": "Thickness"
              },
              "value": {
                "alias": "25mm",
                "name": "25mm"
              }
            }
          ],
          "unitPrice": {
            "base": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 2.5986,
              "tax": 0.2000,
              "withTax": 2.7986
            },
            "previousAdjustments": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 0,
              "tax": 0,
              "withTax": 0
            },
            "withPreviousAdjustments": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 2.60,
              "tax": 0.20,
              "withTax": 2.80
            },
            "totalAdjustment": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 0,
              "tax": 0,
              "withTax": 0
            },
            "adjustments": [
    
            ],
            "withoutAdjustments": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 2.60,
              "tax": 0.20,
              "withTax": 2.80
            },
            "adjustment": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 0,
              "tax": 0,
              "withTax": 0
            },
            "value": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 2.60,
              "tax": 0.20,
              "withTax": 2.80
            }
          },
          "taxRate": {
            "value": 0.20000000
          },
          "totalPrice": {
            "previousAdjustments": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 0.00,
              "tax": 0.00,
              "withTax": 0.00
            },
            "withPreviousAdjustments": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 2.60,
              "tax": 0.20,
              "withTax": 2.80
            },
            "totalAdjustment": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 0.00,
              "tax": 0.00,
              "withTax": 0.00
            },
            "adjustments": [
    
            ],
            "withoutAdjustments": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 2.60,
              "tax": 0.20,
              "withTax": 2.80
            },
            "adjustment": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 0,
              "tax": 0,
              "withTax": 0
            },
            "value": {
              "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
              "withoutTax": 2.60,
              "tax": 0.20,
              "withTax": 2.80
            }
          },
          "copiedFromOrderLineId": null,
          "id": "f361957f-9519-4d1a-8725-0185bb797ade"
        }
      ],
      "properties": {
        "shippingCity": {
          "value": "Redruth",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "shippingLastName": {
          "value": "Guest",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "company": {
          "value": "Thought Quarter",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "isGuest": {
          "value": "1",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "telephone": {
          "value": "01872300780",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "firstName": {
          "value": "Benji",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "lastName": {
          "value": "Peck",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "marketingOptIn": {
          "value": "0",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "billingLastName": {
          "value": "Guest",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "shippingFirstName": {
          "value": "TQ",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "billingCity": {
          "value": "Redruth",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "shippingZipCode": {
          "value": "TR15 3GF",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "shippingAddressLine2": {
          "value": "FibreHub",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "shippingCounty": {
          "value": "Cornwall",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "shippingAddressLine1": {
          "value": "Thought Quarter",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "shippingSameAsBilling": {
          "value": "1",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "billingFirstName": {
          "value": "TQ",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "billingCounty": {
          "value": "Cornwall",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "billingAddressLine1": {
          "value": "Thought Quarter",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "email": {
          "value": "[email protected]",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "billingAddressLine2": {
          "value": "FibreHub",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "acceptTerms": {
          "value": "1",
          "isServerSideOnly": false,
          "isReadOnly": false
        },
        "billingZipCode": {
          "value": "TR15 3GF",
          "isServerSideOnly": false,
          "isReadOnly": false
        }
      },
      "discountCodes": [
    
      ],
      "giftCards": [
    
      ],
      "discounts": [
    
      ],
      "taxRate": {
        "value": 0.20000000
      },
      "totalQuantity": 1.0000,
      "subtotalPrice": {
        "previousAdjustments": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "withoutTax": 0.00,
          "tax": 0.00,
          "withTax": 0.00
        },
        "withPreviousAdjustments": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "withoutTax": 2.60,
          "tax": 0.20,
          "withTax": 2.80
        },
        "totalAdjustment": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "withoutTax": 0.00,
          "tax": 0.00,
          "withTax": 0.00
        },
        "adjustments": [
    
        ],
        "withoutAdjustments": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "withoutTax": 2.60,
          "tax": 0.20,
          "withTax": 2.80
        },
        "adjustment": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "withoutTax": 0,
          "tax": 0,
          "withTax": 0
        },
        "value": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "withoutTax": 2.60,
          "tax": 0.20,
          "withTax": 2.80
        }
      },
      "totalPrice": {
        "previousAdjustments": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "withoutTax": 0.00,
          "tax": 0.00,
          "withTax": 0.00
        },
        "withPreviousAdjustments": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "withoutTax": 3.60,
          "tax": 0.40,
          "withTax": 4.00
        },
        "totalAdjustment": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "withoutTax": 0.00,
          "tax": 0.00,
          "withTax": 0.00
        },
        "adjustments": [
    
        ],
        "withoutAdjustments": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "withoutTax": 3.6000,
          "tax": 0.4000,
          "withTax": 4.0000
        },
        "adjustment": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "withoutTax": 0,
          "tax": 0,
          "withTax": 0
        },
        "value": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "withoutTax": 3.60,
          "tax": 0.40,
          "withTax": 4.00
        }
      },
      "transactionAmount": {
        "adjustments": [
    
        ],
        "withoutAdjustments": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "value": 4.00
        },
        "adjustment": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "value": 0
        },
        "value": {
          "currencyId": "5b0c98a4-e9ce-4013-b2d0-01840fbed78e",
          "value": 4.00
        }
      },
      "createDate": "2023-01-16T12:28:43.493Z",
      "updateDate": "2023-01-16T16:48:28.257Z",
      "finalizedDate": null,
      "isProcessing": false,
      "isFinalizing": false,
      "isFinalized": false,
      "tags": [
    
      ],
      "copiedFromOrderId": null,
      "storeId": "d4d15b11-d8d0-4d2c-960e-01840fbed70d",
      "isNew": false,
      "id": "66f28a83-dddf-4cda-83bf-0185ba8da665"
    }
    

    Thanks

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jan 17, 2023 @ 09:45
    Matt Brailsford
    0

    Looks ok to me. Do you have your root node with it's store picker set correctly?

  • Benji Peck 8 posts 98 karma points
    Jan 17, 2023 @ 09:52
    Benji Peck
    0

    Yep store is set and previous pages in the checkout flow for customer info, shipping and review etc steps work as intended.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jan 17, 2023 @ 10:59
    Matt Brailsford
    0

    I'm struggling to think what to suggest really, without knowing what it thinks is null it's pretty hard to debug 🤔

  • Benji Peck 8 posts 98 karma points
    Jan 17, 2023 @ 13:40
    Benji Peck
    100

    After pull out the code from the helper into my own file and adding logging to like every line to figure out where in the process it was failing. Ended up finding an weird issue with a GetUri() method call in our payment provider GenerateFormAsync() method that doesn't work on cloud but work locally.

    Made some changes and its work now.

    Thanks for the help though

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jan 17, 2023 @ 13:48
    Matt Brailsford
    0

    Nice debugging. There is no way I could have narrowed that one down, so glad you were able to find a solution 👍

Please Sign in or register to post replies

Write your reply to:

Draft