Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
68 ashish 1
/**
2
 * Autogenerated by Thrift
3
 *
4
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
 */
6
package in.shop2020.model.v1.order;
7
 
8
import java.util.List;
9
import java.util.ArrayList;
10
import java.util.Map;
11
import java.util.HashMap;
12
import java.util.EnumMap;
13
import java.util.Set;
14
import java.util.HashSet;
15
import java.util.EnumSet;
16
import java.util.Collections;
17
import java.util.BitSet;
18
import java.util.Arrays;
19
import org.slf4j.Logger;
20
import org.slf4j.LoggerFactory;
21
 
22
import org.apache.thrift.*;
23
import org.apache.thrift.meta_data.*;
24
import org.apache.thrift.protocol.*;
25
 
26
public class Payment implements TBase<Payment._Fields>, java.io.Serializable, Cloneable, Comparable<Payment> {
27
  private static final TStruct STRUCT_DESC = new TStruct("Payment");
28
 
29
  private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
30
  private static final TField MERCHANT_TX_ID_FIELD_DESC = new TField("merchant_tx_id", TType.STRING, (short)2);
31
  private static final TField BANK_TX_ID_FIELD_DESC = new TField("bank_tx_id", TType.STRING, (short)3);
32
  private static final TField MODE_FIELD_DESC = new TField("mode", TType.STRING, (short)4);
33
  private static final TField AMOUNT_FIELD_DESC = new TField("amount", TType.DOUBLE, (short)5);
34
  private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)6);
35
  private static final TField DESCRIPTION_FIELD_DESC = new TField("description", TType.STRING, (short)7);
36
  private static final TField SUBMISSION_TIMESTAMP_FIELD_DESC = new TField("submissionTimestamp", TType.I64, (short)9);
37
  private static final TField COMPLETION_TIMESTAMP_FIELD_DESC = new TField("completionTimestamp", TType.I64, (short)10);
38
 
39
  private long id;
40
  private String merchant_tx_id;
41
  private String bank_tx_id;
42
  private String mode;
43
  private double amount;
44
  private PaymentStatus status;
45
  private String description;
46
  private long submissionTimestamp;
47
  private long completionTimestamp;
48
 
49
  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
50
  public enum _Fields implements TFieldIdEnum {
51
    ID((short)1, "id"),
52
    MERCHANT_TX_ID((short)2, "merchant_tx_id"),
53
    BANK_TX_ID((short)3, "bank_tx_id"),
54
    MODE((short)4, "mode"),
55
    AMOUNT((short)5, "amount"),
56
    /**
57
     * 
58
     * @see PaymentStatus
59
     */
60
    STATUS((short)6, "status"),
61
    DESCRIPTION((short)7, "description"),
62
    SUBMISSION_TIMESTAMP((short)9, "submissionTimestamp"),
63
    COMPLETION_TIMESTAMP((short)10, "completionTimestamp");
64
 
65
    private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
66
    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
67
 
68
    static {
69
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
70
        byId.put((int)field._thriftId, field);
71
        byName.put(field.getFieldName(), field);
72
      }
73
    }
74
 
75
    /**
76
     * Find the _Fields constant that matches fieldId, or null if its not found.
77
     */
78
    public static _Fields findByThriftId(int fieldId) {
79
      return byId.get(fieldId);
80
    }
81
 
82
    /**
83
     * Find the _Fields constant that matches fieldId, throwing an exception
84
     * if it is not found.
85
     */
86
    public static _Fields findByThriftIdOrThrow(int fieldId) {
87
      _Fields fields = findByThriftId(fieldId);
88
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
89
      return fields;
90
    }
91
 
92
    /**
93
     * Find the _Fields constant that matches name, or null if its not found.
94
     */
95
    public static _Fields findByName(String name) {
96
      return byName.get(name);
97
    }
98
 
99
    private final short _thriftId;
100
    private final String _fieldName;
101
 
102
    _Fields(short thriftId, String fieldName) {
103
      _thriftId = thriftId;
104
      _fieldName = fieldName;
105
    }
106
 
107
    public short getThriftFieldId() {
108
      return _thriftId;
109
    }
110
 
111
    public String getFieldName() {
112
      return _fieldName;
113
    }
114
  }
115
 
116
  // isset id assignments
117
  private static final int __ID_ISSET_ID = 0;
118
  private static final int __AMOUNT_ISSET_ID = 1;
119
  private static final int __SUBMISSIONTIMESTAMP_ISSET_ID = 2;
120
  private static final int __COMPLETIONTIMESTAMP_ISSET_ID = 3;
121
  private BitSet __isset_bit_vector = new BitSet(4);
122
 
123
  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
124
    put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
125
        new FieldValueMetaData(TType.I64)));
126
    put(_Fields.MERCHANT_TX_ID, new FieldMetaData("merchant_tx_id", TFieldRequirementType.DEFAULT, 
127
        new FieldValueMetaData(TType.STRING)));
128
    put(_Fields.BANK_TX_ID, new FieldMetaData("bank_tx_id", TFieldRequirementType.DEFAULT, 
129
        new FieldValueMetaData(TType.STRING)));
130
    put(_Fields.MODE, new FieldMetaData("mode", TFieldRequirementType.DEFAULT, 
131
        new FieldValueMetaData(TType.STRING)));
132
    put(_Fields.AMOUNT, new FieldMetaData("amount", TFieldRequirementType.DEFAULT, 
133
        new FieldValueMetaData(TType.DOUBLE)));
134
    put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
135
        new EnumMetaData(TType.ENUM, PaymentStatus.class)));
136
    put(_Fields.DESCRIPTION, new FieldMetaData("description", TFieldRequirementType.DEFAULT, 
137
        new FieldValueMetaData(TType.STRING)));
138
    put(_Fields.SUBMISSION_TIMESTAMP, new FieldMetaData("submissionTimestamp", TFieldRequirementType.DEFAULT, 
139
        new FieldValueMetaData(TType.I64)));
140
    put(_Fields.COMPLETION_TIMESTAMP, new FieldMetaData("completionTimestamp", TFieldRequirementType.DEFAULT, 
141
        new FieldValueMetaData(TType.I64)));
142
  }});
143
 
144
  static {
145
    FieldMetaData.addStructMetaDataMap(Payment.class, metaDataMap);
146
  }
147
 
148
  public Payment() {
149
  }
150
 
151
  public Payment(
152
    long id,
153
    String merchant_tx_id,
154
    String bank_tx_id,
155
    String mode,
156
    double amount,
157
    PaymentStatus status,
158
    String description,
159
    long submissionTimestamp,
160
    long completionTimestamp)
161
  {
162
    this();
163
    this.id = id;
164
    setIdIsSet(true);
165
    this.merchant_tx_id = merchant_tx_id;
166
    this.bank_tx_id = bank_tx_id;
167
    this.mode = mode;
168
    this.amount = amount;
169
    setAmountIsSet(true);
170
    this.status = status;
171
    this.description = description;
172
    this.submissionTimestamp = submissionTimestamp;
173
    setSubmissionTimestampIsSet(true);
174
    this.completionTimestamp = completionTimestamp;
175
    setCompletionTimestampIsSet(true);
176
  }
177
 
178
  /**
179
   * Performs a deep copy on <i>other</i>.
180
   */
181
  public Payment(Payment other) {
182
    __isset_bit_vector.clear();
183
    __isset_bit_vector.or(other.__isset_bit_vector);
184
    this.id = other.id;
185
    if (other.isSetMerchant_tx_id()) {
186
      this.merchant_tx_id = other.merchant_tx_id;
187
    }
188
    if (other.isSetBank_tx_id()) {
189
      this.bank_tx_id = other.bank_tx_id;
190
    }
191
    if (other.isSetMode()) {
192
      this.mode = other.mode;
193
    }
194
    this.amount = other.amount;
195
    if (other.isSetStatus()) {
196
      this.status = other.status;
197
    }
198
    if (other.isSetDescription()) {
199
      this.description = other.description;
200
    }
201
    this.submissionTimestamp = other.submissionTimestamp;
202
    this.completionTimestamp = other.completionTimestamp;
203
  }
204
 
205
  public Payment deepCopy() {
206
    return new Payment(this);
207
  }
208
 
209
  @Deprecated
210
  public Payment clone() {
211
    return new Payment(this);
212
  }
213
 
214
  public long getId() {
215
    return this.id;
216
  }
217
 
218
  public Payment setId(long id) {
219
    this.id = id;
220
    setIdIsSet(true);
221
    return this;
222
  }
223
 
224
  public void unsetId() {
225
    __isset_bit_vector.clear(__ID_ISSET_ID);
226
  }
227
 
228
  /** Returns true if field id is set (has been asigned a value) and false otherwise */
229
  public boolean isSetId() {
230
    return __isset_bit_vector.get(__ID_ISSET_ID);
231
  }
232
 
233
  public void setIdIsSet(boolean value) {
234
    __isset_bit_vector.set(__ID_ISSET_ID, value);
235
  }
236
 
237
  public String getMerchant_tx_id() {
238
    return this.merchant_tx_id;
239
  }
240
 
241
  public Payment setMerchant_tx_id(String merchant_tx_id) {
242
    this.merchant_tx_id = merchant_tx_id;
243
    return this;
244
  }
245
 
246
  public void unsetMerchant_tx_id() {
247
    this.merchant_tx_id = null;
248
  }
249
 
250
  /** Returns true if field merchant_tx_id is set (has been asigned a value) and false otherwise */
251
  public boolean isSetMerchant_tx_id() {
252
    return this.merchant_tx_id != null;
253
  }
254
 
255
  public void setMerchant_tx_idIsSet(boolean value) {
256
    if (!value) {
257
      this.merchant_tx_id = null;
258
    }
259
  }
260
 
261
  public String getBank_tx_id() {
262
    return this.bank_tx_id;
263
  }
264
 
265
  public Payment setBank_tx_id(String bank_tx_id) {
266
    this.bank_tx_id = bank_tx_id;
267
    return this;
268
  }
269
 
270
  public void unsetBank_tx_id() {
271
    this.bank_tx_id = null;
272
  }
273
 
274
  /** Returns true if field bank_tx_id is set (has been asigned a value) and false otherwise */
275
  public boolean isSetBank_tx_id() {
276
    return this.bank_tx_id != null;
277
  }
278
 
279
  public void setBank_tx_idIsSet(boolean value) {
280
    if (!value) {
281
      this.bank_tx_id = null;
282
    }
283
  }
284
 
285
  public String getMode() {
286
    return this.mode;
287
  }
288
 
289
  public Payment setMode(String mode) {
290
    this.mode = mode;
291
    return this;
292
  }
293
 
294
  public void unsetMode() {
295
    this.mode = null;
296
  }
297
 
298
  /** Returns true if field mode is set (has been asigned a value) and false otherwise */
299
  public boolean isSetMode() {
300
    return this.mode != null;
301
  }
302
 
303
  public void setModeIsSet(boolean value) {
304
    if (!value) {
305
      this.mode = null;
306
    }
307
  }
308
 
309
  public double getAmount() {
310
    return this.amount;
311
  }
312
 
313
  public Payment setAmount(double amount) {
314
    this.amount = amount;
315
    setAmountIsSet(true);
316
    return this;
317
  }
318
 
319
  public void unsetAmount() {
320
    __isset_bit_vector.clear(__AMOUNT_ISSET_ID);
321
  }
322
 
323
  /** Returns true if field amount is set (has been asigned a value) and false otherwise */
324
  public boolean isSetAmount() {
325
    return __isset_bit_vector.get(__AMOUNT_ISSET_ID);
326
  }
327
 
328
  public void setAmountIsSet(boolean value) {
329
    __isset_bit_vector.set(__AMOUNT_ISSET_ID, value);
330
  }
331
 
332
  /**
333
   * 
334
   * @see PaymentStatus
335
   */
336
  public PaymentStatus getStatus() {
337
    return this.status;
338
  }
339
 
340
  /**
341
   * 
342
   * @see PaymentStatus
343
   */
344
  public Payment setStatus(PaymentStatus status) {
345
    this.status = status;
346
    return this;
347
  }
348
 
349
  public void unsetStatus() {
350
    this.status = null;
351
  }
352
 
353
  /** Returns true if field status is set (has been asigned a value) and false otherwise */
354
  public boolean isSetStatus() {
355
    return this.status != null;
356
  }
357
 
358
  public void setStatusIsSet(boolean value) {
359
    if (!value) {
360
      this.status = null;
361
    }
362
  }
363
 
364
  public String getDescription() {
365
    return this.description;
366
  }
367
 
368
  public Payment setDescription(String description) {
369
    this.description = description;
370
    return this;
371
  }
372
 
373
  public void unsetDescription() {
374
    this.description = null;
375
  }
376
 
377
  /** Returns true if field description is set (has been asigned a value) and false otherwise */
378
  public boolean isSetDescription() {
379
    return this.description != null;
380
  }
381
 
382
  public void setDescriptionIsSet(boolean value) {
383
    if (!value) {
384
      this.description = null;
385
    }
386
  }
387
 
388
  public long getSubmissionTimestamp() {
389
    return this.submissionTimestamp;
390
  }
391
 
392
  public Payment setSubmissionTimestamp(long submissionTimestamp) {
393
    this.submissionTimestamp = submissionTimestamp;
394
    setSubmissionTimestampIsSet(true);
395
    return this;
396
  }
397
 
398
  public void unsetSubmissionTimestamp() {
399
    __isset_bit_vector.clear(__SUBMISSIONTIMESTAMP_ISSET_ID);
400
  }
401
 
402
  /** Returns true if field submissionTimestamp is set (has been asigned a value) and false otherwise */
403
  public boolean isSetSubmissionTimestamp() {
404
    return __isset_bit_vector.get(__SUBMISSIONTIMESTAMP_ISSET_ID);
405
  }
406
 
407
  public void setSubmissionTimestampIsSet(boolean value) {
408
    __isset_bit_vector.set(__SUBMISSIONTIMESTAMP_ISSET_ID, value);
409
  }
410
 
411
  public long getCompletionTimestamp() {
412
    return this.completionTimestamp;
413
  }
414
 
415
  public Payment setCompletionTimestamp(long completionTimestamp) {
416
    this.completionTimestamp = completionTimestamp;
417
    setCompletionTimestampIsSet(true);
418
    return this;
419
  }
420
 
421
  public void unsetCompletionTimestamp() {
422
    __isset_bit_vector.clear(__COMPLETIONTIMESTAMP_ISSET_ID);
423
  }
424
 
425
  /** Returns true if field completionTimestamp is set (has been asigned a value) and false otherwise */
426
  public boolean isSetCompletionTimestamp() {
427
    return __isset_bit_vector.get(__COMPLETIONTIMESTAMP_ISSET_ID);
428
  }
429
 
430
  public void setCompletionTimestampIsSet(boolean value) {
431
    __isset_bit_vector.set(__COMPLETIONTIMESTAMP_ISSET_ID, value);
432
  }
433
 
434
  public void setFieldValue(_Fields field, Object value) {
435
    switch (field) {
436
    case ID:
437
      if (value == null) {
438
        unsetId();
439
      } else {
440
        setId((Long)value);
441
      }
442
      break;
443
 
444
    case MERCHANT_TX_ID:
445
      if (value == null) {
446
        unsetMerchant_tx_id();
447
      } else {
448
        setMerchant_tx_id((String)value);
449
      }
450
      break;
451
 
452
    case BANK_TX_ID:
453
      if (value == null) {
454
        unsetBank_tx_id();
455
      } else {
456
        setBank_tx_id((String)value);
457
      }
458
      break;
459
 
460
    case MODE:
461
      if (value == null) {
462
        unsetMode();
463
      } else {
464
        setMode((String)value);
465
      }
466
      break;
467
 
468
    case AMOUNT:
469
      if (value == null) {
470
        unsetAmount();
471
      } else {
472
        setAmount((Double)value);
473
      }
474
      break;
475
 
476
    case STATUS:
477
      if (value == null) {
478
        unsetStatus();
479
      } else {
480
        setStatus((PaymentStatus)value);
481
      }
482
      break;
483
 
484
    case DESCRIPTION:
485
      if (value == null) {
486
        unsetDescription();
487
      } else {
488
        setDescription((String)value);
489
      }
490
      break;
491
 
492
    case SUBMISSION_TIMESTAMP:
493
      if (value == null) {
494
        unsetSubmissionTimestamp();
495
      } else {
496
        setSubmissionTimestamp((Long)value);
497
      }
498
      break;
499
 
500
    case COMPLETION_TIMESTAMP:
501
      if (value == null) {
502
        unsetCompletionTimestamp();
503
      } else {
504
        setCompletionTimestamp((Long)value);
505
      }
506
      break;
507
 
508
    }
509
  }
510
 
511
  public void setFieldValue(int fieldID, Object value) {
512
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
513
  }
514
 
515
  public Object getFieldValue(_Fields field) {
516
    switch (field) {
517
    case ID:
518
      return new Long(getId());
519
 
520
    case MERCHANT_TX_ID:
521
      return getMerchant_tx_id();
522
 
523
    case BANK_TX_ID:
524
      return getBank_tx_id();
525
 
526
    case MODE:
527
      return getMode();
528
 
529
    case AMOUNT:
530
      return new Double(getAmount());
531
 
532
    case STATUS:
533
      return getStatus();
534
 
535
    case DESCRIPTION:
536
      return getDescription();
537
 
538
    case SUBMISSION_TIMESTAMP:
539
      return new Long(getSubmissionTimestamp());
540
 
541
    case COMPLETION_TIMESTAMP:
542
      return new Long(getCompletionTimestamp());
543
 
544
    }
545
    throw new IllegalStateException();
546
  }
547
 
548
  public Object getFieldValue(int fieldId) {
549
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
550
  }
551
 
552
  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
553
  public boolean isSet(_Fields field) {
554
    switch (field) {
555
    case ID:
556
      return isSetId();
557
    case MERCHANT_TX_ID:
558
      return isSetMerchant_tx_id();
559
    case BANK_TX_ID:
560
      return isSetBank_tx_id();
561
    case MODE:
562
      return isSetMode();
563
    case AMOUNT:
564
      return isSetAmount();
565
    case STATUS:
566
      return isSetStatus();
567
    case DESCRIPTION:
568
      return isSetDescription();
569
    case SUBMISSION_TIMESTAMP:
570
      return isSetSubmissionTimestamp();
571
    case COMPLETION_TIMESTAMP:
572
      return isSetCompletionTimestamp();
573
    }
574
    throw new IllegalStateException();
575
  }
576
 
577
  public boolean isSet(int fieldID) {
578
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
579
  }
580
 
581
  @Override
582
  public boolean equals(Object that) {
583
    if (that == null)
584
      return false;
585
    if (that instanceof Payment)
586
      return this.equals((Payment)that);
587
    return false;
588
  }
589
 
590
  public boolean equals(Payment that) {
591
    if (that == null)
592
      return false;
593
 
594
    boolean this_present_id = true;
595
    boolean that_present_id = true;
596
    if (this_present_id || that_present_id) {
597
      if (!(this_present_id && that_present_id))
598
        return false;
599
      if (this.id != that.id)
600
        return false;
601
    }
602
 
603
    boolean this_present_merchant_tx_id = true && this.isSetMerchant_tx_id();
604
    boolean that_present_merchant_tx_id = true && that.isSetMerchant_tx_id();
605
    if (this_present_merchant_tx_id || that_present_merchant_tx_id) {
606
      if (!(this_present_merchant_tx_id && that_present_merchant_tx_id))
607
        return false;
608
      if (!this.merchant_tx_id.equals(that.merchant_tx_id))
609
        return false;
610
    }
611
 
612
    boolean this_present_bank_tx_id = true && this.isSetBank_tx_id();
613
    boolean that_present_bank_tx_id = true && that.isSetBank_tx_id();
614
    if (this_present_bank_tx_id || that_present_bank_tx_id) {
615
      if (!(this_present_bank_tx_id && that_present_bank_tx_id))
616
        return false;
617
      if (!this.bank_tx_id.equals(that.bank_tx_id))
618
        return false;
619
    }
620
 
621
    boolean this_present_mode = true && this.isSetMode();
622
    boolean that_present_mode = true && that.isSetMode();
623
    if (this_present_mode || that_present_mode) {
624
      if (!(this_present_mode && that_present_mode))
625
        return false;
626
      if (!this.mode.equals(that.mode))
627
        return false;
628
    }
629
 
630
    boolean this_present_amount = true;
631
    boolean that_present_amount = true;
632
    if (this_present_amount || that_present_amount) {
633
      if (!(this_present_amount && that_present_amount))
634
        return false;
635
      if (this.amount != that.amount)
636
        return false;
637
    }
638
 
639
    boolean this_present_status = true && this.isSetStatus();
640
    boolean that_present_status = true && that.isSetStatus();
641
    if (this_present_status || that_present_status) {
642
      if (!(this_present_status && that_present_status))
643
        return false;
644
      if (!this.status.equals(that.status))
645
        return false;
646
    }
647
 
648
    boolean this_present_description = true && this.isSetDescription();
649
    boolean that_present_description = true && that.isSetDescription();
650
    if (this_present_description || that_present_description) {
651
      if (!(this_present_description && that_present_description))
652
        return false;
653
      if (!this.description.equals(that.description))
654
        return false;
655
    }
656
 
657
    boolean this_present_submissionTimestamp = true;
658
    boolean that_present_submissionTimestamp = true;
659
    if (this_present_submissionTimestamp || that_present_submissionTimestamp) {
660
      if (!(this_present_submissionTimestamp && that_present_submissionTimestamp))
661
        return false;
662
      if (this.submissionTimestamp != that.submissionTimestamp)
663
        return false;
664
    }
665
 
666
    boolean this_present_completionTimestamp = true;
667
    boolean that_present_completionTimestamp = true;
668
    if (this_present_completionTimestamp || that_present_completionTimestamp) {
669
      if (!(this_present_completionTimestamp && that_present_completionTimestamp))
670
        return false;
671
      if (this.completionTimestamp != that.completionTimestamp)
672
        return false;
673
    }
674
 
675
    return true;
676
  }
677
 
678
  @Override
679
  public int hashCode() {
680
    return 0;
681
  }
682
 
683
  public int compareTo(Payment other) {
684
    if (!getClass().equals(other.getClass())) {
685
      return getClass().getName().compareTo(other.getClass().getName());
686
    }
687
 
688
    int lastComparison = 0;
689
    Payment typedOther = (Payment)other;
690
 
691
    lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
692
    if (lastComparison != 0) {
693
      return lastComparison;
694
    }
695
    lastComparison = TBaseHelper.compareTo(id, typedOther.id);
696
    if (lastComparison != 0) {
697
      return lastComparison;
698
    }
699
    lastComparison = Boolean.valueOf(isSetMerchant_tx_id()).compareTo(isSetMerchant_tx_id());
700
    if (lastComparison != 0) {
701
      return lastComparison;
702
    }
703
    lastComparison = TBaseHelper.compareTo(merchant_tx_id, typedOther.merchant_tx_id);
704
    if (lastComparison != 0) {
705
      return lastComparison;
706
    }
707
    lastComparison = Boolean.valueOf(isSetBank_tx_id()).compareTo(isSetBank_tx_id());
708
    if (lastComparison != 0) {
709
      return lastComparison;
710
    }
711
    lastComparison = TBaseHelper.compareTo(bank_tx_id, typedOther.bank_tx_id);
712
    if (lastComparison != 0) {
713
      return lastComparison;
714
    }
715
    lastComparison = Boolean.valueOf(isSetMode()).compareTo(isSetMode());
716
    if (lastComparison != 0) {
717
      return lastComparison;
718
    }
719
    lastComparison = TBaseHelper.compareTo(mode, typedOther.mode);
720
    if (lastComparison != 0) {
721
      return lastComparison;
722
    }
723
    lastComparison = Boolean.valueOf(isSetAmount()).compareTo(isSetAmount());
724
    if (lastComparison != 0) {
725
      return lastComparison;
726
    }
727
    lastComparison = TBaseHelper.compareTo(amount, typedOther.amount);
728
    if (lastComparison != 0) {
729
      return lastComparison;
730
    }
731
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(isSetStatus());
732
    if (lastComparison != 0) {
733
      return lastComparison;
734
    }
735
    lastComparison = TBaseHelper.compareTo(status, typedOther.status);
736
    if (lastComparison != 0) {
737
      return lastComparison;
738
    }
739
    lastComparison = Boolean.valueOf(isSetDescription()).compareTo(isSetDescription());
740
    if (lastComparison != 0) {
741
      return lastComparison;
742
    }
743
    lastComparison = TBaseHelper.compareTo(description, typedOther.description);
744
    if (lastComparison != 0) {
745
      return lastComparison;
746
    }
747
    lastComparison = Boolean.valueOf(isSetSubmissionTimestamp()).compareTo(isSetSubmissionTimestamp());
748
    if (lastComparison != 0) {
749
      return lastComparison;
750
    }
751
    lastComparison = TBaseHelper.compareTo(submissionTimestamp, typedOther.submissionTimestamp);
752
    if (lastComparison != 0) {
753
      return lastComparison;
754
    }
755
    lastComparison = Boolean.valueOf(isSetCompletionTimestamp()).compareTo(isSetCompletionTimestamp());
756
    if (lastComparison != 0) {
757
      return lastComparison;
758
    }
759
    lastComparison = TBaseHelper.compareTo(completionTimestamp, typedOther.completionTimestamp);
760
    if (lastComparison != 0) {
761
      return lastComparison;
762
    }
763
    return 0;
764
  }
765
 
766
  public void read(TProtocol iprot) throws TException {
767
    TField field;
768
    iprot.readStructBegin();
769
    while (true)
770
    {
771
      field = iprot.readFieldBegin();
772
      if (field.type == TType.STOP) { 
773
        break;
774
      }
775
      _Fields fieldId = _Fields.findByThriftId(field.id);
776
      if (fieldId == null) {
777
        TProtocolUtil.skip(iprot, field.type);
778
      } else {
779
        switch (fieldId) {
780
          case ID:
781
            if (field.type == TType.I64) {
782
              this.id = iprot.readI64();
783
              setIdIsSet(true);
784
            } else { 
785
              TProtocolUtil.skip(iprot, field.type);
786
            }
787
            break;
788
          case MERCHANT_TX_ID:
789
            if (field.type == TType.STRING) {
790
              this.merchant_tx_id = iprot.readString();
791
            } else { 
792
              TProtocolUtil.skip(iprot, field.type);
793
            }
794
            break;
795
          case BANK_TX_ID:
796
            if (field.type == TType.STRING) {
797
              this.bank_tx_id = iprot.readString();
798
            } else { 
799
              TProtocolUtil.skip(iprot, field.type);
800
            }
801
            break;
802
          case MODE:
803
            if (field.type == TType.STRING) {
804
              this.mode = iprot.readString();
805
            } else { 
806
              TProtocolUtil.skip(iprot, field.type);
807
            }
808
            break;
809
          case AMOUNT:
810
            if (field.type == TType.DOUBLE) {
811
              this.amount = iprot.readDouble();
812
              setAmountIsSet(true);
813
            } else { 
814
              TProtocolUtil.skip(iprot, field.type);
815
            }
816
            break;
817
          case STATUS:
818
            if (field.type == TType.I32) {
819
              this.status = PaymentStatus.findByValue(iprot.readI32());
820
            } else { 
821
              TProtocolUtil.skip(iprot, field.type);
822
            }
823
            break;
824
          case DESCRIPTION:
825
            if (field.type == TType.STRING) {
826
              this.description = iprot.readString();
827
            } else { 
828
              TProtocolUtil.skip(iprot, field.type);
829
            }
830
            break;
831
          case SUBMISSION_TIMESTAMP:
832
            if (field.type == TType.I64) {
833
              this.submissionTimestamp = iprot.readI64();
834
              setSubmissionTimestampIsSet(true);
835
            } else { 
836
              TProtocolUtil.skip(iprot, field.type);
837
            }
838
            break;
839
          case COMPLETION_TIMESTAMP:
840
            if (field.type == TType.I64) {
841
              this.completionTimestamp = iprot.readI64();
842
              setCompletionTimestampIsSet(true);
843
            } else { 
844
              TProtocolUtil.skip(iprot, field.type);
845
            }
846
            break;
847
        }
848
        iprot.readFieldEnd();
849
      }
850
    }
851
    iprot.readStructEnd();
852
    validate();
853
  }
854
 
855
  public void write(TProtocol oprot) throws TException {
856
    validate();
857
 
858
    oprot.writeStructBegin(STRUCT_DESC);
859
    oprot.writeFieldBegin(ID_FIELD_DESC);
860
    oprot.writeI64(this.id);
861
    oprot.writeFieldEnd();
862
    if (this.merchant_tx_id != null) {
863
      oprot.writeFieldBegin(MERCHANT_TX_ID_FIELD_DESC);
864
      oprot.writeString(this.merchant_tx_id);
865
      oprot.writeFieldEnd();
866
    }
867
    if (this.bank_tx_id != null) {
868
      oprot.writeFieldBegin(BANK_TX_ID_FIELD_DESC);
869
      oprot.writeString(this.bank_tx_id);
870
      oprot.writeFieldEnd();
871
    }
872
    if (this.mode != null) {
873
      oprot.writeFieldBegin(MODE_FIELD_DESC);
874
      oprot.writeString(this.mode);
875
      oprot.writeFieldEnd();
876
    }
877
    oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
878
    oprot.writeDouble(this.amount);
879
    oprot.writeFieldEnd();
880
    if (this.status != null) {
881
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
882
      oprot.writeI32(this.status.getValue());
883
      oprot.writeFieldEnd();
884
    }
885
    if (this.description != null) {
886
      oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
887
      oprot.writeString(this.description);
888
      oprot.writeFieldEnd();
889
    }
890
    oprot.writeFieldBegin(SUBMISSION_TIMESTAMP_FIELD_DESC);
891
    oprot.writeI64(this.submissionTimestamp);
892
    oprot.writeFieldEnd();
893
    oprot.writeFieldBegin(COMPLETION_TIMESTAMP_FIELD_DESC);
894
    oprot.writeI64(this.completionTimestamp);
895
    oprot.writeFieldEnd();
896
    oprot.writeFieldStop();
897
    oprot.writeStructEnd();
898
  }
899
 
900
  @Override
901
  public String toString() {
902
    StringBuilder sb = new StringBuilder("Payment(");
903
    boolean first = true;
904
 
905
    sb.append("id:");
906
    sb.append(this.id);
907
    first = false;
908
    if (!first) sb.append(", ");
909
    sb.append("merchant_tx_id:");
910
    if (this.merchant_tx_id == null) {
911
      sb.append("null");
912
    } else {
913
      sb.append(this.merchant_tx_id);
914
    }
915
    first = false;
916
    if (!first) sb.append(", ");
917
    sb.append("bank_tx_id:");
918
    if (this.bank_tx_id == null) {
919
      sb.append("null");
920
    } else {
921
      sb.append(this.bank_tx_id);
922
    }
923
    first = false;
924
    if (!first) sb.append(", ");
925
    sb.append("mode:");
926
    if (this.mode == null) {
927
      sb.append("null");
928
    } else {
929
      sb.append(this.mode);
930
    }
931
    first = false;
932
    if (!first) sb.append(", ");
933
    sb.append("amount:");
934
    sb.append(this.amount);
935
    first = false;
936
    if (!first) sb.append(", ");
937
    sb.append("status:");
938
    if (this.status == null) {
939
      sb.append("null");
940
    } else {
941
      String status_name = status.name();
942
      if (status_name != null) {
943
        sb.append(status_name);
944
        sb.append(" (");
945
      }
946
      sb.append(this.status);
947
      if (status_name != null) {
948
        sb.append(")");
949
      }
950
    }
951
    first = false;
952
    if (!first) sb.append(", ");
953
    sb.append("description:");
954
    if (this.description == null) {
955
      sb.append("null");
956
    } else {
957
      sb.append(this.description);
958
    }
959
    first = false;
960
    if (!first) sb.append(", ");
961
    sb.append("submissionTimestamp:");
962
    sb.append(this.submissionTimestamp);
963
    first = false;
964
    if (!first) sb.append(", ");
965
    sb.append("completionTimestamp:");
966
    sb.append(this.completionTimestamp);
967
    first = false;
968
    sb.append(")");
969
    return sb.toString();
970
  }
971
 
972
  public void validate() throws TException {
973
    // check for required fields
974
  }
975
 
976
}
977