1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#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;
};
struct midtrans_banktransfer {
char *bank;
char *va_number;
char *bca;
char *permata;
};
struct midtrans_echannel {
char *bill_info1;
char *bill_info2;
};
#define midtrans_charge(x, y) _Generic((x),\
struct midtrans_banktransfer: midtrans_charge_banktransfer,\
struct midtrans_echannel: midtrans_charge_echannel\
)(x, y)
#define midtrans_notification(x, y, z) _Generic((z),\
struct midtrans_transaction *\
: midtrans_notification_transaction\
)(x, y, z)
#ifdef __cplusplus
extern "C" {
#endif
void midtrans_init(const char *api_key, char *pem);
struct midtrans_banktransfer midtrans_banktransfer_new(char *bank);
struct midtrans_echannel midtrans_echannel_new(char *bill_info1,
char *bill_info2);
struct midtrans_transaction midtrans_transaction_new(char *order_id,
long gross_amount);
char *midtrans_charge_banktransfer(struct midtrans_banktransfer banktransfer,
struct midtrans_transaction transaction
/*, char *custom_fields[]*/);
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
}
#endif
#endif
|