diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2022-10-31 17:52:47 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2022-10-31 17:52:47 +0800 |
commit | d3d482be762c6baa8b8f90366749b38f8e1d5476 (patch) | |
tree | 9433b0d801a41912444955d213d38a5a46208285 /midtrans.dart | |
parent | 3ab105554ff49b0e40c6a982f3a8509737efc40b (diff) |
Status & charge return strings
The most likely needed info like VA number.
Diffstat (limited to 'midtrans.dart')
-rw-r--r-- | midtrans.dart | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/midtrans.dart b/midtrans.dart index 35ee23b..860bd31 100644 --- a/midtrans.dart +++ b/midtrans.dart @@ -18,6 +18,9 @@ class MidtransBanktransfer extends Struct { Pointer<Utf8> permata; } +typedef MidtransChargeBanktransfer Pointer<Utf8> Function(MidtransBanktransfer, + MidtransTransaction, Array<Pointer<Utf8>>); + class Midtrans { DynamicLibrary dylib; @@ -37,17 +40,14 @@ class Midtrans { calloc.free(pemUtf8); } - void chargeBanktransfer(MidtransBanktransfer payment, + String chargeBanktransfer(MidtransBanktransfer payment, MidtransTransaction transaction, Array<Pointer<Utf8>> customFields) { final midtrans_charge = dylib.lookupFunction - <Void Function(MidtransBanktransfer, - MidtransTransaction, - Array<Pointer<Utf8>>), - void Function(MidtransBanktransfer, MidtransTransaction, - Array<Pointer<Utf8>>)> + <MidtransChargeBanktransfer, MidtransChargeBanktransfer> ('midtrans_charge_banktransfer'); - midtrans_charge(payment, transaction, customFields); + final va_number = midtrans_charge(payment, transaction, + customFields).toDartString(); calloc.free(payment.bank); if (payment.va_number != null) { calloc.free(payment.va_number); @@ -64,6 +64,7 @@ class Midtrans { calloc.free(customFields[i]); } } + return va_number; } void cleanup() { |