WIP

[?]
Feb 6, 2021, 4:00 AM
3PFXXJTLLGDWIFVI32VDUSVGGQL73F6KBACLD2GGJO2AAIS4VPJAC

Dependencies

  • [2] YBLHJFCN Implement billing modal.
  • [3] VTZT2ILU Wire up billing navigation.
  • [4] N6FG4EW6 Working bootstrap modal! Only a little FFI.
  • [5] T2DN23M7 Factor out billing create component.
  • [6] 3HTCTHHU Add halogen-portal dependency and update argonaut.
  • [7] ANDJ6GEY Add billing component skeleton.
  • [8] 27H4DECZ Add billing create API call.

Change contents

  • replacement in client/src/Aftok/Api/Billing.purs at line 21
    [3.704][2.108:142]()
    import Data.Time.Duration (Hours)
    [3.704]
    [3.315]
    import Data.Time.Duration (Hours(..), Days(..))
  • edit in client/src/Aftok/Api/Billing.purs at line 55
    [3.1440]
    [3.1440]
    parseBillableIdJSON :: String -> Either JsonDecodeError BillableId
    parseBillableIdJSON uuidStr =
    BillableId <$> note (TypeMismatch"Failed to decode billable UUID") (parseUUID uuidStr)
  • replacement in client/src/Aftok/Api/Billing.purs at line 62
    [2.170][2.170:205](),[2.205][3.685:776](),[3.1555][3.685:776]()
    uuidStr <- obj .: "billableId"
    BillableId <$> note (TypeMismatch"Failed to decode billable UUID") (parseUUID uuidStr)
    [2.170]
    [3.327]
    parseBillableIdJSON =<< obj .: "billableId"
  • replacement in client/src/Aftok/Api/Billing.purs at line 83
    [3.497][3.337:362]()
    , gracePeriod :: Hours
    [3.497]
    [3.362]
    , gracePeriod :: Days
  • edit in client/src/Aftok/Api/Billing.purs at line 96
    [3.1023]
    [2.249]
    -- API requires grace period as days
  • replacement in client/src/Aftok/Api/Billing.purs at line 98
    [2.287][2.287:334]()
    , requestExpiryPeriod: unwrap b.expiryPeriod
    [2.287]
    [3.1023]
    -- API requires expiry period as seconds
    , requestExpiryPeriod: unwrap b.expiryPeriod * 60.0 * 60.0
  • edit in client/src/Aftok/Api/Billing.purs at line 102
    [3.1028]
    [3.1710]
    -- parseBillableJSON :: Object Json -> Either JsonDecodeError (Tuple BillableId Billable)
    -- parseBillableJSON obj = do
    -- billableId <- parseBillableIdJSON =<< obj .: "billableId"
    -- bobj <- obj .: "billable"
    -- amount <-
    -- Zatoshi <$> (note (TypeMismatch "Failed to decode as Zatoshi") <<< BigInt.fromNumber)
    -- =<< (_ .: "zatoshi")
    -- =<< (bobj .: "amount")
    -- gracePeriod <- Hours <$> bobj .: "gracePeriod"
    -- recurrence <- parseRecurrence =<< bobj .: "recurrence"
  • edit in client/src/Aftok/Api/Billing.purs at line 113
    [3.1711]
    [3.1711]
  • replacement in client/src/Aftok/Billing/Create.purs at line 16
    [2.659][3.727:765](),[3.727][3.727:765]()
    import Data.Time.Duration (Hours(..))
    [2.659]
    [2.660]
    import Data.Time.Duration (Hours(..), Days(..))
  • replacement in client/src/Aftok/Billing/Create.purs at line 69
    [2.1198][3.1686:1717](),[3.1686][3.1686:1717]()
    , gracePeriod :: Maybe Hours
    [2.1198]
    [3.1717]
    , gracePeriod :: Maybe Days
  • replacement in client/src/Aftok/Billing/Create.purs at line 254
    [2.5287][2.5287:5337]()
    [ HH.text "Grace Period (Hours)" ]
    [2.5287]
    [2.5337]
    [ HH.text "Grace Period (Days)" ]
  • replacement in client/src/Aftok/Billing/Create.purs at line 260
    [2.5557][2.5557:5630]()
    , P.placeholder "Hours until a bill is considered overdue"
    [2.5557]
    [2.5630]
    , P.placeholder "Days until a bill is considered overdue"
  • replacement in client/src/Aftok/Billing/Create.purs at line 337
    [2.8654][2.8654:8726]()
    (Just n) -> H.modify_ (_ { gracePeriod = Just (Hours n) })
    [2.8654]
    [2.8726]
    (Just n) -> H.modify_ (_ { gracePeriod = Just (Days n) })
  • edit in client/src/Aftok/Billing/Create.purs at line 379
    [2.10581][2.10581:10625]()
    lift $ system.log "BILLABLE OK"