From 0d6548a94f8ecf57032d919f35c8f2c8d8c36a4f 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, 25 Oct 2022 20:24:19 +0800 Subject: charge tidak generik, spesifik saja --- midtrans.dart | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'midtrans.dart') diff --git a/midtrans.dart b/midtrans.dart index 4e65405..b1bc830 100644 --- a/midtrans.dart +++ b/midtrans.dart @@ -37,33 +37,31 @@ class Midtrans { calloc.free(caInfoUtf8); } - void charge(Pointer payment, + void chargeBanktransfer(Pointer payment, Pointer transaction, Array> customFields) { - if (payment is MidtransBanktransfer) { - final midtrans_charge = dylib.lookupFunction - , - Pointer, - Array>), - void Function(Pointer, + final midtrans_charge = dylib.lookupFunction + , Pointer, - Array>)> - ('midtrans_charge_banktransfer'); - midtrans_charge(payment, transaction, customFields); - calloc.free((payment as MidtransBanktransfer).bank); - if ((payment as MidtransBanktransfer).va_number - != null) { - calloc.free((payment as MidtransBanktransfer) - .va_number); - } - if ((payment as MidtransBanktransfer).bca != null) { - calloc.free((payment as MidtransBanktransfer) - .bca); - } - if ((payment as MidtransBanktransfer).permata != null) { - calloc.free((payment as MidtransBanktransfer) - .permata); - } + Array>), + void Function(Pointer, + Pointer, + Array>)> + ('midtrans_charge_banktransfer'); + midtrans_charge(payment, transaction, customFields); + calloc.free((payment as MidtransBanktransfer).bank); + if ((payment as MidtransBanktransfer).va_number + != null) { + calloc.free((payment as MidtransBanktransfer) + .va_number); + } + if ((payment as MidtransBanktransfer).bca != null) { + calloc.free((payment as MidtransBanktransfer) + .bca); + } + if ((payment as MidtransBanktransfer).permata != null) { + calloc.free((payment as MidtransBanktransfer) + .permata); } calloc.free(transaction.order_id); for (var i = 0; i < 6; i++) { -- cgit v1.2.3