-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathData.java
More file actions
164 lines (151 loc) · 4.6 KB
/
Data.java
File metadata and controls
164 lines (151 loc) · 4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
package com.flutterwave.bean;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.json.JSONObject;
import org.json.JSONPropertyName;
import java.math.BigDecimal;
@Getter
@Setter
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Data {
private Object customer;
private Object meta;
private int id;
private int maximum;
private int minimum;
private String tx_ref;
private String flw_ref;
private String device_fingerprint;
private BigDecimal amount;
private BigDecimal charged_amount;
private BigDecimal app_fee;
private BigDecimal app_feefee;
private BigDecimal fee;
private BigDecimal merchant_fee;
private String processor_response;
private String auth_model;
private String currency;
private String ip;
private String narration;
private String status;
private String auth_url;
private String payment_type;
private String fraud_status;
private String charge_type;
private String created_at;
private int account_id;
private Card card;
private String type;
private Account account;
private boolean redirect;
private String redirect_url;
private String payment_code;
private String type_data;
private String order_ref;
private String biller_code;
private String default_commission;
private String name;
private String branch_code;
private String branch_name;
private String swift_code;
private String bank_id;
private String bic;
private String date_added;
private String country;
private boolean is_airtime;
private boolean is_active;
private String biller_name;
private String item_code;
private String label_name;
private String short_name;
private boolean commission_on_fee;
private String card_pan;
private String masked_pan;
private String city;
private String state;
private String address_1;
private String address_2;
private String address;
private String zip_code;
private String cvv;
private String expiration;
private String send_to;
private String bin_check_name;
private String card_type;
private String name_on_card;
private String callback_url;
private String interval;
private int duration;
private String plan_token;
private String code;
private String customer_name;
private String customer_email;
private String settlement_id;
private String transaction_id;
private String subaccount_id;
private String bank_name;
private String split_type;
private BigDecimal split_value;
private int split_ratio;
private BigDecimal amount_settled;
private BigDecimal amount_refunded;
private String response_code;
private String response_message;
private String product_code;
private String email;
private String account_number;
private String expiry_date;
private String note;
private String active;
private String frequency;
private Customer getCustomer(){
try {
return new GsonBuilder().create().
fromJson(new Gson().toJson(this.customer), Customer.class);
}catch (Exception e){
System.out.println(e);
throw new RuntimeException("Please use .getCustomerString()");
}
}
public Meta getMeta(){
try {
return new GsonBuilder().create().
fromJson(new Gson().toJson(this.meta), Meta.class);
}catch (Exception e){
System.out.println(e);
throw new RuntimeException("Please use .getMetaString()");
}
}
public String getMetaString(){
if(this.meta != null){
return this.meta.toString();
}
return null;
}
public String getCustomerString(){
if(this.customer != null){
return this.customer.toString();
}
return null;
}
@Override
public String toString() {
String value = null;
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
try {
value = objectMapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return value;
}
}