Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor transaction handling #1004

Merged
merged 12 commits into from
Jan 31, 2019
Merged

Refactor transaction handling #1004

merged 12 commits into from
Jan 31, 2019

Conversation

Gnito
Copy link
Contributor

@Gnito Gnito commented Jan 18, 2019

Changing a transaction process is currently quite hard. In this PR, we try to make it easier to track what needs to be checked when transaction process changes from the default one ('preauth-with-nightly-booking/release-1').

After this PR, there are 8 components that require file: src/util/transaction.js:

  • components/ActivityFeed
  • components/BookingBreakdown
  • components/TransactionPanel
  • forms/BookingDatesForm
  • containers/CheckoutPage
  • containers/InboxPage
  • containers/ListingPage
  • containers/TransactionPage

However, it should be much easier to track all the places which are tied to transaction process. Just make search for imports from transaction.js: from '../../util/transaction'.


Note: if you are taking an update from upstream: biggest code changes are made to

  • util/types.js
  • TransactionPanel
    • TransactionPanel is split to subcomponents
    • TransactionPanel.helpers.js is removed
  • InboxPage
    • Transition related CSS classes are renamed
    • Some new tx utility functions are used
    • InboxPage.duck.js fetches only transactions which have known last transitions.
      (i.e. if transition process is changed from default, TRANSITIONS list should be updated.)
  • ActivityFeed
    • Transition rendering is stream lined a bit to work with new utility functions.
  • Couple of utility funtions are renamed or removed:
    • txIsCompleted -> txIsDelivered
    • txIsDeclinedOrExpired -> txIsDeclined (both transitions lead to declined state)
    • txIsExpired (This is not used and there is no "expired" state in default process.)

Note 2: Most of the changed lines are about changed test-snapshots in TransactionPanel... There are 2381 lines of additions + deletions. So, something like 1000 lines of changed code (imports, renaming, and code splitted to subcomponents).

@Gnito Gnito force-pushed the refactor-transaction-ui branch 5 times, most recently from 4ddff44 to f65b9c5 Compare January 22, 2019 20:07
@Gnito Gnito changed the title Refactor transaction ui Refactor transaction handling Jan 22, 2019
@Gnito Gnito removed the in progress label Jan 28, 2019
Gnito and others added 7 commits January 30, 2019 14:20
and reduce direct state check agains current transaction.
use txHasBeenDelivered function,
rename css classes,
add txIsRequested check and handle unknown transition separately,
filter unknown transitions when fetching data,
don't render InboxItem if latest transition is unknown,
update InboxPage tests.
Gnito and others added 4 commits January 30, 2019 18:31
Add function for checking ownRole
Use txHasReviewBy function
add isCustomerReview and isProviderReview functions
(and move some generic in-file functions there).
@Gnito Gnito merged commit a270b95 into master Jan 31, 2019
@Gnito Gnito deleted the refactor-transaction-ui branch January 31, 2019 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants