git.iko.soy/typeable/connexpay
on master help sign in
Allow adding invoice number.
44b3181Nick
connexpay/src/Tool.hs+1−1
@@ -75,7 +75,7 @@ main = do cmdLine <- execParser (info cmdParser mempty)
75 Right cpi -> print =<< runConnexpay cpi (doThing cmdLine.operation)
75 Right cpi -> print =<< runConnexpay cpi (doThing cmdLine.operation)
76
76
77doThing :: Command -> ConnexpayM ()
77doThing :: 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
79 where usd = Money amt
79 where usd = Money amt
80doThing (VoidSale guid) = liftIO . print =<< voidPayment guid Nothing
80doThing (VoidSale guid) = liftIO . print =<< voidPayment guid Nothing
81doThing (CaptureSale guid) = liftIO . print =<< capturePayment guid
81doThing (CaptureSale guid) = liftIO . print =<< capturePayment guid
connexpay/src/Web/Connexpay/Payments.hs+4−1
@@ -94,9 +94,10 @@ instance FromJSON AuthResponse where
94-- | Authorise a credit card payment.
94-- | Authorise a credit card payment.
95authorisePayment :: CreditCard -- ^ Credit card details (see 'CreditCard')
95authorisePayment :: CreditCard -- ^ Credit card details (see 'CreditCard')
96 -> Money USD -- ^ Amount to charge, USD
96 -> Money USD -- ^ Amount to charge, USD
97+ -> Maybe Text -- ^ Invoice description
97 -> Maybe Text -- ^ Merchant description that will appear in a customer's statement.
98 -> Maybe Text -- ^ Merchant description that will appear in a customer's statement.
98 -> ConnexpayM AuthResponse
99 -> ConnexpayM AuthResponse
99−authorisePayment cc amt vendor =
100+authorisePayment cc amt invoice vendor =
100 do resp <- sendRequestJson "authonlys" body
101 do resp <- sendRequestJson "authonlys" body
101 let rbody = responseBody resp
102 let rbody = responseBody resp
102 -- Special case for Connexpay local transaction
103 -- Special case for Connexpay local transaction
@@ -111,6 +112,8 @@ authorisePayment cc amt vendor =
111 where body = execWriter $
112 where body = execWriter $
112 do tell [ "Card" .= cc ]
113 do tell [ "Card" .= cc ]
113 tell [ "Amount" .= getAmount amt ]
114 tell [ "Amount" .= getAmount amt ]
115+ whenJust invoice $ \i ->
116+ tell [ "OrderNumber" .= i ]
114 whenJust vendor $ \v ->
117 whenJust vendor $ \v ->
115 tell [ "StatementDescription" .= v ]
118 tell [ "StatementDescription" .= v ]
116 -- We are supposed to pass RiskData, but it still
119 -- We are supposed to pass RiskData, but it still