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

[Shopify] Connector - Export Posted Sales Invoices to Shopify as Orders #26748

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Apps/W1/Shopify/app/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"idRanges": [
{
"from": 30100,
"to": 30360
"to": 30370
}
],
"internalsVisibleTo": [
Expand Down
43 changes: 43 additions & 0 deletions Apps/W1/Shopify/app/src/Base/Pages/ShpfyShopCard.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ page 30101 "Shpfy Shop Card"
ApplicationArea = All;
ToolTip = 'Specifies the status of a product in Shopify via the sync when an item is removed in Shopify or an item is blocked in Business Central.';
}
field("Items Mapped to Products"; Rec."Items Mapped to Products")
{
ApplicationArea = All;
ToolTip = 'Specifies if only the items that are mapped to Shopify products/Shopify variants are synchronized from Posted Sales Invoices to Shopify.';
}
}
group(PriceSynchronization)
{
Expand Down Expand Up @@ -517,6 +522,11 @@ page 30101 "Shpfy Shop Card"
end;
}
#endif
field("Posted Invoice Sync"; Rec."Posted Invoice Sync")
{
ApplicationArea = All;
ToolTip = 'Specifies whether the posted sales invoices can be synchronized to Shopify.';
}
}
group(ReturnsAndRefunds)
{
Expand Down Expand Up @@ -650,6 +660,19 @@ page 30101 "Shpfy Shop Card"
RunPageLink = "Shop Code" = field(Code);
ToolTip = 'Maps the Shopify payment methods to the related payment methods and prioritize them.';
}
action(PaymentTerms)
{
ApplicationArea = All;
Caption = 'Payment Terms Mapping';
Image = SuggestPayment;
Promoted = true;
PromotedCategory = Category4;
PromotedIsBig = true;
PromotedOnly = true;
RunObject = page "Shpfy Payment Terms Mapping";
RunPageLink = "Shop Code" = field(Code);
ToolTip = 'Maps the Shopify payment terms to the related payment terms and prioritize them.';
}
action(Orders)
{
ApplicationArea = All;
Expand Down Expand Up @@ -986,6 +1009,26 @@ page 30101 "Shpfy Shop Card"
Report.Run(Report::"Shpfy Sync Shipm. to Shopify");
end;
}
action(SyncPostedSalesInvoices)
{
ApplicationArea = All;
Ellipsis = true;
Caption = 'Sync Posted Sales Invoices';
Image = Export;
Promoted = true;
PromotedCategory = Category5;
PromotedIsBig = true;
PromotedOnly = true;
ToolTip = 'Synchronize posted sales invoices to Shopify. Synchronization will be performed only if the Posted Invoice Sync field is enabled in the Shopify shop.';

trigger OnAction();
var
ExportInvoicetoShpfy: Report "Shpfy Sync Invoices to Shpfy";
begin
ExportInvoicetoShpfy.SetShop(Rec.Code);
ExportInvoicetoShpfy.Run();
end;
}
action(SyncDisputes)
{
ApplicationArea = All;
Expand Down
8 changes: 8 additions & 0 deletions Apps/W1/Shopify/app/src/Base/Tables/ShpfyShop.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,14 @@ table 30102 "Shpfy Shop"
{
DataClassification = SystemMetadata;
}
field(201; "Items Mapped to Products"; Boolean)
{
Caption = 'Items Must be Mapped to Products';
}
field(202; "Posted Invoice Sync"; Boolean)
{
Caption = 'Posted Invoice Sync';
}
}

keys
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace Microsoft.Integration.Shopify;

/// <summary>
/// Codeunit Shpfy GQL DraftOrderComplete (ID 30341) implements Interface Shpfy IGraphQL.
/// </summary>
codeunit 30341 "Shpfy GQL DraftOrderComplete" implements "Shpfy IGraphQL"
{
Access = Internal;

/// <summary>
/// GetGraphQL.
/// </summary>
/// <returns>Return value of type Text.</returns>
internal procedure GetGraphQL(): Text
begin
exit('{"query": "mutation {draftOrderComplete(id: \"gid://shopify/DraftOrder/{{DraftOrderId}}\") { draftOrder { order { legacyResourceId, name }} userErrors { field, message }}}"}');
end;

/// <summary>
/// GetExpectedCost.
/// </summary>
/// <returns>Return value of type Integer.</returns>
internal procedure GetExpectedCost(): Integer
begin
exit(11);
end;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace Microsoft.Integration.Shopify;

/// <summary>
/// Codeunit Shpfy GQL Fulfill Order (ID 30355) implements Interface Shpfy IGraphQL.
/// </summary>
codeunit 30355 "Shpfy GQL Fulfill Order" implements "Shpfy IGraphQL"
{
Access = Internal;

/// <summary>
/// GetGraphQL.
/// </summary>
/// <returns>Return value of type Text.</returns>
internal procedure GetGraphQL(): Text
begin
exit('{"query": "mutation { fulfillmentCreateV2 ( fulfillment: { lineItemsByFulfillmentOrder: [{ fulfillmentOrderId: \"gid://shopify/FulfillmentOrder/{{FulfillmentOrderId}}\" }] }) { fulfillment {id, status} userErrors {field, message}}}"}');
end;

/// <summary>
/// GetExpectedCost.
/// </summary>
/// <returns>Return value of type Integer.</returns>
internal procedure GetExpectedCost(): Integer
begin
exit(10);
end;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/// <summary>
/// Codeunit Shpfy GQL Get Fulfillments (ID 30356) implements Interface Shpfy IGraphQL.
/// </summary>
codeunit 30356 "Shpfy GQL Get Fulfillments" implements "Shpfy IGraphQL"
{
Access = Internal;

/// <summary>
/// GetGraphQL.
/// </summary>
/// <returns>Return value of type Text.</returns>
internal procedure GetGraphQL(): Text
begin
exit('{"query": "{order (id: \"gid://shopify/Order/{{OrderId}}\") { fulfillmentOrders ( first: {{NumberOfOrders}}) { nodes { id }}}}"}');
end;

/// <summary>
/// GetExpectedCost.
/// </summary>
/// <returns>Return value of type Integer.</returns>
internal procedure GetExpectedCost(): Integer
begin
exit(6);
end;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

namespace Microsoft.Integration.Shopify;

/// <summary>
/// Codeunit Shpfy GQL Payment Terms (ID 30357) implements Interface Shpfy IGraphQL.
/// </summary>
codeunit 30357 "Shpfy GQL Payment Terms" implements "Shpfy IGraphQL"
{
Access = Internal;

/// <summary>
/// GetGraphQL.
/// </summary>
/// <returns>Return value of type Text.</returns>
internal procedure GetGraphQL(): Text
begin
exit('{"query": "{paymentTermsTemplates{id name paymentTermsType dueInDays description translatedName}}"}');
end;

/// <summary>
/// GetExpectedCost.
/// </summary>
/// <returns>Return value of type Integer.</returns>
internal procedure GetExpectedCost(): Integer
begin
exit(1);
end;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Microsoft.Integration.Shopify;

codeunit 30168 "Shpfy GQL ShopLocales" implements "Shpfy IGraphQL"
codeunit 30358 "Shpfy GQL ShopLocales" implements "Shpfy IGraphQL"
{

internal procedure GetGraphQL(): Text
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Microsoft.Integration.Shopify;

codeunit 30159 "Shpfy GQL TranslationsRegister" implements "Shpfy IGraphQL"
codeunit 30359 "Shpfy GQL TranslationsRegister" implements "Shpfy IGraphQL"
{

internal procedure GetGraphQL(): Text
Expand Down
20 changes: 20 additions & 0 deletions Apps/W1/Shopify/app/src/GraphQL/Enums/ShpfyGraphQLType.Enum.al
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,26 @@ enum 30111 "Shpfy GraphQL Type" implements "Shpfy IGraphQL"
Caption = 'Get Order Transactions';
Implementation = "Shpfy IGraphQL" = "Shpfy GQL OrderTransactions";
}
value(80; DraftOrderComplete)
{
Caption = 'Draft Order Complete';
Implementation = "Shpfy IGraphQL" = "Shpfy GQL DraftOrderComplete";
}
value(81; FulfillOrder)
{
Caption = 'Fulfill Order';
Implementation = "Shpfy IGraphQL" = "Shpfy GQL Fulfill Order";
}
value(82; GetPaymentTerms)
{
Caption = 'Get Payment Terms';
Implementation = "Shpfy IGraphQL" = "Shpfy GQL Payment Terms";
}
value(83; GetFulfillmentOrderIds)
{
Caption = 'Get Fulfillments';
Implementation = "Shpfy IGraphQL" = "Shpfy GQL Get Fulfillments";
}
value(85; ProductVariantDelete)
{
Caption = 'Product Variant Delete';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ codeunit 30199 "Shpfy Authentication Mgt."

var
// https://shopify.dev/api/usage/access-scopes
ScopeTxt: Label 'write_orders,read_all_orders,write_assigned_fulfillment_orders,read_checkouts,write_customers,read_discounts,write_files,write_merchant_managed_fulfillment_orders,write_fulfillments,write_inventory,read_locations,read_payment_terms,write_products,write_shipping,read_shopify_payments_disputes,read_shopify_payments_payouts,write_returns,write_translations,write_third_party_fulfillment_orders,write_order_edits,write_companies,write_publications,read_locales', Locked = true;
ScopeTxt: Label 'write_orders,read_all_orders,write_assigned_fulfillment_orders,read_checkouts,write_customers,read_discounts,write_files,write_merchant_managed_fulfillment_orders,write_fulfillments,write_inventory,read_locations,write_products,write_shipping,read_shopify_payments_disputes,read_shopify_payments_payouts,write_returns,write_translations,write_third_party_fulfillment_orders,write_order_edits,write_companies,write_publications,read_payment_terms,write_payment_terms,write_draft_orders,read_locales', Locked = true;
ShopifyAPIKeyAKVSecretNameLbl: Label 'ShopifyApiKey', Locked = true;
ShopifyAPISecretAKVSecretNameLbl: Label 'ShopifyApiSecret', Locked = true;
MissingAPIKeyTelemetryTxt: Label 'The api key has not been initialized.', Locked = true;
Expand Down
Loading
Loading