11package com .flutterwave .bean ;
22
3+ import com .fasterxml .jackson .annotation .JsonInclude ;
4+ import com .fasterxml .jackson .annotation .JsonProperty ;
5+ import com .fasterxml .jackson .databind .ObjectMapper ;
6+ import com .google .gson .Gson ;
7+ import com .google .gson .GsonBuilder ;
38import lombok .Getter ;
49import lombok .NoArgsConstructor ;
510import lombok .Setter ;
11+ import org .json .JSONObject ;
12+ import org .json .JSONPropertyName ;
613
714import java .math .BigDecimal ;
815
916@ Getter
1017@ Setter
1118@ NoArgsConstructor
19+ @ JsonInclude (JsonInclude .Include .NON_NULL )
1220public class Data {
1321
14- private Customer customer ;
22+ private Object customer ;
23+ private Object meta ;
1524 private int id ;
25+ private int maximum ;
26+ private int minimum ;
1627 private String tx_ref ;
1728 private String flw_ref ;
1829 private String device_fingerprint ;
1930 private BigDecimal amount ;
2031 private BigDecimal charged_amount ;
2132 private BigDecimal app_fee ;
33+ private BigDecimal app_feefee ;
2234 private BigDecimal fee ;
2335 private BigDecimal merchant_fee ;
2436 private String processor_response ;
@@ -64,6 +76,7 @@ public class Data {
6476 private String state ;
6577 private String address_1 ;
6678 private String address_2 ;
79+ private String address ;
6780 private String zip_code ;
6881 private String cvv ;
6982 private String expiration ;
@@ -80,12 +93,50 @@ public class Data {
8093 private String customer_email ;
8194 private String settlement_id ;
8295 private String transaction_id ;
83- private String meta ;
8496 private String subaccount_id ;
8597 private String bank_name ;
8698 private String split_type ;
8799 private BigDecimal split_value ;
88100 private int split_ratio ;
89101 private BigDecimal amount_settled ;
90102 private BigDecimal amount_refunded ;
103+ private String response_code ;
104+ private String response_message ;
105+ private String product_code ;
106+ private String email ;
107+
108+ private Customer getCustomer (){
109+ try {
110+ return new GsonBuilder ().create ().
111+ fromJson (new Gson ().toJson (this .customer ), Customer .class );
112+ }catch (Exception e ){
113+ System .out .println (e );
114+ throw new RuntimeException ("Please use .getCustomerString()" );
115+ }
116+ }
117+
118+
119+ public Meta getMeta (){
120+ try {
121+ return new GsonBuilder ().create ().
122+ fromJson (new Gson ().toJson (this .meta ), Meta .class );
123+ }catch (Exception e ){
124+ System .out .println (e );
125+ throw new RuntimeException ("Please use .getMetaString()" );
126+ }
127+ }
128+
129+ public String getMetaString (){
130+ if (this .meta != null ){
131+ return this .meta .toString ();
132+ }
133+ return null ;
134+ }
135+
136+ public String getCustomerString (){
137+ if (this .customer != null ){
138+ return this .customer .toString ();
139+ }
140+ return null ;
141+ }
91142}
0 commit comments