mock-events.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import { LanguageCode } from '@vendure/common/lib/generated-types';
  2. import {
  3. AccountRegistrationEvent,
  4. Channel,
  5. Customer,
  6. Order,
  7. OrderItem,
  8. OrderLine,
  9. OrderStateTransitionEvent, PasswordResetEvent,
  10. ProductVariant,
  11. RequestContext,
  12. User,
  13. } from '@vendure/core';
  14. export const mockOrderStateTransitionEvent = new OrderStateTransitionEvent(
  15. 'ArrangingPayment',
  16. 'PaymentSettled',
  17. {} as any,
  18. new Order({
  19. id: '6',
  20. createdAt: '2018-10-31T15:18:29.261Z',
  21. updatedAt: '2018-10-31T15:24:17.000Z',
  22. code: 'T3EPGJKTVZPBD6Z9',
  23. state: 'ArrangingPayment',
  24. active: true,
  25. customer: new Customer({
  26. id: '3',
  27. firstName: 'Test',
  28. lastName: 'Customer',
  29. emailAddress: 'test.customer@email.com',
  30. }),
  31. lines: [
  32. new OrderLine({
  33. id: '5',
  34. featuredAsset: {
  35. preview: 'http://localhost:3000/assets/mikkel-bech-748940-unsplash__49__preview.jpg',
  36. },
  37. productVariant: new ProductVariant({
  38. id: '3',
  39. name: 'en Intelligent Cotton Salad Small',
  40. sku: '5x7ss',
  41. }),
  42. items: [
  43. new OrderItem({
  44. id: '6',
  45. unitPrice: 745,
  46. unitPriceIncludesTax: false,
  47. taxRate: 20,
  48. pendingAdjustments: [],
  49. }),
  50. ],
  51. }),
  52. new OrderLine({
  53. id: '6',
  54. featuredAsset: {
  55. preview: 'http://localhost:3000/assets/mikkel-bech-748940-unsplash__49__preview.jpg',
  56. },
  57. productVariant: new ProductVariant({
  58. id: '4',
  59. name: 'en Intelligent Cotton Salad Large',
  60. sku: '5x7ss',
  61. }),
  62. items: [
  63. new OrderItem({
  64. id: '7',
  65. unitPrice: 745,
  66. unitPriceIncludesTax: false,
  67. taxRate: 20,
  68. pendingAdjustments: [],
  69. }),
  70. ],
  71. }),
  72. ],
  73. subTotal: 1788,
  74. subTotalBeforeTax: 1490,
  75. shipping: 1000,
  76. shippingMethod: {
  77. code: 'express-flat-rate',
  78. description: 'Express Shipping',
  79. id: '2',
  80. },
  81. shippingAddress: {
  82. fullName: 'Horacio Franecki',
  83. company: '',
  84. streetLine1: '6000 Pagac Land',
  85. streetLine2: '',
  86. city: 'Port Kirsten',
  87. province: 'Avon',
  88. postalCode: 'ZU32 9CP',
  89. country: 'Cabo Verde',
  90. phoneNumber: '',
  91. },
  92. payments: [],
  93. pendingAdjustments: [],
  94. }),
  95. );
  96. export const mockAccountRegistrationEvent = new AccountRegistrationEvent(
  97. {} as any,
  98. new User({
  99. verified: false,
  100. verificationToken: 'MjAxOC0xMS0xM1QxNToxNToxNC42ODda_US2U6UK1WZC7NDAX',
  101. identifier: 'test@test.com',
  102. }),
  103. );
  104. export const mockPasswordResetEvent = new PasswordResetEvent(
  105. {} as any,
  106. new User({
  107. identifier: 'test@test.com',
  108. passwordResetToken: 'MjAxOS0wNC0xNVQxMzozMDozOC43MjFa_MA2FR6HRZBW7JWD6',
  109. }),
  110. );