WAIX6AGNDVJOKTWZ7OP7QOYSJHAJSX5EOWXZHOAO2IG6ALWUCJ6QC
O227CEAV7BTKSE3SSC7XHC5IWEBXZL2AOOKJMBMOOFNTLINBLQMAC
NEDDHXUK3GNFMOFO3KLU7NRIHCTYNWBT3D6HTKZAOXFDE6HMDZ6AC
IZEVQF627FA7VV25KJAWYWGGC35LZUUBBQRPN5ZAINTQLPEDRTEAC
Y3LIJ5USPMYBG7HKCIQBE7MWVGLQJPJSQD3KPZCTKXP22GOB535QC
73NDXDEZRMK672GHSTC3CI6YHXFZ2GGJI5IKQGHKFDZKTNSQXLLQC
NLZ3JXLOOIL37O3RRQWXHNPNSNEOOLPD6MCB754BEBECQB3KGR2AC
W35DDBFYF6Z4ZPCFEO5RPAONZLYCSNTXUSTS6FIUUVZHCI6Q7GHAC
DFOBMSAODB3NKW37B272ZXA2ML5HMIH3N3C4GT2DPEQS7ZFK4SNAC
Z3MK2PJ5U222DXRS22WCDHVPZ7HVAR3HOCUNXIGX6VMEPBQDF6PQC
QADKFHAR3KWQCNYU25Z7PJUGMD5WL26IU3DOAHBTRN2A7NKPUPKAC
storeEvent (CreatePaymentRequest _ _) = error "Not implemented"
storeEvent (CreatePayment _ _) = error "Not implemented"
storeEvent (CreatePaymentRequest uid req) =
Just $ storeEventJSON uid "create_payment_request" (paymentRequestJSON req)
storeEvent (CreatePayment uid req) =
Just $ storeEventJSON uid "create_payment" (paymentJSON req)
]
paymentRequestJSON :: PaymentRequest -> Value
paymentRequestJSON r = v1 $
obj [ "subscription_id" .= (r ^. (subscription . B._SubscriptionId . to tshow))
, "payment_request_protobuf_64" .= (r ^. (paymentRequest . to (decodeUtf8 . B64.encode . runPut . encodeMessage)))
, "payment_request_date" .= (r ^. paymentRequestDate)
]
paymentJSON :: Payment -> Value
paymentJSON r = v1 $
obj [ "payment_request_id" .= (r ^. (request . _PaymentRequestId . to tshow))
, "payment_protobuf_64" .= (r ^. (payment . to (decodeUtf8 . B64.encode . runPut . encodeMessage)))
, "payment_date" .= (r ^. paymentDate)