invoice.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import {OrganizationFixture} from 'sentry-fixture/organization';
  2. import {SubscriptionFixture} from 'getsentry-test/fixtures/subscription';
  3. import type {Organization as TOrganization} from 'sentry/types/organization';
  4. import type {Invoice as TInvoice} from 'getsentry/types';
  5. export function InvoiceFixture(
  6. params: Partial<TInvoice> = {},
  7. organization?: TOrganization
  8. ): TInvoice {
  9. const mockOrg = OrganizationFixture();
  10. return {
  11. amount: 0,
  12. amountBilled: 0,
  13. amountRefunded: 0,
  14. channel: 'self-serve',
  15. chargeAttempts: 1,
  16. creditApplied: null,
  17. dateCreated: '2018-06-25T22:33:38.042Z',
  18. id: '1a2c3b4d5e6f',
  19. isClosed: true,
  20. isPaid: true,
  21. isRefunded: false,
  22. nextChargeAttempt: null,
  23. sender: {
  24. name: 'Sentry',
  25. address: ['The internet'],
  26. },
  27. receipt: {
  28. url: `https://sentry.io/organizations/${mockOrg.slug}/payments/1a2b/pdf/3c4d/`,
  29. },
  30. stripeInvoiceID: null,
  31. type: 'credit card',
  32. customer: SubscriptionFixture({organization: organization ?? mockOrg}),
  33. items: [],
  34. charges: [],
  35. addressLine1: null,
  36. addressLine2: null,
  37. city: null,
  38. countryCode: null,
  39. postalCode: null,
  40. region: null,
  41. displayAddress: null,
  42. sentryTaxIds: null,
  43. taxNumber: null,
  44. defaultTaxName: null,
  45. effectiveAt: null,
  46. isReverseCharge: false,
  47. periodEnd: null,
  48. periodStart: null,
  49. ...params,
  50. };
  51. }