Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. // Force to use a certain Guid generation function
  2. type BankAccountId = BankAccountId of Guid
  3.  
  4. // Force to have positive values via a constructor function
  5. type Money = private Money of decimal
  6.  
  7.  
  8. type PersonalName = {
  9. FirstName: string;
  10. MiddleInitial: string option;
  11. LastName: string;
  12. }
  13.  
  14. type AccountInitialization = {
  15. Owner: PersonalName
  16. }
  17.  
  18. type CashDeposit = {
  19. AccountId: BankAccountId
  20. Amount: Money
  21. }
  22.  
  23. type CashWithdrawal = {
  24. AccountId: BankAccountId
  25. Amount: Money
  26. }
  27.  
  28. type Command =
  29. | InitializeAccount of AccountInitialization
  30. | WireMoney of AccountTransaction
  31. | DepositCash of CashDeposit
  32. | WithdrawCash of CashWithdrawal
  33.  
  34. type AccountInitialized = {
  35. Owner: PersonalName
  36. AccountId: BankAccountId
  37. }
  38.  
  39. type AccountDebited = {
  40. Amount: Money
  41. From: BankAccountId
  42. To: BankAccountId
  43. }
  44.  
  45. type AccountCredited = {
  46. Amount: Money
  47. From: BankAccountId
  48. To: BankAccountId
  49. }
  50.  
  51. type CashDeposited = {
  52. AccountId: BankAccountId
  53. Amount: Money
  54. }
  55.  
  56. type CashWithdrawn = {
  57. AccountId: BankAccountId
  58. Amount: Money
  59. }
  60.  
  61. type InvalidOperationAttempted = {
  62. AccountId: BankAccountId
  63.  
  64. }
  65.  
  66. type Event =
  67. | AccountInitialized of AccountInitialized
  68. | AccountCredited of AccountCredited
  69. | AccountDebited of AccountDebited
  70. | CashDeposited of CashDeposited
  71. | CashWithdrawn of CashWithdrawn
  72. | InvalidOperationAttempted
  73.  
  74. type CashWithdrawn = {
  75. AccountId: BankAccountId
  76. Amount: Money
  77. }
  78.  
  79. type CashDeposited = {
  80. AccountId: BankAccountId
  81. Amount: Money
  82. }
  83.  
  84. type CashDeposit = {
  85. AccountId: BankAccountId
  86. Amount: Money
  87. }
  88.  
  89. type CashWithdrawal = {
  90. AccountId: BankAccountId
  91. Amount: Money
  92. }
  93.  
  94. type CashOperation = {
  95. AccountId: BankAccountId
  96. Amount: Money
  97. }
  98.  
  99. type CashOperationOccured = {
  100. AccountId: BankAccountId
  101. Amount: Money
  102. }
  103.  
  104. type CashOperation = {
  105. AccountId: BankAccountId
  106. Amount: Money
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement