From 21bd35accdab9768f9f43312ac4c82bccdbaee0d Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Mon, 9 May 2022 13:58:05 +0200 Subject: [PATCH] Fix shopify id / order no (#3718) fixes #3636 --- BTCPayServer/Plugins/Shopify/ApiModels/ShopifyOrder.cs | 2 ++ BTCPayServer/Plugins/Shopify/UIShopifyController.cs | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/BTCPayServer/Plugins/Shopify/ApiModels/ShopifyOrder.cs b/BTCPayServer/Plugins/Shopify/ApiModels/ShopifyOrder.cs index 65a2813e1..a77c5bfd2 100644 --- a/BTCPayServer/Plugins/Shopify/ApiModels/ShopifyOrder.cs +++ b/BTCPayServer/Plugins/Shopify/ApiModels/ShopifyOrder.cs @@ -7,6 +7,8 @@ namespace BTCPayServer.Plugins.Shopify.ApiModels { [JsonProperty("id")] public string Id { get; set; } + [JsonProperty("order_number")] + public string OrderNumber { get; set; } [JsonProperty("total_price")] public decimal TotalPrice { get; set; } [JsonProperty("total_outstanding")] diff --git a/BTCPayServer/Plugins/Shopify/UIShopifyController.cs b/BTCPayServer/Plugins/Shopify/UIShopifyController.cs index 04d89be48..e321f5d8a 100644 --- a/BTCPayServer/Plugins/Shopify/UIShopifyController.cs +++ b/BTCPayServer/Plugins/Shopify/UIShopifyController.cs @@ -112,7 +112,7 @@ namespace BTCPayServer.Plugins.Shopify var invoiceOrderId = $"{ShopifyOrderMarkerHostedService.SHOPIFY_ORDER_ID_PREFIX}{orderId}"; var matchedExistingInvoices = await _invoiceRepository.GetInvoices(new InvoiceQuery() { - OrderId = new[] { invoiceOrderId }, + TextSearch = invoiceOrderId, StoreId = new[] { storeId } }); matchedExistingInvoices = matchedExistingInvoices.Where(entity => @@ -190,7 +190,8 @@ namespace BTCPayServer.Plugins.Shopify { Amount = amount < order.TotalOutstanding ? amount : order.TotalOutstanding, Currency = order.PresentmentCurrency, - Metadata = new JObject { ["orderId"] = invoiceOrderId } + Metadata = new JObject { ["orderId"] = order.OrderNumber }, + AdditionalSearchTerms = new []{ "shopify", order.OrderNumber, order.Id, invoiceOrderId} }, store, Request.GetAbsoluteRoot(), new List() { invoiceOrderId });