mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-27 01:44:31 +01:00
Prefixing Shopify invoices, passing real orderId
This commit is contained in:
@@ -28,6 +28,8 @@ namespace BTCPayServer.Services.Shopify
|
||||
private CancellationTokenSource _Cts;
|
||||
private readonly CompositeDisposable leases = new CompositeDisposable();
|
||||
|
||||
public const string SHOPIFY_ORDER_ID_PREFIX = "shopify-";
|
||||
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
_Cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
|
||||
@@ -41,8 +43,11 @@ namespace BTCPayServer.Services.Shopify
|
||||
var storeData = await _storeRepository.FindStore(invoice.StoreId);
|
||||
var storeBlob = storeData.GetStoreBlob();
|
||||
|
||||
if (storeBlob.Shopify?.IntegratedAt.HasValue == true)
|
||||
if (storeBlob.Shopify?.IntegratedAt.HasValue == true &&
|
||||
shopifyOrderId.StartsWith(SHOPIFY_ORDER_ID_PREFIX, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
shopifyOrderId = shopifyOrderId[SHOPIFY_ORDER_ID_PREFIX.Length..];
|
||||
|
||||
var client = createShopifyApiClient(storeBlob.Shopify);
|
||||
if (!await client.OrderExists(shopifyOrderId))
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// extracted from shopify initialized page
|
||||
const shopify_price = Shopify.checkout.payment_due;
|
||||
const shopify_currency = Shopify.checkout.currency;
|
||||
const shopify_order_id = "shopify-" + Shopify.checkout.order_id;
|
||||
|
||||
"use strict";
|
||||
const pageElements = document.querySelector.bind(document),
|
||||
@@ -79,9 +80,7 @@
|
||||
pageItems.orderConfirmed && (pageItems.orderConfirmed.style.display = "none"),
|
||||
pageItems.orderConfirmedDescription && (pageItems.orderConfirmedDescription.style.display = "none");
|
||||
|
||||
const orderId = pageItems.orderNumber.innerText.replace("Order #", "");
|
||||
|
||||
const url = BTCPAYSERVER_URL + "/invoices" + "?storeId=" + STORE_ID + "&orderId=" + orderId + "&status=complete";
|
||||
const url = BTCPAYSERVER_URL + "/invoices" + "?storeId=" + STORE_ID + "&orderId=" + shopify_order_id + "&status=complete";
|
||||
|
||||
// Check if already paid.
|
||||
fetch(url, {
|
||||
@@ -112,7 +111,7 @@
|
||||
{
|
||||
price: shopify_price,
|
||||
currency: shopify_currency,
|
||||
orderId: orderId
|
||||
orderId: shopify_order_id
|
||||
}
|
||||
)
|
||||
.then(function (invoice) {
|
||||
|
||||
Reference in New Issue
Block a user