From d3d482be762c6baa8b8f90366749b38f8e1d5476 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: Mon, 31 Oct 2022 17:52:47 +0800 Subject: Status & charge return strings The most likely needed info like VA number. --- midtrans.dart | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'midtrans.dart') 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 permata; } +typedef MidtransChargeBanktransfer Pointer Function(MidtransBanktransfer, + MidtransTransaction, Array>); + class Midtrans { DynamicLibrary dylib; @@ -37,17 +40,14 @@ class Midtrans { calloc.free(pemUtf8); } - void chargeBanktransfer(MidtransBanktransfer payment, + String chargeBanktransfer(MidtransBanktransfer payment, MidtransTransaction transaction, Array> customFields) { final midtrans_charge = dylib.lookupFunction - >), - void Function(MidtransBanktransfer, MidtransTransaction, - Array>)> + ('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() { -- cgit v1.2.3