From d26e3419948c3aba72d337da81462162b52efa35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Tue, 6 Dec 2022 20:10:34 +0800 Subject: Payment notification --- midtrans.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'midtrans.h') diff --git a/midtrans.h b/midtrans.h index a5c21be..6ed9448 100644 --- a/midtrans.h +++ b/midtrans.h @@ -1,6 +1,12 @@ #ifndef MIDTRANS_H #define MIDTRANS_H +enum midtrans_transaction_status { + MIDTRANS_TRANSACTION_SETTLEMENT = 200, + MIDTRANS_TRANSACTION_PENDING, + MIDTRANS_TRANSACTION_DENY +}; + struct midtrans_transaction { char *order_id; long gross_amount; @@ -23,6 +29,11 @@ struct midtrans_echannel { struct midtrans_echannel: midtrans_charge_echannel\ )(x, y) +#define midtrans_notification(x, y, z) _Generic((z),\ + struct midtrans_transaction *\ + : midtrans_notification_transaction\ + )(x, y) + #ifdef __cplusplus extern "C" { #endif @@ -40,6 +51,9 @@ char *midtrans_charge_echannel(struct midtrans_echannel echannel, struct midtrans_transaction transaction); char *midtrans_status(const char *order_id); void midtrans_cleanup(); +enum midtrans_transaction_status midtrans_notification_transaction(char *post, + const char *server_key, + struct midtrans_transaction *transaction); #ifdef __cplusplus } -- cgit v1.2.3