Fakultas Ilmu Komputer UI

transaction_entity.g.dart 4.9 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'transaction_entity.dart';

// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************

Transaction _$TransactionFromJson(Map<String, dynamic> json) {
  return Transaction(
    id: json['id'] as String,
12
13
    bankAccountTransferDestination:
        json['bank_account_transfer_destination'] as String,
14
15
16
17
18
19
20
    userBankName: json['user_bank_name'] as String,
    transferDestinationBankName:
        json['transfer_destination_bank_name'] as String,
    transferDestinationBankAccountName:
        json['transfer_destination_bank_account_name'] as String,
    transferDestinationBankAccountNumber:
        json['transfer_destination_bank_account_number'] as String,
Michael Wiryadinata Halim's avatar
Michael Wiryadinata Halim committed
21
    userBankAccountName: json['user_bank_account_name'] as String,
22
    transactionItemSubtotal: json['transaction_item_subtotal'] as String,
Michael Wiryadinata Halim's avatar
Michael Wiryadinata Halim committed
23
    transactionItems: (json['transaction_items'] as List)
24
25
26
27
28
29
30
31
32
33
34
35
36
        .map((e) => TransactionItem.fromJson(e as Map<String, dynamic>))
        .toList(),
    transactionNumber: json['transaction_number'] as String,
    user: json['user'] as String,
    userUsername: json['user_username'] as String,
    userFullName: json['user_full_name'] as String,
    userPhoneNumber: json['user_phone_number'] as String,
    shippingAddress: json['shipping_address'] as String,
    shippingNeighborhood: json['shipping_neighborhood'] as String,
    shippingHamlet: json['shipping_hamlet'] as String,
    shippingUrbanVillage: json['shipping_urban_village'] as String,
    shippingSubDistrict: json['shipping_sub_district'] as String,
    shippingCosts: json['shipping_costs'] as String,
37
    paymentMethod: stringToPaymentMethod(json['payment_method'] as String),
38
39
    readablePaymentMethod: json['readable_payment_method'] as String,
    donation: json['donation'] as String,
40
41
    transactionStatus:
        stringToStatusTransaction(json['transaction_status'] as String),
42
43
44
45
46
    readableTransactionStatus: json['readable_transaction_status'] as String,
    proofOfPayment: json['proof_of_payment'] as String,
    createdAt: DateTime.parse(json['created_at'] as String),
    updatedAt: DateTime.parse(json['updated_at'] as String),
    subtotal: json['subtotal'] as String,
47
48
    batch: json['batch'] as String,
    batchName: json['batch_name'] as String,
49
    batchEndDate: json['end_date'] != null ? DateTime.parse(json['end_date'] as String) : DateTime.now(),
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  );
}

Map<String, dynamic> _$TransactionToJson(Transaction instance) =>
    <String, dynamic>{
      'id': instance.id,
      'transaction_number': instance.transactionNumber,
      'user': instance.user,
      'user_username': instance.userUsername,
      'user_full_name': instance.userFullName,
      'user_phone_number': instance.userPhoneNumber,
      'shipping_address': instance.shippingAddress,
      'shipping_neighborhood': instance.shippingNeighborhood,
      'shipping_hamlet': instance.shippingHamlet,
      'shipping_urban_village': instance.shippingUrbanVillage,
      'shipping_sub_district': instance.shippingSubDistrict,
      'shipping_costs': instance.shippingCosts,
67
      'payment_method': _$PaymentMethodEnumMap[instance.paymentMethod],
68
      'readable_payment_method': instance.readablePaymentMethod,
69
      'transaction_item_subtotal': instance.transactionItemSubtotal,
70
      'donation': instance.donation,
71
72
      'transaction_status':
          _$StatusTransactionEnumMap[instance.transactionStatus],
73
74
      'readable_transaction_status': instance.readableTransactionStatus,
      'proof_of_payment': instance.proofOfPayment,
Michael Wiryadinata Halim's avatar
Michael Wiryadinata Halim committed
75
      'user_bank_account_name': instance.userBankAccountName,
76
      'user_bank_name': instance.userBankName,
77
78
      'bank_account_transfer_destination':
          instance.bankAccountTransferDestination,
79
80
81
82
83
      'transfer_destination_bank_name': instance.transferDestinationBankName,
      'transfer_destination_bank_account_name':
          instance.transferDestinationBankAccountName,
      'transfer_destination_bank_account_number':
          instance.transferDestinationBankAccountNumber,
84
85
86
87
      'created_at': instance.createdAt.toIso8601String(),
      'updated_at': instance.updatedAt.toIso8601String(),
      'subtotal': instance.subtotal,
      'transaction_items':
Michael Wiryadinata Halim's avatar
Michael Wiryadinata Halim committed
88
          instance.transactionItems.map((e) => e.toJson()).toList(),
89
      'batch': instance.batch,
90
91
      'batch_name': instance.batchName,
      'end_date': instance.batchEndDate.toIso8601String(),
92
    };
93
94

const _$PaymentMethodEnumMap = {
Michael Wiryadinata Halim's avatar
Michael Wiryadinata Halim committed
95
96
  PaymentMethod.transfer: 'transfer',
  PaymentMethod.cod: 'cod',
97
98
99
};

const _$StatusTransactionEnumMap = {
Michael Wiryadinata Halim's avatar
Michael Wiryadinata Halim committed
100
101
102
103
104
105
106
  StatusTransaction.waitProof: 'waitProof',
  StatusTransaction.waitSellerConfirmation: 'waitSellerConfirmation',
  StatusTransaction.inProcess: 'inProcess',
  StatusTransaction.beingShipped: 'beingShipped',
  StatusTransaction.completed: 'completed',
  StatusTransaction.canceled: 'canceled',
  StatusTransaction.failed: 'failed',
107
};