Skip to content

Commit

Permalink
Update usage of defaultTransactionFlowStrategy after migrating it to …
Browse files Browse the repository at this point in the history
…paymentSettings (#4282)
  • Loading branch information
poulch authored Oct 4, 2023
1 parent 2a202d4 commit a6a6152
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changeset/spotty-bananas-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Update usage of defaultTransactionFlowStrategy after migrating it to paymentSettings
2 changes: 2 additions & 0 deletions cypress/support/api/requests/Channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ export function updateChannelOrderSettings({
automaticallyFulfillNonShippableGiftCard
expireOrdersAfter
markAsPaidStrategy
}
paymentSettings {
defaultTransactionFlowStrategy
}
}
Expand Down
52 changes: 48 additions & 4 deletions introspection.json
Original file line number Diff line number Diff line change
Expand Up @@ -14113,6 +14113,22 @@
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "updatedAt",
"description": "The date and time when the category was last updated.\n\nAdded in Saleor 3.17.",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "DateTime",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
Expand Down Expand Up @@ -14685,6 +14701,18 @@
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "updatedAt",
"description": "Filter by when was the most recent update. \n\nAdded in Saleor 3.17.",
"type": {
"kind": "INPUT_OBJECT",
"name": "DateTimeRangeInput",
"ofType": null
},
"defaultValue": null,
"isDeprecated": false,
"deprecationReason": null
}
],
"interfaces": null,
Expand Down Expand Up @@ -61449,7 +61477,7 @@
},
{
"name": "shopDomainUpdate",
"description": "Updates site domain of the shop. \n\nRequires one of the following permissions: MANAGE_SETTINGS.",
"description": "Updates site domain of the shop.\n\nDEPRECATED: this mutation will be removed in Saleor 4.0. Use `PUBLIC_URL` environment variable instead. \n\nRequires one of the following permissions: MANAGE_SETTINGS.",
"args": [
{
"name": "input",
Expand All @@ -61469,8 +61497,8 @@
"name": "ShopDomainUpdate",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
"isDeprecated": true,
"deprecationReason": "\n\nDEPRECATED: this mutation will be removed in Saleor 4.0. Use `PUBLIC_URL` environment variable instead."
},
{
"name": "shopFetchTaxRates",
Expand Down Expand Up @@ -72989,6 +73017,22 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "undiscountedTotalPrice",
"description": "Price of the order line without discounts.",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "TaxedMoney",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "undiscountedUnitPrice",
"description": "Price of the single item in the order line without applied an order line discount.",
Expand Down Expand Up @@ -111188,7 +111232,7 @@
{
"kind": "OBJECT",
"name": "ShopDomainUpdate",
"description": "Updates site domain of the shop. \n\nRequires one of the following permissions: MANAGE_SETTINGS.",
"description": "Updates site domain of the shop.\n\nDEPRECATED: this mutation will be removed in Saleor 4.0. Use `PUBLIC_URL` environment variable instead. \n\nRequires one of the following permissions: MANAGE_SETTINGS.",
"fields": [
{
"name": "errors",
Expand Down
27 changes: 24 additions & 3 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3500,6 +3500,13 @@ type Category implements Node & ObjectWithMetadata {
"""A language code to return the translation for category."""
languageCode: LanguageCodeEnum!
): CategoryTranslation

"""
The date and time when the category was last updated.

Added in Saleor 3.17.
"""
updatedAt: DateTime!
}

"""
Expand Down Expand Up @@ -3603,6 +3610,13 @@ input CategoryFilterInput {
metadata: [MetadataFilter!]
search: String
slugs: [String!]

"""
Filter by when was the most recent update.

Added in Saleor 3.17.
"""
updatedAt: DateTimeRangeInput
}

input CategoryInput {
Expand Down Expand Up @@ -15484,14 +15498,16 @@ type Mutation {
): ShopAddressUpdate

"""
Updates site domain of the shop.
Updates site domain of the shop.

DEPRECATED: this mutation will be removed in Saleor 4.0. Use `PUBLIC_URL` environment variable instead.

Requires one of the following permissions: MANAGE_SETTINGS.
"""
shopDomainUpdate(
"""Fields required to update site."""
input: SiteDomainInput
): ShopDomainUpdate
): ShopDomainUpdate @deprecated(reason: "\n\nDEPRECATED: this mutation will be removed in Saleor 4.0. Use `PUBLIC_URL` environment variable instead.")

"""
Fetch tax rates.
Expand Down Expand Up @@ -18314,6 +18330,9 @@ type OrderLine implements Node & ObjectWithMetadata {
"""Variant name in the customer's language"""
translatedVariantName: String!

"""Price of the order line without discounts."""
undiscountedTotalPrice: TaxedMoney!

"""
Price of the single item in the order line without applied an order line discount.
"""
Expand Down Expand Up @@ -27919,7 +27938,9 @@ type ShopAddressUpdate {
}

"""
Updates site domain of the shop.
Updates site domain of the shop.

DEPRECATED: this mutation will be removed in Saleor 4.0. Use `PUBLIC_URL` environment variable instead.

Requires one of the following permissions: MANAGE_SETTINGS.
"""
Expand Down
40 changes: 32 additions & 8 deletions src/channels/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ export const channelsList: ChannelDetailsFragment[] = [
markAsPaidStrategy: MarkAsPaidStrategyEnum.TRANSACTION_FLOW,
deleteExpiredOrdersAfter: 60,
allowUnpaidOrders: false,
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
__typename: "OrderSettings",
},
paymentSettings: {
__typename: "PaymentSettings",
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
},
},
{
__typename: "Channel",
Expand Down Expand Up @@ -88,11 +91,14 @@ export const channelsList: ChannelDetailsFragment[] = [
],
orderSettings: {
markAsPaidStrategy: MarkAsPaidStrategyEnum.TRANSACTION_FLOW,
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
deleteExpiredOrdersAfter: 60,
allowUnpaidOrders: false,
__typename: "OrderSettings",
},
paymentSettings: {
__typename: "PaymentSettings",
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
},
},
{
__typename: "Channel",
Expand Down Expand Up @@ -125,11 +131,14 @@ export const channelsList: ChannelDetailsFragment[] = [
],
orderSettings: {
markAsPaidStrategy: MarkAsPaidStrategyEnum.TRANSACTION_FLOW,
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
deleteExpiredOrdersAfter: 60,
allowUnpaidOrders: false,
__typename: "OrderSettings",
},
paymentSettings: {
__typename: "PaymentSettings",
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
},
},
{
__typename: "Channel",
Expand Down Expand Up @@ -162,11 +171,14 @@ export const channelsList: ChannelDetailsFragment[] = [
],
orderSettings: {
markAsPaidStrategy: MarkAsPaidStrategyEnum.TRANSACTION_FLOW,
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
deleteExpiredOrdersAfter: 60,
allowUnpaidOrders: false,
__typename: "OrderSettings",
},
paymentSettings: {
__typename: "PaymentSettings",
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
},
},
{
__typename: "Channel",
Expand Down Expand Up @@ -199,11 +211,14 @@ export const channelsList: ChannelDetailsFragment[] = [
],
orderSettings: {
markAsPaidStrategy: MarkAsPaidStrategyEnum.TRANSACTION_FLOW,
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
deleteExpiredOrdersAfter: 60,
allowUnpaidOrders: false,
__typename: "OrderSettings",
},
paymentSettings: {
__typename: "PaymentSettings",
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
},
},
{
__typename: "Channel",
Expand Down Expand Up @@ -236,11 +251,14 @@ export const channelsList: ChannelDetailsFragment[] = [
],
orderSettings: {
markAsPaidStrategy: MarkAsPaidStrategyEnum.TRANSACTION_FLOW,
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
deleteExpiredOrdersAfter: 60,
allowUnpaidOrders: false,
__typename: "OrderSettings",
},
paymentSettings: {
__typename: "PaymentSettings",
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
},
},
{
__typename: "Channel",
Expand Down Expand Up @@ -273,11 +291,14 @@ export const channelsList: ChannelDetailsFragment[] = [
],
orderSettings: {
markAsPaidStrategy: MarkAsPaidStrategyEnum.TRANSACTION_FLOW,
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
deleteExpiredOrdersAfter: 60,
allowUnpaidOrders: false,
__typename: "OrderSettings",
},
paymentSettings: {
__typename: "PaymentSettings",
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
},
},
];

Expand Down Expand Up @@ -312,11 +333,14 @@ export const channel: ChannelDetailsFragment = {
],
orderSettings: {
markAsPaidStrategy: MarkAsPaidStrategyEnum.TRANSACTION_FLOW,
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
deleteExpiredOrdersAfter: 60,
allowUnpaidOrders: false,
__typename: "OrderSettings",
},
paymentSettings: {
__typename: "PaymentSettings",
defaultTransactionFlowStrategy: TransactionFlowStrategyEnum.CHARGE,
},
};

type ProductChannelsWithPricing = ProductFragment["channelListings"][0] & {
Expand Down
11 changes: 8 additions & 3 deletions src/channels/pages/ChannelDetailsPage/ChannelDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ const ChannelDetailsPage = function <TErrors extends ChannelErrorFragment[]>({

const countryChoices = mapCountriesToChoices(countries || []);

const { defaultCountry, stockSettings, orderSettings, ...formData } =
channel || ({} as ChannelDetailsFragment);
const {
defaultCountry,
stockSettings,
orderSettings,
paymentSettings,
...formData
} = channel || ({} as ChannelDetailsFragment);
const initialStockSettings: StockSettingsInput = {
allocationStrategy: AllocationStrategyEnum.PRIORITIZE_SORTING_ORDER,
...stockSettings,
Expand All @@ -132,7 +137,7 @@ const ChannelDetailsPage = function <TErrors extends ChannelErrorFragment[]>({
deleteExpiredOrdersAfter: orderSettings?.deleteExpiredOrdersAfter,
allowUnpaidOrders: orderSettings?.allowUnpaidOrders,
defaultTransactionFlowStrategy:
orderSettings?.defaultTransactionFlowStrategy,
paymentSettings?.defaultTransactionFlowStrategy,
};

const getFilteredShippingZonesChoices = (
Expand Down
4 changes: 3 additions & 1 deletion src/channels/views/ChannelDetails/ChannelDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,13 @@ export const ChannelDetails: React.FC<ChannelDetailsProps> = ({
stockSettings: {
allocationStrategy,
},
paymentSettings: {
defaultTransactionFlowStrategy,
},
orderSettings: {
markAsPaidStrategy,
deleteExpiredOrdersAfter,
allowUnpaidOrders,
defaultTransactionFlowStrategy,
},
},
},
Expand Down
2 changes: 2 additions & 0 deletions src/fragments/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export const channelDetailsFragment = gql`
markAsPaidStrategy
deleteExpiredOrdersAfter
allowUnpaidOrders
}
paymentSettings {
defaultTransactionFlowStrategy
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/graphql/hooks.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ export const ChannelDetailsFragmentDoc = gql`
markAsPaidStrategy
deleteExpiredOrdersAfter
allowUnpaidOrders
}
paymentSettings {
defaultTransactionFlowStrategy
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/graphql/typePolicies.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ export type CalculateTaxesFieldPolicy = {
taxBase?: FieldPolicy<any> | FieldReadFunction<any>,
version?: FieldPolicy<any> | FieldReadFunction<any>
};
export type CategoryKeySpecifier = ('ancestors' | 'backgroundImage' | 'children' | 'description' | 'descriptionJson' | 'id' | 'level' | 'metadata' | 'metafield' | 'metafields' | 'name' | 'parent' | 'privateMetadata' | 'privateMetafield' | 'privateMetafields' | 'products' | 'seoDescription' | 'seoTitle' | 'slug' | 'translation' | CategoryKeySpecifier)[];
export type CategoryKeySpecifier = ('ancestors' | 'backgroundImage' | 'children' | 'description' | 'descriptionJson' | 'id' | 'level' | 'metadata' | 'metafield' | 'metafields' | 'name' | 'parent' | 'privateMetadata' | 'privateMetafield' | 'privateMetafields' | 'products' | 'seoDescription' | 'seoTitle' | 'slug' | 'translation' | 'updatedAt' | CategoryKeySpecifier)[];
export type CategoryFieldPolicy = {
ancestors?: FieldPolicy<any> | FieldReadFunction<any>,
backgroundImage?: FieldPolicy<any> | FieldReadFunction<any>,
Expand All @@ -823,7 +823,8 @@ export type CategoryFieldPolicy = {
seoDescription?: FieldPolicy<any> | FieldReadFunction<any>,
seoTitle?: FieldPolicy<any> | FieldReadFunction<any>,
slug?: FieldPolicy<any> | FieldReadFunction<any>,
translation?: FieldPolicy<any> | FieldReadFunction<any>
translation?: FieldPolicy<any> | FieldReadFunction<any>,
updatedAt?: FieldPolicy<any> | FieldReadFunction<any>
};
export type CategoryBulkDeleteKeySpecifier = ('count' | 'errors' | 'productErrors' | CategoryBulkDeleteKeySpecifier)[];
export type CategoryBulkDeleteFieldPolicy = {
Expand Down Expand Up @@ -3334,7 +3335,7 @@ export type OrderGrantedRefundLineFieldPolicy = {
quantity?: FieldPolicy<any> | FieldReadFunction<any>,
reason?: FieldPolicy<any> | FieldReadFunction<any>
};
export type OrderLineKeySpecifier = ('allocations' | 'digitalContentUrl' | 'id' | 'isShippingRequired' | 'metadata' | 'metafield' | 'metafields' | 'privateMetadata' | 'privateMetafield' | 'privateMetafields' | 'productName' | 'productSku' | 'productVariantId' | 'quantity' | 'quantityFulfilled' | 'quantityToFulfill' | 'taxClass' | 'taxClassMetadata' | 'taxClassName' | 'taxClassPrivateMetadata' | 'taxRate' | 'thumbnail' | 'totalPrice' | 'translatedProductName' | 'translatedVariantName' | 'undiscountedUnitPrice' | 'unitDiscount' | 'unitDiscountReason' | 'unitDiscountType' | 'unitDiscountValue' | 'unitPrice' | 'variant' | 'variantName' | OrderLineKeySpecifier)[];
export type OrderLineKeySpecifier = ('allocations' | 'digitalContentUrl' | 'id' | 'isShippingRequired' | 'metadata' | 'metafield' | 'metafields' | 'privateMetadata' | 'privateMetafield' | 'privateMetafields' | 'productName' | 'productSku' | 'productVariantId' | 'quantity' | 'quantityFulfilled' | 'quantityToFulfill' | 'taxClass' | 'taxClassMetadata' | 'taxClassName' | 'taxClassPrivateMetadata' | 'taxRate' | 'thumbnail' | 'totalPrice' | 'translatedProductName' | 'translatedVariantName' | 'undiscountedTotalPrice' | 'undiscountedUnitPrice' | 'unitDiscount' | 'unitDiscountReason' | 'unitDiscountType' | 'unitDiscountValue' | 'unitPrice' | 'variant' | 'variantName' | OrderLineKeySpecifier)[];
export type OrderLineFieldPolicy = {
allocations?: FieldPolicy<any> | FieldReadFunction<any>,
digitalContentUrl?: FieldPolicy<any> | FieldReadFunction<any>,
Expand All @@ -3361,6 +3362,7 @@ export type OrderLineFieldPolicy = {
totalPrice?: FieldPolicy<any> | FieldReadFunction<any>,
translatedProductName?: FieldPolicy<any> | FieldReadFunction<any>,
translatedVariantName?: FieldPolicy<any> | FieldReadFunction<any>,
undiscountedTotalPrice?: FieldPolicy<any> | FieldReadFunction<any>,
undiscountedUnitPrice?: FieldPolicy<any> | FieldReadFunction<any>,
unitDiscount?: FieldPolicy<any> | FieldReadFunction<any>,
unitDiscountReason?: FieldPolicy<any> | FieldReadFunction<any>,
Expand Down
Loading

0 comments on commit a6a6152

Please sign in to comment.