@@ -33,8 +33,9 @@ data Config = Config { login :: Text
3333instance FromJSON Config
3434
3535data Command = AuthSale CreditCard Centi
36− | VoidSale SaleGuid
37− | CaptureSale SaleGuid
36+ | VoidAuth AuthOnlyGuid
37+ | VoidSale SaleGuid (Maybe Centi)
38+ | CaptureSale AuthOnlyGuid
3839 | CancelSale SaleGuid
3940 | ReturnSale SaleGuid (Maybe Centi)
4041 | TestAuth
@@ -47,7 +48,8 @@ cmdParser :: Parser CmdLine
4748cmdParser = CmdLine <$> strOption (short 'c' <> metavar "FILE" <> help "Configuration file path")
4849 <*> subparser operation
4950 where operation = command "auth" (info (AuthSale <$> cc <*> amt) (progDesc "Authorise payment"))
50− <> command "void" (info (VoidSale <$> guid) (progDesc "Void payment"))
51+ <> command "void-auth" (info (VoidAuth <$> guid) (progDesc "Void payment"))
52+ <> command "void-sale" (info (VoidSale <$> guid <*> optional amt) (progDesc "Void payment"))
5153 <> command "capture" (info (CaptureSale <$> guid) (progDesc "Capture payment"))
5254 <> command "cancel" (info (CancelSale <$> guid) (progDesc "Cancel payment"))
5355 <> command "return" (info (ReturnSale <$> guid <*> optional amt) (progDesc "return payment"))
@@ -84,7 +86,8 @@ doThing (AuthSale cc amt) = liftIO . print =<< authorisePayment cc usd pnr vendo
8486 where usd = Money amt
8587 pnr = Just "PNRPNR"
8688 vendor = Just "Typeable payment"
87−doThing (VoidSale guid) = liftIO . print =<< voidPayment guid Nothing
89+doThing (VoidAuth guid) = liftIO . print =<< voidPayment (VoidAuthorized guid)
90+doThing (VoidSale guid amt) = liftIO . print =<< voidPayment (VoidCaptured guid (Money <$> amt))
8891doThing (CaptureSale guid) = liftIO . print =<< capturePayment guid
8992doThing (CancelSale guid) = liftIO . print =<< cancelPayment guid
9093doThing (ReturnSale guid amt) = liftIO . print =<< returnPayment guid (Money <$> amt)