adding fharmacy payment feature

merge-requests/273/head
mosazaid 5 years ago
parent a211248cfa
commit f3cdd08857

@ -1,3 +1,5 @@
import 'package:google_maps_flutter/google_maps_flutter.dart';
class BillingAddress {
String id;
String firstName;
@ -81,4 +83,19 @@ class BillingAddress {
data['lat_long'] = this.latLong;
return data;
}
LatLng getLocation(){
if(latLong.contains(',')){
var parts = latLong.trim().split(',');
if(parts.length == 2){
var lat = double.tryParse(parts.first);
var lng = double.tryParse(parts.last);
if(lat != null || lng != null) {
var location = LatLng(lat, lng);
return location;
}
}
}
return null;
}
}

@ -32,6 +32,7 @@ class Customer {
String lastLoginDateUtc;
String lastActivityDateUtc;
int registeredInStoreId;
List<int> roleIds;
Customer(
{this.billingAddress,
@ -63,7 +64,8 @@ class Customer {
this.createdOnUtc,
this.lastLoginDateUtc,
this.lastActivityDateUtc,
this.registeredInStoreId});
this.registeredInStoreId,
this.roleIds});
Customer.fromJson(Map<String, dynamic> json) {
billingAddress = json['billing_address'] != null
@ -105,6 +107,7 @@ class Customer {
lastLoginDateUtc = json['last_login_date_utc'];
lastActivityDateUtc = json['last_activity_date_utc'];
registeredInStoreId = json['registered_in_store_id'];
roleIds = json['role_ids'].cast<int>();
}
Map<String, dynamic> toJson() {
@ -145,6 +148,7 @@ class Customer {
data['last_login_date_utc'] = this.lastLoginDateUtc;
data['last_activity_date_utc'] = this.lastActivityDateUtc;
data['registered_in_store_id'] = this.registeredInStoreId;
data['role_ids'] = this.roleIds;
return data;
}
}

@ -7,22 +7,33 @@ class ShoppingCart {
// List<Null> productAttributes;
double customerEnteredPrice;
int quantity;
String discountAmountInclTax;
String subtotal;
String subtotalWithVat;
String subtotalVatAmount;
String subtotalVatRate;
String currency;
String currencyn;
String rentalStartDateUtc;
String rentalEndDateUtc;
String createdOnUtc;
String updatedOnUtc;
String shoppingCartType;
dynamic discountAmountInclTax;
dynamic subtotal;
dynamic subtotalWithVat;
dynamic subtotalVatAmount;
dynamic subtotalVatRate;
dynamic currency;
dynamic currencyn;
dynamic rentalStartDateUtc;
dynamic rentalEndDateUtc;
dynamic createdOnUtc;
dynamic updatedOnUtc;
dynamic shoppingCartType;
int productId;
PharmacyProduct product;
int customerId;
Customer customer;
double unitPriceInclTax;
double unitPriceExclTax;
double priceInclTax;
double priceExclTax;
dynamic discountAmountExclTax;
double originalProductCost;
String attributeDescription;
int downloadCount;
bool isDownloadActivated;
int licenseDownloadId;
double itemWeight;
ShoppingCart(
{this.languageId,
@ -45,7 +56,19 @@ class ShoppingCart {
this.productId,
this.product,
this.customerId,
this.customer});
this.customer,
this.unitPriceInclTax,
this.unitPriceExclTax,
this.priceInclTax,
this.priceExclTax,
this.discountAmountExclTax,
this.originalProductCost,
this.attributeDescription,
this.downloadCount,
this.isDownloadActivated,
this.licenseDownloadId,
this.itemWeight,
});
ShoppingCart.fromJson(Map<String, dynamic> json) {
languageId = json['language_id'];
@ -78,6 +101,18 @@ class ShoppingCart {
customer = json['customer'] != null
? new Customer.fromJson(json['customer'])
: null;
unitPriceInclTax = json['unit_price_incl_tax'];
unitPriceExclTax = json['unit_price_excl_tax'];
priceInclTax = json['price_incl_tax'];
priceExclTax = json['price_excl_tax'];
discountAmountExclTax = json['discount_amount_excl_tax'];
originalProductCost = json['original_product_cost'];
attributeDescription = json['attribute_description'];
downloadCount = json['download_count'];
isDownloadActivated = json['isDownload_activated'];
licenseDownloadId = json['license_download_id'];
itemWeight = json['item_weight'];
}
Map<String, dynamic> toJson() {
@ -110,6 +145,18 @@ class ShoppingCart {
if (this.customer != null) {
data['customer'] = this.customer.toJson();
}
data['unit_price_incl_tax'] = this.unitPriceInclTax;
data['unit_price_excl_tax'] = this.unitPriceExclTax;
data['price_incl_tax'] = this.priceInclTax;
data['price_excl_tax'] = this.priceExclTax;
data['discount_amount_excl_tax'] = this.discountAmountExclTax;
data['original_product_cost'] = this.originalProductCost;
data['attribute_description'] = this.attributeDescription;
data['download_count'] = this.downloadCount;
data['isDownload_activated'] = this.isDownloadActivated;
data['license_download_id'] = this.licenseDownloadId;
data['item_weight'] = this.itemWeight;
return data;
}
}

@ -0,0 +1,297 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/BillingAddress.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Customer.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCart.dart';
class OrderDetailModel {
String id;
int storeId;
String orderGuid;
bool pickUpInStore;
String paymentMethodSystemName;
String paymentName;
String paymentNamen;
String customerCurrencyCode;
dynamic currencyRate;
dynamic customerTaxDisplayTypeId;
dynamic vatNumber;
double orderSubtotalInclTax;
double orderSubtotalExclTax;
dynamic orderSubTotalDiscountInclTax;
dynamic orderSubTotalDiscountExclTax;
double orderShippingInclTax;
dynamic orderShippingExclTax;
dynamic paymentMethodAdditionalFeeInclTax;
dynamic paymentMethodAdditionalFeeExclTax;
String taxRates;
double orderTax;
dynamic orderDiscount;
dynamic productCount;
dynamic orderTotal;
dynamic refundedAmount;
dynamic rewardPointsWereAdded;
dynamic rxAttachments;
String checkoutAttributeDescription;
int customerLanguageId;
int affiliateId;
String customerIp;
dynamic authorizationTransactionId;
dynamic authorizationTransactionCode;
dynamic authorizationTransactionResult;
dynamic captureTransactionId;
dynamic captureTransactionResult;
dynamic subscriptionTransactionId;
dynamic paidDateUtc;
String shippingMethod;
String shippingRateComputationMethodSystemName;
String customValuesXml;
bool deleted;
String createdOnUtc;
Customer customer;
int customerId;
BillingAddress billingAddress;
BillingAddress shippingAddress;
List<ShoppingCart> orderItems;
int orderStatusId;
String orderStatus;
String orderStatusn;
int paymentStatusId;
String paymentStatus;
String paymentStatusn;
String shippingStatus;
String shippingStatusn;
String customerTaxDisplayType;
bool canCancel;
bool canRefund;
dynamic lakumAmount;
String preferDeliveryDate;
String preferDeliveryTime;
String preferDeliveryTimen;
OrderDetailModel(
{this.id,
this.storeId,
this.orderGuid,
this.pickUpInStore,
this.paymentMethodSystemName,
this.paymentName,
this.paymentNamen,
this.customerCurrencyCode,
this.currencyRate,
this.customerTaxDisplayTypeId,
this.vatNumber,
this.orderSubtotalInclTax,
this.orderSubtotalExclTax,
this.orderSubTotalDiscountInclTax,
this.orderSubTotalDiscountExclTax,
this.orderShippingInclTax,
this.orderShippingExclTax,
this.paymentMethodAdditionalFeeInclTax,
this.paymentMethodAdditionalFeeExclTax,
this.taxRates,
this.orderTax,
this.orderDiscount,
this.productCount,
this.orderTotal,
this.refundedAmount,
this.rewardPointsWereAdded,
this.rxAttachments,
this.checkoutAttributeDescription,
this.customerLanguageId,
this.affiliateId,
this.customerIp,
this.authorizationTransactionId,
this.authorizationTransactionCode,
this.authorizationTransactionResult,
this.captureTransactionId,
this.captureTransactionResult,
this.subscriptionTransactionId,
this.paidDateUtc,
this.shippingMethod,
this.shippingRateComputationMethodSystemName,
this.customValuesXml,
this.deleted,
this.createdOnUtc,
this.customer,
this.customerId,
this.billingAddress,
this.shippingAddress,
this.orderItems,
this.orderStatusId,
this.orderStatus,
this.orderStatusn,
this.paymentStatusId,
this.paymentStatus,
this.paymentStatusn,
this.shippingStatus,
this.shippingStatusn,
this.customerTaxDisplayType,
this.canCancel,
this.canRefund,
this.lakumAmount,
this.preferDeliveryDate,
this.preferDeliveryTime,
this.preferDeliveryTimen});
OrderDetailModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
storeId = json['store_id'];
orderGuid = json['order_guid'];
pickUpInStore = json['pick_up_in_store'];
paymentMethodSystemName = json['payment_method_system_name'];
paymentName = json['payment_name'];
paymentNamen = json['payment_namen'];
customerCurrencyCode = json['customer_currency_code'];
currencyRate = json['currency_rate'];
customerTaxDisplayTypeId = json['customer_tax_display_type_id'];
vatNumber = json['vat_number'];
orderSubtotalInclTax = json['order_subtotal_incl_tax'];
orderSubtotalExclTax = json['order_subtotal_excl_tax'];
orderSubTotalDiscountInclTax = json['order_sub_total_discount_incl_tax'];
orderSubTotalDiscountExclTax = json['order_sub_total_discount_excl_tax'];
orderShippingInclTax = json['order_shipping_incl_tax'];
orderShippingExclTax = json['order_shipping_excl_tax'];
paymentMethodAdditionalFeeInclTax =
json['payment_method_additional_fee_incl_tax'];
paymentMethodAdditionalFeeExclTax =
json['payment_method_additional_fee_excl_tax'];
taxRates = json['tax_rates'];
orderTax = json['order_tax'];
orderDiscount = json['order_discount'];
productCount = json['product_count'];
orderTotal = json['order_total'];
refundedAmount = json['refunded_amount'];
rewardPointsWereAdded = json['reward_points_were_added'];
rxAttachments = json['rx_attachments'];
checkoutAttributeDescription = json['checkout_attribute_description'];
customerLanguageId = json['customer_language_id'];
affiliateId = json['affiliate_id'];
customerIp = json['customer_ip'];
authorizationTransactionId = json['authorization_transaction_id'];
authorizationTransactionCode = json['authorization_transaction_code'];
authorizationTransactionResult = json['authorization_transaction_result'];
captureTransactionId = json['capture_transaction_id'];
captureTransactionResult = json['capture_transaction_result'];
subscriptionTransactionId = json['subscription_transaction_id'];
paidDateUtc = json['paid_date_utc'];
shippingMethod = json['shipping_method'];
shippingRateComputationMethodSystemName =
json['shipping_rate_computation_method_system_name'];
customValuesXml = json['custom_values_xml'];
deleted = json['deleted'];
createdOnUtc = json['created_on_utc'];
customer = json['customer'] != null
? new Customer.fromJson(json['customer'])
: null;
customerId = json['customer_id'];
billingAddress = json['billing_address'] != null
? new BillingAddress.fromJson(json['billing_address'])
: null;
shippingAddress = json['shipping_address'] != null
? new BillingAddress.fromJson(json['shipping_address'])
: null;
if (json['order_items'] != null) {
orderItems = new List<ShoppingCart>();
json['order_items'].forEach((v) {
orderItems.add(new ShoppingCart.fromJson(v));
});
}
orderStatusId = json['order_status_id'];
orderStatus = json['order_status'];
orderStatusn = json['order_statusn'];
paymentStatusId = json['payment_status_id'];
paymentStatus = json['payment_status'];
paymentStatusn = json['payment_statusn'];
shippingStatus = json['shipping_status'];
shippingStatusn = json['shipping_statusn'];
customerTaxDisplayType = json['customer_tax_display_type'];
canCancel = json['can_cancel'];
canRefund = json['can_refund'];
lakumAmount = json['lakum_amount'];
preferDeliveryDate = json['prefer_delivery_date'];
preferDeliveryTime = json['prefer_delivery_time'];
preferDeliveryTimen = json['prefer_delivery_timen'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['store_id'] = this.storeId;
data['order_guid'] = this.orderGuid;
data['pick_up_in_store'] = this.pickUpInStore;
data['payment_method_system_name'] = this.paymentMethodSystemName;
data['payment_name'] = this.paymentName;
data['payment_namen'] = this.paymentNamen;
data['customer_currency_code'] = this.customerCurrencyCode;
data['currency_rate'] = this.currencyRate;
data['customer_tax_display_type_id'] = this.customerTaxDisplayTypeId;
data['vat_number'] = this.vatNumber;
data['order_subtotal_incl_tax'] = this.orderSubtotalInclTax;
data['order_subtotal_excl_tax'] = this.orderSubtotalExclTax;
data['order_sub_total_discount_incl_tax'] =
this.orderSubTotalDiscountInclTax;
data['order_sub_total_discount_excl_tax'] =
this.orderSubTotalDiscountExclTax;
data['order_shipping_incl_tax'] = this.orderShippingInclTax;
data['order_shipping_excl_tax'] = this.orderShippingExclTax;
data['payment_method_additional_fee_incl_tax'] =
this.paymentMethodAdditionalFeeInclTax;
data['payment_method_additional_fee_excl_tax'] =
this.paymentMethodAdditionalFeeExclTax;
data['tax_rates'] = this.taxRates;
data['order_tax'] = this.orderTax;
data['order_discount'] = this.orderDiscount;
data['product_count'] = this.productCount;
data['order_total'] = this.orderTotal;
data['refunded_amount'] = this.refundedAmount;
data['reward_points_were_added'] = this.rewardPointsWereAdded;
data['rx_attachments'] = this.rxAttachments;
data['checkout_attribute_description'] = this.checkoutAttributeDescription;
data['customer_language_id'] = this.customerLanguageId;
data['affiliate_id'] = this.affiliateId;
data['customer_ip'] = this.customerIp;
data['authorization_transaction_id'] = this.authorizationTransactionId;
data['authorization_transaction_code'] = this.authorizationTransactionCode;
data['authorization_transaction_result'] =
this.authorizationTransactionResult;
data['capture_transaction_id'] = this.captureTransactionId;
data['capture_transaction_result'] = this.captureTransactionResult;
data['subscription_transaction_id'] = this.subscriptionTransactionId;
data['paid_date_utc'] = this.paidDateUtc;
data['shipping_method'] = this.shippingMethod;
data['shipping_rate_computation_method_system_name'] =
this.shippingRateComputationMethodSystemName;
data['custom_values_xml'] = this.customValuesXml;
data['deleted'] = this.deleted;
data['created_on_utc'] = this.createdOnUtc;
if (this.customer != null) {
data['customer'] = this.customer.toJson();
}
data['customer_id'] = this.customerId;
if (this.billingAddress != null) {
data['billing_address'] = this.billingAddress.toJson();
}
if (this.shippingAddress != null) {
data['shipping_address'] = this.shippingAddress.toJson();
}
if (this.orderItems != null) {
data['order_items'] = this.orderItems.map((v) => v.toJson()).toList();
}
data['order_status_id'] = this.orderStatusId;
data['order_status'] = this.orderStatus;
data['order_statusn'] = this.orderStatusn;
data['payment_status_id'] = this.paymentStatusId;
data['payment_status'] = this.paymentStatus;
data['payment_statusn'] = this.paymentStatusn;
data['shipping_status'] = this.shippingStatus;
data['shipping_statusn'] = this.shippingStatusn;
data['customer_tax_display_type'] = this.customerTaxDisplayType;
data['can_cancel'] = this.canCancel;
data['can_refund'] = this.canRefund;
data['lakum_amount'] = this.lakumAmount;
data['prefer_delivery_date'] = this.preferDeliveryDate;
data['prefer_delivery_time'] = this.preferDeliveryTime;
data['prefer_delivery_timen'] = this.preferDeliveryTimen;
return data;
}
}

@ -9,6 +9,71 @@ List<OrderModel> orderModelFromJson(String str) => List<OrderModel>.from(json.de
String orderModelToJson(List<OrderModel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class OrderModel {
String id;
dynamic storeId;
String orderGuid;
bool pickUpInStore;
PaymentMethodSystemName paymentMethodSystemName;
PaymentName paymentName;
PaymentName paymentNamen;
CustomerCurrencyCode customerCurrencyCode;
dynamic currencyRate;
dynamic customerTaxDisplayTypeId;
dynamic vatNumber;
double orderSubtotalInclTax;
double orderSubtotalExclTax;
dynamic orderSubTotalDiscountInclTax;
dynamic orderSubTotalDiscountExclTax;
double orderShippingInclTax;
dynamic orderShippingExclTax;
dynamic paymentMethodAdditionalFeeInclTax;
dynamic paymentMethodAdditionalFeeExclTax;
String taxRates;
double orderTax;
dynamic orderDiscount;
dynamic productCount;
double orderTotal;
dynamic refundedAmount;
dynamic rewardPointsWereAdded;
String rxAttachments;
CheckoutAttributeDescription checkoutAttributeDescription;
dynamic customerLanguageId;
dynamic affiliateId;
CustomerIp customerIp;
String authorizationTransactionId;
dynamic authorizationTransactionCode;
dynamic authorizationTransactionResult;
dynamic captureTransactionId;
dynamic captureTransactionResult;
dynamic subscriptionTransactionId;
DateTime paidDateUtc;
ShippingMethod shippingMethod;
ShippingRateComputationMethodSystemName shippingRateComputationMethodSystemName;
String customValuesXml;
bool deleted;
DateTime createdOnUtc;
OrderModelCustomer customer;
dynamic customerId;
IngAddress billingAddress;
IngAddress shippingAddress;
List<OrderItem> orderItems;
dynamic orderStatusId;
OrderStatus orderStatus;
OrderStatusn orderStatusn;
dynamic paymentStatusId;
PaymentStatus paymentStatus;
PaymentStatusn paymentStatusn;
ShippingStatus shippingStatus;
ShippingStatusn shippingStatusn;
CustomerTaxDisplayType customerTaxDisplayType;
bool canCancel;
bool canRefund;
dynamic lakumAmount;
DateTime preferDeliveryDate;
PreferDeliveryTime preferDeliveryTime;
PreferDeliveryTimen preferDeliveryTimen;
OrderModel({
this.id,
this.storeId,
@ -75,70 +140,6 @@ class OrderModel {
this.preferDeliveryTimen,
});
String id;
dynamic storeId;
String orderGuid;
bool pickUpInStore;
PaymentMethodSystemName paymentMethodSystemName;
PaymentName paymentName;
PaymentName paymentNamen;
CustomerCurrencyCode customerCurrencyCode;
dynamic currencyRate;
dynamic customerTaxDisplayTypeId;
dynamic vatNumber;
double orderSubtotalInclTax;
double orderSubtotalExclTax;
dynamic orderSubTotalDiscountInclTax;
dynamic orderSubTotalDiscountExclTax;
double orderShippingInclTax;
dynamic orderShippingExclTax;
dynamic paymentMethodAdditionalFeeInclTax;
dynamic paymentMethodAdditionalFeeExclTax;
String taxRates;
double orderTax;
dynamic orderDiscount;
dynamic productCount;
double orderTotal;
dynamic refundedAmount;
dynamic rewardPointsWereAdded;
String rxAttachments;
CheckoutAttributeDescription checkoutAttributeDescription;
dynamic customerLanguageId;
dynamic affiliateId;
CustomerIp customerIp;
String authorizationTransactionId;
dynamic authorizationTransactionCode;
dynamic authorizationTransactionResult;
dynamic captureTransactionId;
dynamic captureTransactionResult;
dynamic subscriptionTransactionId;
DateTime paidDateUtc;
ShippingMethod shippingMethod;
ShippingRateComputationMethodSystemName shippingRateComputationMethodSystemName;
String customValuesXml;
bool deleted;
DateTime createdOnUtc;
OrderModelCustomer customer;
dynamic customerId;
IngAddress billingAddress;
IngAddress shippingAddress;
List<OrderItem> orderItems;
dynamic orderStatusId;
OrderStatus orderStatus;
OrderStatusn orderStatusn;
dynamic paymentStatusId;
PaymentStatus paymentStatus;
PaymentStatusn paymentStatusn;
ShippingStatus shippingStatus;
ShippingStatusn shippingStatusn;
CustomerTaxDisplayType customerTaxDisplayType;
bool canCancel;
bool canRefund;
dynamic lakumAmount;
DateTime preferDeliveryDate;
PreferDeliveryTime preferDeliveryTime;
PreferDeliveryTimen preferDeliveryTimen;
factory OrderModel.fromJson(Map<String, dynamic> json) => OrderModel(
id: json["id"],
storeId: json["store_id"],
@ -1469,7 +1470,4 @@ class EnumValues<T> {
}
return reverseMap;
}
}
}

@ -185,7 +185,7 @@ class OrderPreviewViewModel extends BaseViewModel {
await _orderService.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts);
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}

@ -1,18 +1,17 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:flutter/material.dart';
import '../../../locator.dart';
import '../base_view_model.dart';
@ -21,10 +20,10 @@ class OrderModelViewModel extends BaseViewModel {
List<Orders> get orders => _orderService.orderList;
OrderDetailsService _orderDetailsService = locator<OrderDetailsService>();
List<OrderModel> get orderListModel => _orderDetailsService.orderList;
List<OrderDetailModel> get orderListModel => _orderDetailsService.orderList;
CancelOrderService _cancelOrderService = locator<CancelOrderService>();
List<OrderModel> get cancelOrder => _cancelOrderService.cancelOrderList;
List<OrderDetailModel> get cancelOrder => _cancelOrderService.cancelOrderList;
OrderPreviewService _orderServices = locator<OrderPreviewService>();
@ -98,7 +97,7 @@ class OrderModelViewModel extends BaseViewModel {
return res;
}
Future makeReview(Product product, double rating, String reviewText) async {
Future makeReview(PharmacyProduct product, double rating, String reviewText) async {
setState(ViewState.Busy);
await _orderDetailsService.makeReview(product, rating, reviewText);
if (_orderDetailsService.hasError) {

@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-sel
import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -25,9 +26,7 @@ class OrderPreviewPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
final height = mediaQuery.size.height -
60 -
mediaQuery.padding.top;
final height = mediaQuery.size.height - 60 - mediaQuery.padding.top;
return BaseView<OrderPreviewViewModel>(
onModelReady: (model) => model.getShoppingCart(),
@ -781,23 +780,16 @@ class PaymentBottomWidget extends StatelessWidget {
),
onPressed: (paymentData.address != null &&
paymentData.paymentOption != null)
? () => {
model.makeOrder().then((_) {
if (model.state != ViewState.Idle) {
SnackBar snackBar = SnackBar(
content: Text(
'Order has been placed successfully!!'));
scaffold.showSnackBar(snackBar);
}
// Navigator.pushAndRemoveUntil(
// context,
// MaterialPageRoute(
// builder: (context) =>
// PharmacyPage()),
// (Route<dynamic> r) => false);
})
? () async {
await model.makeOrder();
if (model.state != ViewState.Idle) {
AppToast.showSuccessToast(message: "Order has been placed successfully!!");
} else {
AppToast.showErrorToast(message: model.error);
}
Navigator.pop(context);
Navigator.pop(context);
}
: null,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16),

File diff suppressed because it is too large Load Diff

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart';
@ -12,7 +13,7 @@ import 'package:rating_bar/rating_bar.dart';
import 'package:flutter/src/widgets/image.dart' as flutterImage;
class ProductReviewPage extends StatefulWidget {
final Product product;
final PharmacyProduct product;
ProductReviewPage(this.product);

@ -1,6 +1,7 @@
import 'dart:async';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
@ -9,7 +10,7 @@ import 'package:location/location.dart';
class TrackDriver extends StatefulWidget {
final OrderModel order;
final OrderDetailModel order;
TrackDriver({this.order});
@override
@ -17,7 +18,7 @@ class TrackDriver extends StatefulWidget {
}
class _TrackDriverState extends State<TrackDriver> {
OrderModel _order;
OrderDetailModel _order;
Completer<GoogleMapController> _controller = Completer();

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
@ -16,8 +17,8 @@ class CancelOrderService extends BaseService{
AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider();
List<OrderModel> _cancelOrderList = List();
List<OrderModel> get cancelOrderList => _cancelOrderList;
List<OrderDetailModel> _cancelOrderList = List();
List<OrderDetailModel> get cancelOrderList => _cancelOrderList;
String url ="";

@ -1,12 +1,13 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:flutter/material.dart';
class OrderDetailsService extends BaseService{
@ -16,10 +17,8 @@ class OrderDetailsService extends BaseService{
AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider();
// String url ="";
// List<OrderModel> get orderDetails => ordeDetails;
List<OrderModel> _orderList = List();
List<OrderModel> get orderList => _orderList;
List<OrderDetailModel> _orderList = List();
List<OrderDetailModel> get orderList => _orderList;
Future getOrderDetails(OrderId) async {
@ -28,7 +27,7 @@ class OrderDetailsService extends BaseService{
onSuccess: (dynamic response, int statusCode) {
_orderList.clear();
response['orders'].forEach((item) {
_orderList.add(OrderModel.fromJson(item));
_orderList.add(OrderDetailModel.fromJson(item));
print(response);
});
}, onFailure: (String error, int statusCode) {
@ -37,7 +36,7 @@ class OrderDetailsService extends BaseService{
});
}
Future makeReview(Product product, double rating, String reviewText) async {
Future makeReview(PharmacyProduct product, double rating, String reviewText) async {
hasError = false;
super.error = "";

@ -1,6 +1,7 @@
import 'dart:convert';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
@ -20,13 +21,17 @@ class MyInAppBrowser extends InAppBrowser {
// static String PREAUTH_SERVICE_URL =
// 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store
static String PRESCRIPTION_PAYMENT_WITH_ORDERID =
'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID=';
static List<String> successURLS = [
'success',
'PayFortResponse',
'PayFortSucess'
'PayFortSucess',
'mobilepaymentcomplete'
];
static List<String> errorURLS = ['PayfortCancel'];
static List<String> errorURLS = ['PayfortCancel', 'errorpage', 'Failed'];
final Function onExitCallback;
final Function onLoadStartCallback;
@ -146,6 +151,26 @@ class MyInAppBrowser extends InAppBrowser {
});
}
openPharmacyPaymentBrowser(
OrderDetailModel order,
double amount,
String orderDesc,
String transactionID,
String emailId,
String paymentMethod,
String patientName,
dynamic patientID,
AuthenticatedUser authenticatedUser,
InAppBrowser browser) {
this.browser = browser;
getPatientData();
generatePharmacyURL(order, amount, orderDesc, transactionID, emailId,
paymentMethod, patientName, patientID, authenticatedUser)
.then((value) {
this.browser.openUrl(url: value);
});
}
openBrowser(String url) {
this.browser = browser;
this.browser.openUrl(url: url);
@ -225,6 +250,25 @@ class MyInAppBrowser extends InAppBrowser {
return 'data:text/html;base64,' + base64Str;
}
Future<String> generatePharmacyURL(
OrderDetailModel order,
double amount,
String orderDesc,
String transactionID,
String emailId,
String paymentMethod,
String patientName,
dynamic patientID,
AuthenticatedUser authUser) async {
String pharmacyURL = PRESCRIPTION_PAYMENT_WITH_ORDERID +
order.orderGuid +
'&&CustomerId=' +
"${order.customerId}";
print(pharmacyURL);
return pharmacyURL;
}
String getForm() {
return '<html> ' +
'<head></head>' +
@ -292,6 +336,36 @@ class MyInAppBrowser extends InAppBrowser {
'</body>' +
'</html>';
}
String getPharmacyForm() {
return '<html> ' +
'<head></head>' +
'<body>' +
'<form id="paymentForm" action="SERVICE_URL_VALUE" method="post">' +
'<input type="hidden" name="Amount" value="AMOUNT_VALUE">' +
'<input type="hidden" name="Order_Desc" value="ORDER_DESCRIPTION_VALUE">' +
'<input type="hidden" name="OrderID" value="ORDER_ID_VALUE">' +
'<input type="hidden" name="PaymentOption" value="PAYMENT_OPTION_VALUE">' +
'<input type="hidden" name="Email" value="EMAIL_VALUE">' +
'<input type="hidden" name="ServID" value="SERV_ID" >' +
'<input type="hidden" name="ChannelID" value="2" >' +
'<input type="hidden" name="Lang" value="LANG_VALUE" >' +
'<input type="hidden" name="ReturnURL" value="" >' +
'<input type="hidden" name="CustName" value="CUSTNAME_VALUE" >' +
'<input type="hidden" name="PatientOutSA" value="PATIENT_OUT_SA" >' +
'<input type="hidden" name="PatientTypeID" value="PATIENT_TYPE_ID" >' +
'<input type="hidden" name="DeviceToken" value="DEVICE_TOKEN" >' +
'<input type="hidden" name="Longitude" value="LONGITUDE_VALUE" >' +
'<input type="hidden" name="Latitude" value="LATITUDE_VALUE" >' +
'<input type="hidden" name="Live_ServiceID" value="LIVE_SERVICE_ID" >' +
'<input type="hidden" name="CustID" value="CUSTID_VALUE" >' +
'<input type="hidden" name="ResponseContinueURL" value="http://hmg.com/Documents/success.html" >' +
'<input type="hidden" name="BackClickUrl" value="http://hmg.com/Documents/success.html" >' +
'</form>' +
'<script type="text/javascript"> document.getElementById("paymentForm").submit(); </script>' +
'</body>' +
'</html>';
}
}
class MyChromeSafariBrowser extends ChromeSafariBrowser {

@ -1,10 +1,9 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/image.dart' as flutterImage;
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:rating_bar/rating_bar.dart';
@ -21,7 +20,7 @@ class productTile extends StatelessWidget {
final String img;
final String imgs;
final int status;
final Product product;
final PharmacyProduct product;
final dynamic productID;
productTile(

Loading…
Cancel
Save