@@ -35,6 +35,7 @@ instance FromJSON Config
3535data Command = AuthSale CreditCard Centi
3636 | VoidSale SaleGuid
3737 | CaptureSale SaleGuid
38+ | CancelSale SaleGuid
3839 | TestAuth
3940
4041data CmdLine = CmdLine { configPath :: FilePath
@@ -46,7 +47,8 @@ cmdParser = CmdLine <$> strOption (short 'c' <> metavar "FILE" <> help "Configur
4647 <*> subparser operation
4748 where operation = command "auth" (info (AuthSale <$> cc <*> amt) (progDesc "Authorise payment"))
4849 <> command "void" (info (VoidSale <$> guid) (progDesc "Void payment"))
49− <> command "capture" (info (CaptureSale <$> guid) (progDesc "Void payment"))
50+ <> command "capture" (info (CaptureSale <$> guid) (progDesc "Capture payment"))
51+ <> command "cancel" (info (CancelSale <$> guid) (progDesc "Cancel payment"))
5052 <> command "test-auth" (info (pure TestAuth) (progDesc "Test token authorisation"))
5153 amt = argument auto (metavar "Payment amount")
5254 cc = CreditCard <$> argument str mempty
@@ -79,7 +81,8 @@ doThing :: Command -> ConnexpayM ()
7981doThing (AuthSale cc amt) = liftIO . print =<< authorisePayment cc usd pnr vendor
8082 where usd = Money amt
8183 pnr = Just "PNRPNR"
82− vendor = Just "Typeable"
84+ vendor = Just "Typeable payment"
8385doThing (VoidSale guid) = liftIO . print =<< voidPayment guid Nothing
8486doThing (CaptureSale guid) = liftIO . print =<< capturePayment guid
87+doThing (CancelSale guid) = liftIO . print =<< cancelPayment guid
8588doThing TestAuth = liftIO (forever yield)