Граф коммитов

26 Коммитов

Автор SHA1 Сообщение Дата
Reino Muhl 2455e4d5dc
feat(carts): add eligibilityStatus to cart db
Because:

* Cart needs eligibility status of current cart.

This commit:

* Add new field, eligibilityStatus, to cart db as Enum
* Add CartEligibilityStatus enum to kysely types

Closes #FXA-9472
2024-04-19 11:00:44 -04:00
Reino Muhl 7f3d030e8b
feat(next): add handle stripe error action
Because:

* Need a server action to handle errors returned from Stripe elements
  submit function.

This commit:

* Creates handleStripeError action and related Nextjs Action Service
* Adds checkoutErrorCart to Cart Service
* Add cart.utils
* Add tests for cart.utils and checkoutErrorCart

Closes #FXA-8851
2024-04-18 16:16:58 -04:00
Reino Muhl 1af436e8fe
Rename geodb to GeoDB 2024-04-15 12:49:46 -04:00
Reino Muhl 061f09864a
Rebase and refactor to nestjsActionsService 2024-04-15 12:49:36 -04:00
Reino Muhl c595afe4f3
feat(next): create setupCart server action
Because:

* Call CartService.setupCart from payments-next via server action.

This commit:

* Extracts fxa-geodb into libs/* library
* Updates CartService to include GeodbManager
* Call setupCart from payments-next

Closes #FXA-8892
2024-04-15 12:48:35 -04:00
Julian Poyourow 67f81ae927
feat(payments-ui): add class-validator and class-transformer to actions
Because:

* We need validation for the input to our actions. We also use
  class-validator and class-transformer elsewhere, and although I'm not
  the most fond of this syntax/setup vs something like zod, we don't
  have zod as a dependency at the moment.

This commit:

* Adds class-validator and class-transformer as well as validations for
  each for the getCart and updateCart actions
2024-04-10 00:04:44 -07:00
Reino Muhl 268a9e357a
feat(cart): add stripe customer id on cart setup
Because:

* On cart setup, add stripe customer id, if it exists, to the cart.

This commit:

* Adds method to AccountCustomerManager to get stripe customer id or
  return null.
* Adds AccountCustomerManager to CartService and fetches stripe customer
  id.
* Splits unit and integration tests for the payments-cart library

Closes #FXA-8898
2024-04-09 16:20:52 -04:00
Julian Poyourow 473ba056bb
feat(paypal): Add paypal repository
Because:

* We want to be able to interact with the paypalCustomer table from the
  new libs structure

This commit:

* Adds a paypalCustomer repository

Closes FXA-8888
2024-03-19 09:17:01 -07:00
Reino Muhl 2df7ca494a
chore(nx): upgrade to nx 18
Because:

* Want to migrate Nx to latest

This commit:

* Migrate nx to 18 using nx cli migrate latest
* Readd a few dev dependancies back into packages/**/package.json
  * Behavior of `npx nx...` commands seems to have changed, resulting in
    multiple "command not found: <library>" errors, where <library>
    refers to libaries used in packages/**/package.json scripts, such as
    tailwindcss, tsc-alias, nx, etc.
* Updates nx cache location for Circle CI

Closes #FXA-8880
2024-02-12 09:01:00 -05:00
Reino Muhl 70ebacc772
fix(nx): remove nx prject rootDir and main changes
Because:

* Manual changes were needed to all nx libraries to ensure expected
  TypeScript build and development intellisense behavior.

This commit:

* Removes the "rootDir" build option added to all libraries, to allow
  for relative paths. This is no longer necessary since issues using
  TypeScript path aliases have been resolved.
* Removes changes to "main" build option, which ensured the built
  version of package.json had the correct path to the main index.js.

Closes #
2023-10-16 13:32:53 -04:00
Ben Bangert e97fd383b8
feat: add nestJS service loading to payments-next
Because:

* We want to be able to call server-side logic with our business classes
  directly from the nextJS app before rendering on the server.

This pull request:

* Adds a NestJS application context to the NextJS app that can be used
  to load services and call methods on them.
2023-09-14 09:45:37 -07:00
Julian Poyourow adce4cfec1
feat(cart): add cart service skeleton
Because:

* We need a starter for a cart service as described in FXA-8130

This commit:

* Adds a skeleton for a cart service with the methods described in
  FXA-8130

Closes FXA-8130

Co-authored-by: Ben Bangert <100193+bbangert@users.noreply.github.com>
2023-09-12 14:23:58 -07:00
Reino Muhl 3894a65527
feat(next): payments-next initial work
Because:

* Create the initial work for the Checkout page as a starting point and
  example for the rest of the SP3 components and pages.

This commit:

* Adds the payments/next/ui Next.js library.
* Move Header JSX into layout.tsx and remove ExampleHeader component.
* Add RSC PurchaseDetails, using JSX from SP2.5 PlanDetails component.
* Add RSC TermsAndPrivacy component
* Add various stubs functions for illustration purposes. These will be
  replaced with actual implementations in future tickets.
  * Cart fetch
  * Contentful fetch
  * Translation using @fluent/bundle

Closes FXA-8133
2023-09-12 14:24:39 -04:00
dschom d96797ae6a
task(CI): Improve nx caching for CI pipelines
Because:
- Not all CI operations where taking advantage of NX caches

This Commit:
- Adjusts nx.json config to ensure correct caching behavior
- Adjusts nx.json config to ensure proper target chains. ie build is dependent on pre-build
- Uses nx to directly run integration tests
- Uses nx to directly run unit tests
- Phases out dependency on generated .list files
- Ensures 'start up' for services for functional tests is done with nx and uses nx caches.
- Creates nx tags to facilitate test commands
- Fixes linter errors encountered
- Updates docker images to nx for builds
- Updates nx ignore files
2023-08-29 11:19:54 -07:00
Julian Poyourow 5b6060df51
chore(libs): add injectable to all library classes, centralize nest
Because:

* We want to easily be able to consume library classes within NestJS.
Adding the injectable decorator to all library classes means we can do
so with ease, but also doesn't prevent us from using the class outside
of the NestJS DI system.
* We want all dependencies (such as nest) centralized to the main
package.json

This commit:

* Adds the injectable decorator to every library class.
* Centralizes the NestJS dependency to the root package.json.

Closes: no relevant issue - polish PR.
2023-08-28 11:54:12 -07:00
Ben Bangert 832347e64c
refactor: switch to kysley cart manager
Because:

* We want to try out kysley for all db operations including the cart
  manager.

This commit:

* Switches the cart manager to use kysley.
2023-08-19 19:07:46 -07:00
Reino Muhl 9c1afee646
feat(carts): refactor cart manager to match layers
Because:
- Refactor the Cart Manager to serve as higher level logic for the
  cart db model.

This commit:
- Removes service level logic.
- Adds common methods to be used by Cart Manager consumers.
- Adds checks for valid state by action and valid state transitions.
- Reverts playwright tests back to xlarge instance size

Closes FXA-8128
2023-08-15 18:03:36 -04:00
Reino Muhl f8e2a53bbb
Merge pull request #15666 from mozilla/fxa-8132-cart-add-version
feat(carts): Add version to carts table
2023-08-10 15:08:36 -04:00
Reino Muhl e2ecdbd46b
Merge pull request #15662 from mozilla/fxa-8119-ts-paths-alias-imports
feat(libs): allow packagename-based imports
2023-08-08 16:52:30 -04:00
Reino Muhl 633e5dca05
feat(carts): Add version to carts table
Because:
- Allow for optimistic locking for the carts table

This commit:
- Adds migrations to add version field to carts table.
- Updates patchById with version logic
- Updates cart model and test scripts

Closes FXA-8132
2023-08-08 13:49:54 -04:00
Reino Muhl 26537a484e
feat(libs): allow packagename-based imports
Because:
- we want to be able to use packagename based imports, defined in
  tsconfig.base.json paths, throughout the repo.

This commit:
- Adds a workaround fix to libs/**/project.json > main properties to
  ensure that the built dist/libs/**/.package.json has the correct
  main property.
- Upgrades esbuild-register to latest version, which includes
  tsconfig path resolution.
- Adds tsconfig-paths to auth-server mocha based tests.
- Adds various workarounds to fxa-graphql-api including the following
  - Adds paths from `tsconfig.base.json` to `tsconfig.build.json`
    excluding the extension.
  - Add pathToModuleNameMapper to all jest*.config.js
  - Add build step before tests are run
2023-08-07 14:01:05 -04:00
Dan Schomburg 5571e80284
Merge pull request #15656 from mozilla/change-test-target-for-nx-projects
task(many): Switch nx test target to be test-unit
2023-08-04 10:00:20 -07:00
dschom 535498214a
task(many): Switch nx test target to be test-unit
Because:
- The CI already targets test-unit
- We want to draw a distinction between unit and integration tests.

This Commit:
- Renames "test" to "test-unit" in lib packages.
- Sets up CI to run integration tests on 'libs' folder packages
- Adds tags to nx projects in libs folder
2023-08-03 15:38:16 -07:00
Reino Muhl 1b9cbff619
feat(payments): cart manager cleanup
Because:

* Some items were identified not to meet code organization standards
  the team is implementing with Nx.
* Nx identified some circular dependencies that need resolving.

This commit:

* Resolves circular dependencies.
* More to do
2023-08-03 16:28:48 -04:00
Ben Bangert 62cedecbac
fix: remove circular dependency between account and core
Because:

* The circular dependency between account and core was causing
  problems with the build.

This commit:

* Moves the setup function from core to account.
2023-08-01 18:50:51 -07:00
Reino Muhl 868a723be6
feat(payments): add cart library and factories
Because:

* Need a library to handle the cart db table and related functions

This commit:

* Add cart DB model
* Initializes the Cart library and creates factories and types
* Adds CartManager library
* Adds Cart related resolvers with basic Cart DB queries

Closes: #FXA-7508 #FXA-7505
2023-08-01 14:42:42 -04:00