git.iko.soy/typeable/connexpay
on master help sign in
Allow adding invoice number.
commit44b31812404e2fb8ccd95e50471aa3d4c460d4a7 authorNick <nick@typeable.io> dateTue 30 Apr 2024, 17:21 (2 years ago) parent72832ae
2 files changed+5−2
connexpay/src/Tool.hs+1−1 connexpay/src/Web/Connexpay/Payments.hs+4−1
connexpay/src/Tool.hs+1−1
@@ -75,7 +75,7 @@ main = do cmdLine <- execParser (info cmdParser mempty)
7575 Right cpi -> print =<< runConnexpay cpi (doThing cmdLine.operation)
7676
7777doThing :: Command -> ConnexpayM ()
78−doThing (AuthSale cc amt) = liftIO . print =<< authorisePayment cc usd Nothing
78+doThing (AuthSale cc amt) = liftIO . print =<< authorisePayment cc usd Nothing Nothing
7979 where usd = Money amt
8080doThing (VoidSale guid) = liftIO . print =<< voidPayment guid Nothing
8181doThing (CaptureSale guid) = liftIO . print =<< capturePayment guid
connexpay/src/Web/Connexpay/Payments.hs+4−1
@@ -94,9 +94,10 @@ instance FromJSON AuthResponse where
9494-- | Authorise a credit card payment.
9595authorisePayment :: CreditCard -- ^ Credit card details (see 'CreditCard')
9696 -> Money USD -- ^ Amount to charge, USD
97+ -> Maybe Text -- ^ Invoice description
9798 -> Maybe Text -- ^ Merchant description that will appear in a customer's statement.
9899 -> ConnexpayM AuthResponse
99−authorisePayment cc amt vendor =
100+authorisePayment cc amt invoice vendor =
100101 do resp <- sendRequestJson "authonlys" body
101102 let rbody = responseBody resp
102103 -- Special case for Connexpay local transaction
@@ -111,6 +112,8 @@ authorisePayment cc amt vendor =
111112 where body = execWriter $
112113 do tell [ "Card" .= cc ]
113114 tell [ "Amount" .= getAmount amt ]
115+ whenJust invoice $ \i ->
116+ tell [ "OrderNumber" .= i ]
114117 whenJust vendor $ \v ->
115118 tell [ "StatementDescription" .= v ]
116119 -- We are supposed to pass RiskData, but it still