diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2022-10-25 20:24:19 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2022-10-25 20:24:19 +0800 |
commit | 0d6548a94f8ecf57032d919f35c8f2c8d8c36a4f (patch) | |
tree | fb8d0c11e9f60327b4c71c45971c3a697ede0bf1 /midtrans.dart | |
parent | d47215ddcca5b90eb360b15d7d0d852121070019 (diff) |
charge tidak generik, spesifik saja
Diffstat (limited to 'midtrans.dart')
-rw-r--r-- | midtrans.dart | 46 |
1 files changed, 22 insertions, 24 deletions
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<T extends Struct>(Pointer<T> payment, + void chargeBanktransfer(Pointer<MidtransBanktransfer> payment, Pointer<MidtransTransaction> transaction, Array<Pointer<Utf8>> customFields) { - if (payment is MidtransBanktransfer) { - final midtrans_charge = dylib.lookupFunction - <Void Function(Pointer<MidtransBanktransfer>, - Pointer<MidtransTransaction>, - Array<Pointer<Utf8>>), - void Function(Pointer<MidtransBanktransfer>, + final midtrans_charge = dylib.lookupFunction + <Void Function(Pointer<MidtransBanktransfer>, Pointer<MidtransTransaction>, - Array<Pointer<Utf8>>)> - ('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<Pointer<Utf8>>), + void Function(Pointer<MidtransBanktransfer>, + Pointer<MidtransTransaction>, + Array<Pointer<Utf8>>)> + ('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++) { |