saleor-apps-redis_apl/apps/taxes/src/mocks.ts

112 lines
2 KiB
TypeScript
Raw Normal View History

feat: change the flow from OrderCreated to OrderConfirmed (#826) * refactor: :recycle: extract order-metadata-manager * feat: :construction: add basic boilerplate * feat: :sparkles: add readExternalIdFromOrderMetadata * Revert "feat: :sparkles: add readExternalIdFromOrderMetadata" This reverts commit a78d9d4597672f8605cf998a9f784aebaab27de1. * feat: :sparkles: add order-cancelled avatax adapter * test: :white_check_mark: add tests for AvataxOrderCancelledPayloadTransformer * refactor: avataxId instead of externalId * refactor: :recycle: split up webhook response * build: :arrow_up: upgrade avatax * refactor: :recycle: extend logging in webhook response errors * fix: :bug: split privateMetadata and publicMetadata * fix: :bug: use "DEFAULT" value of companyCode for commit to work * fix: :alembic: fix voidTransaction type * refactor: :truck: order_created -> order_confirmed * fix: :bug: change voidReason * build: :construction_worker: add changeset * refactor: :fire: order_fulfilled webhook * feat: Avatax metadata tax calculation date (#843) * feat: :sparkles: add metadata tax calculation date * build: :construction_worker: add changeset * feat: Avatax metadata document code (#844) * feat: :sparkles: provide document code through metadata field * build: :construction_worker: add changeset * refactor: :recycle: fallback to default company code for migration * refactor: :recycle: patch order-created files and add deprecation note * Revert "refactor: :fire: order_fulfilled webhook" This reverts commit fd098642735ae9d62e3a876088226bd0f108afd6. * refactor: :recycle: patch order-fulfilled files and add deprecation note * fix: :bug: bring back deprecated webhooks to manifest * feat: :alembic: add AppWebhookMigrator (#850) * refactor: :truck: order_created -> order_confirmed * refactor: :fire: order_fulfilled webhook * feat: :alembic: add AppWebhookMigrator * feat: :sparkles: add mode to migrator * feat: :sparkles: add draft of run-report and migrateWebhook method * refactor: :recycle: address feedback * feat: :sparkles: add tests and new structure * refactor: :fire: util * feat: :sparkles: add enable/disable webhook rollback flow * refactor: :recycle: modify the taxes-migration flow * refactor: :recycle: generalize document code & date resolver * chore: :card_file_box: add run-migration * chore: :bulb: update comments about migration flow * fix: :bug: slice document code * refactor: :recycle: try/catch at the top level * chore: :bulb: add comments * Update shiny-meals-wait.md * Update soft-steaks-know.md * Update soft-steaks-know.md * fix: :white_check_mark: fix test * feat: :sparkles: change createTransaction to createOrAdjustTransaction this feature grants idempotency of the transaction flow * feat: :sparkles: add number field to OrderConfirmed payload * chore: :bulb: add deprecation comment to metadata method * docs: :memo: add todo comment to refactor sumPayloadLines * feat: :sparkles: add resolveStringOrThrow and use it for email * fix: :bug: add missing number to mock
2023-08-10 11:08:20 +00:00
import { OrderConfirmedSubscriptionFragment, OrderStatus } from "../generated/graphql";
refactor: refine taxjar (#494) * feat: :white_check_mark: add first tests & use address-factory * feat: :sparkles: add distributeDiscount * refactor: taxjar maps to adapters (#495) * refactor: :recycle: taxjar-calculate-taxes-map with taxjar-calculate-taxes-adapter * refactor: :recycle: taxjar-order-created-map -> taxjar-order-created-adapter * refactor: :recycle: address 1st batch of feedback * refactor: :recycle: split up taxjar-calculate-taxes-adapter * refactor: :truck: extract shipping transformer * docs: :bulb: add comment about refunds in distribute-discount * refactor: :truck: split up taxjar-order-created-adapter classes * refactor: :recycle: mocks with taxjar-mock-factory * refactor: :recycle: mocks with avatax-mock-factory * refactor: avatax maps to adapters (#506) * refactor: :recycle: move around & refactor avatax-order-created-map -> adapter * refactor: :truck: move avatax-order-created- to its own folder * refactor: :recycle: avatax-calculate-taxes-map -> adapter * refactor: :recycle: avatax-order-fulfilled-maps -> adapter * feat: :sparkles: add logger to adapters * refactor: :recycle: mocks -> avatax-mock-transaction-factory & fix tests * feat: add tests for taxjar (#509) * fix: :truck: tax-provider-utils.test name * feat: :white_check_mark: add nexus tests & other taxjar tests * feat: :goal_net: add ExpectedError and use it in webhook-response * refactor: :white_check_mark: unify taxjar-calculate-taxes tests with mock-generator * feat: :white_check_mark: add TaxJarOrderCreatedMockGenerator * feat: :white_check_mark: add avatax-calculate-taxes-mock-generator * feat: :white_check_mark: add AvataxOrderCreatedMockGenerator * refactor: :fire: tax-mock-factory * fix: :bug: housekeeping * fix: :bug: feedback * feat: :white_check_mark: add taxBase with discounts test * fix: :bug: address feedback * refactor: :fire: unused avatax-mock-factory functions * feat: :sparkles: use discount utils in all providers * feat: :sparkles: differentiate between pricesEnteredWithTax in taxjar
2023-05-29 08:35:34 +00:00
feat: change the flow from OrderCreated to OrderConfirmed (#826) * refactor: :recycle: extract order-metadata-manager * feat: :construction: add basic boilerplate * feat: :sparkles: add readExternalIdFromOrderMetadata * Revert "feat: :sparkles: add readExternalIdFromOrderMetadata" This reverts commit a78d9d4597672f8605cf998a9f784aebaab27de1. * feat: :sparkles: add order-cancelled avatax adapter * test: :white_check_mark: add tests for AvataxOrderCancelledPayloadTransformer * refactor: avataxId instead of externalId * refactor: :recycle: split up webhook response * build: :arrow_up: upgrade avatax * refactor: :recycle: extend logging in webhook response errors * fix: :bug: split privateMetadata and publicMetadata * fix: :bug: use "DEFAULT" value of companyCode for commit to work * fix: :alembic: fix voidTransaction type * refactor: :truck: order_created -> order_confirmed * fix: :bug: change voidReason * build: :construction_worker: add changeset * refactor: :fire: order_fulfilled webhook * feat: Avatax metadata tax calculation date (#843) * feat: :sparkles: add metadata tax calculation date * build: :construction_worker: add changeset * feat: Avatax metadata document code (#844) * feat: :sparkles: provide document code through metadata field * build: :construction_worker: add changeset * refactor: :recycle: fallback to default company code for migration * refactor: :recycle: patch order-created files and add deprecation note * Revert "refactor: :fire: order_fulfilled webhook" This reverts commit fd098642735ae9d62e3a876088226bd0f108afd6. * refactor: :recycle: patch order-fulfilled files and add deprecation note * fix: :bug: bring back deprecated webhooks to manifest * feat: :alembic: add AppWebhookMigrator (#850) * refactor: :truck: order_created -> order_confirmed * refactor: :fire: order_fulfilled webhook * feat: :alembic: add AppWebhookMigrator * feat: :sparkles: add mode to migrator * feat: :sparkles: add draft of run-report and migrateWebhook method * refactor: :recycle: address feedback * feat: :sparkles: add tests and new structure * refactor: :fire: util * feat: :sparkles: add enable/disable webhook rollback flow * refactor: :recycle: modify the taxes-migration flow * refactor: :recycle: generalize document code & date resolver * chore: :card_file_box: add run-migration * chore: :bulb: update comments about migration flow * fix: :bug: slice document code * refactor: :recycle: try/catch at the top level * chore: :bulb: add comments * Update shiny-meals-wait.md * Update soft-steaks-know.md * Update soft-steaks-know.md * fix: :white_check_mark: fix test * feat: :sparkles: change createTransaction to createOrAdjustTransaction this feature grants idempotency of the transaction flow * feat: :sparkles: add number field to OrderConfirmed payload * chore: :bulb: add deprecation comment to metadata method * docs: :memo: add todo comment to refactor sumPayloadLines * feat: :sparkles: add resolveStringOrThrow and use it for email * fix: :bug: add missing number to mock
2023-08-10 11:08:20 +00:00
export const defaultOrder: OrderConfirmedSubscriptionFragment = {
refactor: refine taxjar (#494) * feat: :white_check_mark: add first tests & use address-factory * feat: :sparkles: add distributeDiscount * refactor: taxjar maps to adapters (#495) * refactor: :recycle: taxjar-calculate-taxes-map with taxjar-calculate-taxes-adapter * refactor: :recycle: taxjar-order-created-map -> taxjar-order-created-adapter * refactor: :recycle: address 1st batch of feedback * refactor: :recycle: split up taxjar-calculate-taxes-adapter * refactor: :truck: extract shipping transformer * docs: :bulb: add comment about refunds in distribute-discount * refactor: :truck: split up taxjar-order-created-adapter classes * refactor: :recycle: mocks with taxjar-mock-factory * refactor: :recycle: mocks with avatax-mock-factory * refactor: avatax maps to adapters (#506) * refactor: :recycle: move around & refactor avatax-order-created-map -> adapter * refactor: :truck: move avatax-order-created- to its own folder * refactor: :recycle: avatax-calculate-taxes-map -> adapter * refactor: :recycle: avatax-order-fulfilled-maps -> adapter * feat: :sparkles: add logger to adapters * refactor: :recycle: mocks -> avatax-mock-transaction-factory & fix tests * feat: add tests for taxjar (#509) * fix: :truck: tax-provider-utils.test name * feat: :white_check_mark: add nexus tests & other taxjar tests * feat: :goal_net: add ExpectedError and use it in webhook-response * refactor: :white_check_mark: unify taxjar-calculate-taxes tests with mock-generator * feat: :white_check_mark: add TaxJarOrderCreatedMockGenerator * feat: :white_check_mark: add avatax-calculate-taxes-mock-generator * feat: :white_check_mark: add AvataxOrderCreatedMockGenerator * refactor: :fire: tax-mock-factory * fix: :bug: housekeeping * fix: :bug: feedback * feat: :white_check_mark: add taxBase with discounts test * fix: :bug: address feedback * refactor: :fire: unused avatax-mock-factory functions * feat: :sparkles: use discount utils in all providers * feat: :sparkles: differentiate between pricesEnteredWithTax in taxjar
2023-05-29 08:35:34 +00:00
id: "T3JkZXI6ZTUzZTBlM2MtMjk5Yi00OWYxLWIyZDItY2Q4NWExYTgxYjY2",
user: {
id: "VXNlcjoyMDg0NTEwNDEw",
email: "happy.customer@saleor.io",
},
feat: change the flow from OrderCreated to OrderConfirmed (#826) * refactor: :recycle: extract order-metadata-manager * feat: :construction: add basic boilerplate * feat: :sparkles: add readExternalIdFromOrderMetadata * Revert "feat: :sparkles: add readExternalIdFromOrderMetadata" This reverts commit a78d9d4597672f8605cf998a9f784aebaab27de1. * feat: :sparkles: add order-cancelled avatax adapter * test: :white_check_mark: add tests for AvataxOrderCancelledPayloadTransformer * refactor: avataxId instead of externalId * refactor: :recycle: split up webhook response * build: :arrow_up: upgrade avatax * refactor: :recycle: extend logging in webhook response errors * fix: :bug: split privateMetadata and publicMetadata * fix: :bug: use "DEFAULT" value of companyCode for commit to work * fix: :alembic: fix voidTransaction type * refactor: :truck: order_created -> order_confirmed * fix: :bug: change voidReason * build: :construction_worker: add changeset * refactor: :fire: order_fulfilled webhook * feat: Avatax metadata tax calculation date (#843) * feat: :sparkles: add metadata tax calculation date * build: :construction_worker: add changeset * feat: Avatax metadata document code (#844) * feat: :sparkles: provide document code through metadata field * build: :construction_worker: add changeset * refactor: :recycle: fallback to default company code for migration * refactor: :recycle: patch order-created files and add deprecation note * Revert "refactor: :fire: order_fulfilled webhook" This reverts commit fd098642735ae9d62e3a876088226bd0f108afd6. * refactor: :recycle: patch order-fulfilled files and add deprecation note * fix: :bug: bring back deprecated webhooks to manifest * feat: :alembic: add AppWebhookMigrator (#850) * refactor: :truck: order_created -> order_confirmed * refactor: :fire: order_fulfilled webhook * feat: :alembic: add AppWebhookMigrator * feat: :sparkles: add mode to migrator * feat: :sparkles: add draft of run-report and migrateWebhook method * refactor: :recycle: address feedback * feat: :sparkles: add tests and new structure * refactor: :fire: util * feat: :sparkles: add enable/disable webhook rollback flow * refactor: :recycle: modify the taxes-migration flow * refactor: :recycle: generalize document code & date resolver * chore: :card_file_box: add run-migration * chore: :bulb: update comments about migration flow * fix: :bug: slice document code * refactor: :recycle: try/catch at the top level * chore: :bulb: add comments * Update shiny-meals-wait.md * Update soft-steaks-know.md * Update soft-steaks-know.md * fix: :white_check_mark: fix test * feat: :sparkles: change createTransaction to createOrAdjustTransaction this feature grants idempotency of the transaction flow * feat: :sparkles: add number field to OrderConfirmed payload * chore: :bulb: add deprecation comment to metadata method * docs: :memo: add todo comment to refactor sumPayloadLines * feat: :sparkles: add resolveStringOrThrow and use it for email * fix: :bug: add missing number to mock
2023-08-10 11:08:20 +00:00
number: "1234",
avataxEntityCode: null,
refactor: refine taxjar (#494) * feat: :white_check_mark: add first tests & use address-factory * feat: :sparkles: add distributeDiscount * refactor: taxjar maps to adapters (#495) * refactor: :recycle: taxjar-calculate-taxes-map with taxjar-calculate-taxes-adapter * refactor: :recycle: taxjar-order-created-map -> taxjar-order-created-adapter * refactor: :recycle: address 1st batch of feedback * refactor: :recycle: split up taxjar-calculate-taxes-adapter * refactor: :truck: extract shipping transformer * docs: :bulb: add comment about refunds in distribute-discount * refactor: :truck: split up taxjar-order-created-adapter classes * refactor: :recycle: mocks with taxjar-mock-factory * refactor: :recycle: mocks with avatax-mock-factory * refactor: avatax maps to adapters (#506) * refactor: :recycle: move around & refactor avatax-order-created-map -> adapter * refactor: :truck: move avatax-order-created- to its own folder * refactor: :recycle: avatax-calculate-taxes-map -> adapter * refactor: :recycle: avatax-order-fulfilled-maps -> adapter * feat: :sparkles: add logger to adapters * refactor: :recycle: mocks -> avatax-mock-transaction-factory & fix tests * feat: add tests for taxjar (#509) * fix: :truck: tax-provider-utils.test name * feat: :white_check_mark: add nexus tests & other taxjar tests * feat: :goal_net: add ExpectedError and use it in webhook-response * refactor: :white_check_mark: unify taxjar-calculate-taxes tests with mock-generator * feat: :white_check_mark: add TaxJarOrderCreatedMockGenerator * feat: :white_check_mark: add avatax-calculate-taxes-mock-generator * feat: :white_check_mark: add AvataxOrderCreatedMockGenerator * refactor: :fire: tax-mock-factory * fix: :bug: housekeeping * fix: :bug: feedback * feat: :white_check_mark: add taxBase with discounts test * fix: :bug: address feedback * refactor: :fire: unused avatax-mock-factory functions * feat: :sparkles: use discount utils in all providers * feat: :sparkles: differentiate between pricesEnteredWithTax in taxjar
2023-05-29 08:35:34 +00:00
created: "2023-05-25T09:18:55.203440+00:00",
status: OrderStatus.Unfulfilled,
channel: {
id: "Q2hhbm5lbDox",
slug: "default-channel",
},
shippingAddress: {
streetAddress1: "600 Montgomery St",
streetAddress2: "",
city: "SAN FRANCISCO",
countryArea: "CA",
postalCode: "94111",
country: {
code: "US",
},
},
billingAddress: {
streetAddress1: "600 Montgomery St",
streetAddress2: "",
city: "SAN FRANCISCO",
countryArea: "CA",
postalCode: "94111",
country: {
code: "US",
},
},
total: {
currency: "USD",
net: {
amount: 239.17,
},
tax: {
amount: 15.54,
},
},
shippingPrice: {
gross: {
amount: 59.17,
},
net: {
amount: 59.17,
},
},
lines: [
{
productSku: "328223580",
productName: "Monospace Tee",
quantity: 3,
unitPrice: {
net: {
amount: 20,
},
},
totalPrice: {
net: {
amount: 60,
},
tax: {
amount: 5.18,
},
},
},
{
productSku: "328223581",
productName: "Monospace Tee",
quantity: 1,
unitPrice: {
net: {
amount: 20,
},
},
totalPrice: {
net: {
amount: 20,
},
tax: {
amount: 1.73,
},
},
},
{
productSku: "118223581",
productName: "Paul's Balance 420",
quantity: 2,
unitPrice: {
net: {
amount: 50,
},
},
totalPrice: {
net: {
amount: 100,
},
tax: {
amount: 8.63,
},
},
},
],
discounts: [],
};