add payment
This commit is contained in:
@@ -25,4 +25,10 @@ class FcsShipmentDataProvider {
|
||||
return await requestAPI("/fcs_shipments/ship", "PUT",
|
||||
payload: fcsShipment.toMap(), token: await getToken());
|
||||
}
|
||||
|
||||
Future<String> reportFcsShipment(FcsShipment fcsShipment) async {
|
||||
dynamic data = await requestAPI("/fcs_shipments/report", "POST",
|
||||
payload: fcsShipment.toMap(), token: await getToken());
|
||||
return data["url"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:fcs/domain/entities/invoice.dart';
|
||||
import 'package:fcs/domain/entities/payment.dart';
|
||||
import 'package:fcs/helpers/api_helper.dart';
|
||||
import 'package:fcs/helpers/firebase_helper.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
@@ -22,4 +23,14 @@ class InvoiceDataProvider {
|
||||
return await requestAPI("/invoices/cancel", "PUT",
|
||||
payload: {"id": invoice.id}, token: await getToken());
|
||||
}
|
||||
|
||||
Future<void> pay(Payment payment) async {
|
||||
return await requestAPI("/invoices/pay", "PUT",
|
||||
payload: payment.toMap(), token: await getToken());
|
||||
}
|
||||
|
||||
Future<void> updatPaymentStatus(Payment payment) async {
|
||||
return await requestAPI("/invoices/pay/status", "PUT",
|
||||
payload: payment.toMap(), token: await getToken());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,4 +33,9 @@ class FcsShipmentServiceImp implements FcsShipmentService {
|
||||
Future<void> ship(FcsShipment fcsShipment) {
|
||||
return shipmentDataProvider.ship(fcsShipment);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String> report(FcsShipment fcsShipment) {
|
||||
return shipmentDataProvider.reportFcsShipment(fcsShipment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,5 @@ abstract class FcsShipmentService {
|
||||
Future<void> updateFcsShipment(FcsShipment fcsShipment);
|
||||
Future<void> deleteFcsShipment(FcsShipment fcsShipment);
|
||||
Future<void> ship(FcsShipment fcsShipment);
|
||||
Future<String> report(FcsShipment fcsShipment);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:fcs/data/provider/shipment_data_provider.dart';
|
||||
import 'package:fcs/data/services/shipment_service.dart';
|
||||
import 'package:fcs/domain/entities/connectivity.dart';
|
||||
import 'package:fcs/domain/entities/invoice.dart';
|
||||
import 'package:fcs/domain/entities/payment.dart';
|
||||
import 'package:fcs/domain/entities/shipment.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -31,4 +32,14 @@ class InvoiceServiceImp implements InvoiceService {
|
||||
Future<void> updateInvoice(Invoice invoice) {
|
||||
return invoiceDataProvider.updateInvoice(invoice);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> pay(Payment payment) {
|
||||
return invoiceDataProvider.pay(payment);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> updatPaymentStatus(Payment payment) {
|
||||
return invoiceDataProvider.updatPaymentStatus(payment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import 'package:fcs/domain/entities/invoice.dart';
|
||||
import 'package:fcs/domain/entities/shipment.dart';
|
||||
import 'package:fcs/domain/entities/payment.dart';
|
||||
|
||||
abstract class InvoiceService {
|
||||
Future<void> createInvoice(Invoice invoice);
|
||||
Future<void> updateInvoice(Invoice invoice);
|
||||
Future<void> cancelInvoice(Invoice invoice);
|
||||
Future<void> pay(Payment payment);
|
||||
Future<void> updatPaymentStatus(Payment payment);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user