From 30ee366260f29c466b15a5cd6be5ea82fc28d886 Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <adhisimon@gmail.com>
Date: Thu, 27 May 2021 18:49:58 +0700
Subject: [PATCH] Stringify struk

---
 index.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/index.js b/index.js
index ee0888b..8132b14 100644
--- a/index.js
+++ b/index.js
@@ -132,7 +132,9 @@ exports.report = async (data, xid, retry) => {
         info: data.info,
         detail: data.detail,
         data: data.data,
-        struk: data.struk,
+        struk: (typeof data.struk === 'string' && data.struk)
+            || (data.struk && JSON.stringify(data.struk))
+            || null,
     };
 
     logger.verbose('POSTPAID2-SDK: Going to report to CORE', {
-- 
1.9.0