Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:http/http.dart' as http;
- import 'dart:convert';
- Future<UserList> postFromJson(String secret, String status) async{
- http.Response response = await http.get("http://128.199.85.63:3000/api/v1/transactions/adm?key=3577c7bf7dsa7232dsadsd123-670f2eb21c4__&secret=$secret&status='$status'");
- final jsonData = json.decode(response.body);
- print(response.body);
- return UserList.fromJson(jsonData);
- }
- class UserList {
- int status;
- List<Results> results;
- UserList({this.status, this.results});
- UserList.fromJson(Map<String, dynamic> json) {
- status = json['status'];
- if (json['results'] != null) {
- results = new List<Results>();
- json['results'].forEach((v) {
- results.add(new Results.fromJson(v));
- });
- }
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['status'] = this.status;
- if (this.results != null) {
- data['results'] = this.results.map((v) => v.toJson()).toList();
- }
- return data;
- }
- }
- class Results {
- int id;
- int userId;
- int courierId;
- int invoiceNo;
- String trxNo;
- int totalPrice;
- int grandTotal;
- String discount;
- int discountAmmount;
- String paymentGateway;
- String paymentMethod;
- int trxTimestamp;
- String trxStatus;
- int bankId;
- String trxDatetime;
- String token;
- String voucherCode;
- String note;
- String resiNo;
- int deliveryPrice;
- Bank bank;
- User user;
- Address address;
- List<Items> items;
- Courier courier;
- Results(
- {this.id,
- this.userId,
- this.courierId,
- this.invoiceNo,
- this.trxNo,
- this.totalPrice,
- this.grandTotal,
- this.discount,
- this.discountAmmount,
- this.paymentGateway,
- this.paymentMethod,
- this.trxTimestamp,
- this.trxStatus,
- this.bankId,
- this.trxDatetime,
- this.token,
- this.voucherCode,
- this.note,
- this.resiNo,
- this.deliveryPrice,
- this.bank,
- this.user,
- this.address,
- this.items,
- this.courier});
- Results.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- userId = json['user_id'];
- courierId = json['courier_id'];
- invoiceNo = json['invoice_no'];
- trxNo = json['trx_no'];
- totalPrice = json['total_price'];
- grandTotal = json['grand_total'];
- discount = json['discount'];
- discountAmmount = json['discount_ammount'];
- paymentGateway = json['payment_gateway'];
- paymentMethod = json['payment_method'];
- trxTimestamp = json['trx_timestamp'];
- trxStatus = json['trx_status'];
- bankId = json['bank_id'];
- trxDatetime = json['trx_datetime'];
- token = json['token'];
- voucherCode = json['voucher_code'];
- note = json['note'];
- resiNo = json['resi_no'];
- deliveryPrice = json['delivery_price'];
- bank = json['bank'] != null ? new Bank.fromJson(json['bank']) : null;
- user = json['user'] != null ? new User.fromJson(json['user']) : null;
- address =
- json['address'] != null ? new Address.fromJson(json['address']) : null;
- if (json['items'] != null) {
- items = new List<Items>();
- json['items'].forEach((v) {
- items.add(new Items.fromJson(v));
- });
- }
- courier =
- json['courier'] != null ? new Courier.fromJson(json['courier']) : null;
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['user_id'] = this.userId;
- data['courier_id'] = this.courierId;
- data['invoice_no'] = this.invoiceNo;
- data['trx_no'] = this.trxNo;
- data['total_price'] = this.totalPrice;
- data['grand_total'] = this.grandTotal;
- data['discount'] = this.discount;
- data['discount_ammount'] = this.discountAmmount;
- data['payment_gateway'] = this.paymentGateway;
- data['payment_method'] = this.paymentMethod;
- data['trx_timestamp'] = this.trxTimestamp;
- data['trx_status'] = this.trxStatus;
- data['bank_id'] = this.bankId;
- data['trx_datetime'] = this.trxDatetime;
- data['token'] = this.token;
- data['voucher_code'] = this.voucherCode;
- data['note'] = this.note;
- data['resi_no'] = this.resiNo;
- data['delivery_price'] = this.deliveryPrice;
- if (this.bank != null) {
- data['bank'] = this.bank.toJson();
- }
- if (this.user != null) {
- data['user'] = this.user.toJson();
- }
- if (this.address != null) {
- data['address'] = this.address.toJson();
- }
- if (this.items != null) {
- data['items'] = this.items.map((v) => v.toJson()).toList();
- }
- if (this.courier != null) {
- data['courier'] = this.courier.toJson();
- }
- return data;
- }
- }
- class Bank {
- int id;
- String namaBank;
- String noRek;
- String namaPemilikRek;
- String icon;
- String sofId;
- Bank(
- {this.id,
- this.namaBank,
- this.noRek,
- this.namaPemilikRek,
- this.icon,
- this.sofId});
- Bank.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- namaBank = json['nama_bank'];
- noRek = json['no_rek'];
- namaPemilikRek = json['nama_pemilik_rek'];
- icon = json['icon'];
- sofId = json['sof_id'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['nama_bank'] = this.namaBank;
- data['no_rek'] = this.noRek;
- data['nama_pemilik_rek'] = this.namaPemilikRek;
- data['icon'] = this.icon;
- data['sof_id'] = this.sofId;
- return data;
- }
- }
- class User {
- int id;
- String username;
- String email;
- String fullName;
- dynamic firstName;
- dynamic lastName;
- String profilePictureOriginal;
- String profilePictureBlured;
- String profilePictureThumb;
- String profilePictureSmall;
- String profilePictureMedium;
- dynamic registredTimestamp;
- int lastLoginTimestamp;
- String lastLoginIp;
- dynamic emailVerified;
- String password;
- int isAdmin;
- String phone;
- String smId;
- String smType;
- dynamic fcmToken;
- dynamic verifyToken;
- int role;
- dynamic forgotCode;
- int lastUsedCourier;
- User(
- {this.id,
- this.username,
- this.email,
- this.fullName,
- this.firstName,
- this.lastName,
- this.profilePictureOriginal,
- this.profilePictureBlured,
- this.profilePictureThumb,
- this.profilePictureSmall,
- this.profilePictureMedium,
- this.registredTimestamp,
- this.lastLoginTimestamp,
- this.lastLoginIp,
- this.emailVerified,
- this.password,
- this.isAdmin,
- this.phone,
- this.smId,
- this.smType,
- this.fcmToken,
- this.verifyToken,
- this.role,
- this.forgotCode,
- this.lastUsedCourier});
- User.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- username = json['username'];
- email = json['email'];
- fullName = json['full_name'];
- firstName = json['first_name'];
- lastName = json['last_name'];
- profilePictureOriginal = json['profile_picture_original'];
- profilePictureBlured = json['profile_picture_blured'];
- profilePictureThumb = json['profile_picture_thumb'];
- profilePictureSmall = json['profile_picture_small'];
- profilePictureMedium = json['profile_picture_medium'];
- registredTimestamp = json['registred_timestamp'];
- lastLoginTimestamp = json['last_login_timestamp'];
- lastLoginIp = json['last_login_ip'];
- emailVerified = json['email_verified'];
- password = json['password'];
- isAdmin = json['is_admin'];
- phone = json['phone'];
- smId = json['sm_id'];
- smType = json['sm_type'];
- fcmToken = json['fcm_token'];
- verifyToken = json['verify_token'];
- role = json['role'];
- forgotCode = json['forgot_code'];
- lastUsedCourier = json['last_used_courier'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['username'] = this.username;
- data['email'] = this.email;
- data['full_name'] = this.fullName;
- data['first_name'] = this.firstName;
- data['last_name'] = this.lastName;
- data['profile_picture_original'] = this.profilePictureOriginal;
- data['profile_picture_blured'] = this.profilePictureBlured;
- data['profile_picture_thumb'] = this.profilePictureThumb;
- data['profile_picture_small'] = this.profilePictureSmall;
- data['profile_picture_medium'] = this.profilePictureMedium;
- data['registred_timestamp'] = this.registredTimestamp;
- data['last_login_timestamp'] = this.lastLoginTimestamp;
- data['last_login_ip'] = this.lastLoginIp;
- data['email_verified'] = this.emailVerified;
- data['password'] = this.password;
- data['is_admin'] = this.isAdmin;
- data['phone'] = this.phone;
- data['sm_id'] = this.smId;
- data['sm_type'] = this.smType;
- data['fcm_token'] = this.fcmToken;
- data['verify_token'] = this.verifyToken;
- data['role'] = this.role;
- data['forgot_code'] = this.forgotCode;
- data['last_used_courier'] = this.lastUsedCourier;
- return data;
- }
- }
- class Address {
- int id;
- int trxId;
- String fullName;
- String address;
- int provinceId;
- int cityId;
- int districtId;
- int posCode;
- String phoneNumber;
- Province province;
- City city;
- Address(
- {this.id,
- this.trxId,
- this.fullName,
- this.address,
- this.provinceId,
- this.cityId,
- this.districtId,
- this.posCode,
- this.phoneNumber,
- this.province,
- this.city});
- Address.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- trxId = json['trx_id'];
- fullName = json['full_name'];
- address = json['address'];
- provinceId = json['province_id'];
- cityId = json['city_id'];
- districtId = json['district_id'];
- posCode = json['pos_code'];
- phoneNumber = json['phone_number'];
- province = json['province'] != null
- ? new Province.fromJson(json['province'])
- : null;
- city = json['city'] != null ? new City.fromJson(json['city']) : null;
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['trx_id'] = this.trxId;
- data['full_name'] = this.fullName;
- data['address'] = this.address;
- data['province_id'] = this.provinceId;
- data['city_id'] = this.cityId;
- data['district_id'] = this.districtId;
- data['pos_code'] = this.posCode;
- data['phone_number'] = this.phoneNumber;
- if (this.province != null) {
- data['province'] = this.province.toJson();
- }
- if (this.city != null) {
- data['city'] = this.city.toJson();
- }
- return data;
- }
- }
- class Province {
- int id;
- String name;
- Province({this.id, this.name});
- Province.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- name = json['name'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['name'] = this.name;
- return data;
- }
- }
- class City {
- int id;
- int provinceId;
- String name;
- City({this.id, this.provinceId, this.name});
- City.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- provinceId = json['province_id'];
- name = json['name'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['province_id'] = this.provinceId;
- data['name'] = this.name;
- return data;
- }
- }
- class Items {
- int id;
- int trxId;
- int productId;
- int qty;
- Product product;
- Items({this.id, this.trxId, this.productId, this.qty, this.product});
- Items.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- trxId = json['trx_id'];
- productId = json['product_id'];
- qty = json['qty'];
- product =
- json['product'] != null ? new Product.fromJson(json['product']) : null;
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['trx_id'] = this.trxId;
- data['product_id'] = this.productId;
- data['qty'] = this.qty;
- if (this.product != null) {
- data['product'] = this.product.toJson();
- }
- return data;
- }
- }
- class Product {
- int id;
- String name;
- String descriptions;
- int category;
- dynamic createdTimestamp;
- dynamic lastEditedTimestamp;
- dynamic lastEditedBy;
- dynamic createdBy;
- dynamic orderNumber;
- String productCode;
- String discount;
- int freeDelivery;
- int stock;
- String tags;
- dynamic featuredImage;
- String unit;
- int minimumOrder;
- int price;
- int published;
- int featured;
- int unitSold;
- int weight;
- dynamic idPenjual;
- ImageData image;
- Product(
- {this.id,
- this.name,
- this.descriptions,
- this.category,
- this.createdTimestamp,
- this.lastEditedTimestamp,
- this.lastEditedBy,
- this.createdBy,
- this.orderNumber,
- this.productCode,
- this.discount,
- this.freeDelivery,
- this.stock,
- this.tags,
- this.featuredImage,
- this.unit,
- this.minimumOrder,
- this.price,
- this.published,
- this.featured,
- this.unitSold,
- this.weight,
- this.idPenjual,
- this.image});
- Product.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- name = json['name'];
- descriptions = json['descriptions'];
- category = json['category'];
- createdTimestamp = json['created_timestamp'];
- lastEditedTimestamp = json['last_edited_timestamp'];
- lastEditedBy = json['last_edited_by'];
- createdBy = json['created_by'];
- orderNumber = json['order_number'];
- productCode = json['product_code'];
- discount = json['discount'];
- freeDelivery = json['free_delivery'];
- stock = json['stock'];
- tags = json['tags'];
- featuredImage = json['featured_image'];
- unit = json['unit'];
- minimumOrder = json['minimum_order'];
- price = json['price'];
- published = json['published'];
- featured = json['featured'];
- unitSold = json['unit_sold'];
- weight = json['weight'];
- idPenjual = json['id_penjual'];
- image = json['image'] != null ? new ImageData.fromJson(json['image']) : null;
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['name'] = this.name;
- data['descriptions'] = this.descriptions;
- data['category'] = this.category;
- data['created_timestamp'] = this.createdTimestamp;
- data['last_edited_timestamp'] = this.lastEditedTimestamp;
- data['last_edited_by'] = this.lastEditedBy;
- data['created_by'] = this.createdBy;
- data['order_number'] = this.orderNumber;
- data['product_code'] = this.productCode;
- data['discount'] = this.discount;
- data['free_delivery'] = this.freeDelivery;
- data['stock'] = this.stock;
- data['tags'] = this.tags;
- data['featured_image'] = this.featuredImage;
- data['unit'] = this.unit;
- data['minimum_order'] = this.minimumOrder;
- data['price'] = this.price;
- data['published'] = this.published;
- data['featured'] = this.featured;
- data['unit_sold'] = this.unitSold;
- data['weight'] = this.weight;
- data['id_penjual'] = this.idPenjual;
- if (this.image != null) {
- data['image'] = this.image.toJson();
- }
- return data;
- }
- }
- class ImageData {
- int id;
- int productId;
- String imageBig;
- String imageMedium;
- String imageSmall;
- String imageThumb;
- String imageBlured;
- String imageOriginal;
- int featured;
- ImageData(
- {this.id,
- this.productId,
- this.imageBig,
- this.imageMedium,
- this.imageSmall,
- this.imageThumb,
- this.imageBlured,
- this.imageOriginal,
- this.featured});
- ImageData.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- productId = json['product_id'];
- imageBig = json['image_big'];
- imageMedium = json['image_medium'];
- imageSmall = json['image_small'];
- imageThumb = json['image_thumb'];
- imageBlured = json['image_blured'];
- imageOriginal = json['image_original'];
- featured = json['featured'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['product_id'] = this.productId;
- data['image_big'] = this.imageBig;
- data['image_medium'] = this.imageMedium;
- data['image_small'] = this.imageSmall;
- data['image_thumb'] = this.imageThumb;
- data['image_blured'] = this.imageBlured;
- data['image_original'] = this.imageOriginal;
- data['featured'] = this.featured;
- return data;
- }
- }
- class Courier {
- int id;
- String name;
- String descriptions;
- String icon;
- int coverageAll;
- int deliveryMin;
- int deliveryMax;
- String deliveryUnit;
- String priceType;
- int price;
- int weight;
- int addedTimestamp;
- Courier(
- {this.id,
- this.name,
- this.descriptions,
- this.icon,
- this.coverageAll,
- this.deliveryMin,
- this.deliveryMax,
- this.deliveryUnit,
- this.priceType,
- this.price,
- this.weight,
- this.addedTimestamp});
- Courier.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- name = json['name'];
- descriptions = json['descriptions'];
- icon = json['icon'];
- coverageAll = json['coverage_all'];
- deliveryMin = json['delivery_min'];
- deliveryMax = json['delivery_max'];
- deliveryUnit = json['delivery_unit'];
- priceType = json['price_type'];
- price = json['price'];
- weight = json['weight'];
- addedTimestamp = json['added_timestamp'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['name'] = this.name;
- data['descriptions'] = this.descriptions;
- data['icon'] = this.icon;
- data['coverage_all'] = this.coverageAll;
- data['delivery_min'] = this.deliveryMin;
- data['delivery_max'] = this.deliveryMax;
- data['delivery_unit'] = this.deliveryUnit;
- data['price_type'] = this.priceType;
- data['price'] = this.price;
- data['weight'] = this.weight;
- data['added_timestamp'] = this.addedTimestamp;
- return data;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement