From 7c327a591d326bd21fa269673f863f68e325cecc Mon Sep 17 00:00:00 2001 From: RXRD Date: Fri, 15 Sep 2023 15:07:54 +0700 Subject: [PATCH 1/8] Update impl_genetic_analysis_orders.rs --- .../src/impl_genetic_analysis_orders.rs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs b/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs index e75426d0..911fc268 100644 --- a/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs +++ b/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs @@ -236,7 +236,16 @@ impl GeneticAnalysisOrderInterface for Pallet { return Err(Error::::GeneticAnalysisOrderNotYetExpired) } - let total_price = genetic_analysis_order.total_price; + let mut testing_price = Zero::zero(); + let mut qc_price = Zero::zero(); + + for price in genetic_analysis_order.prices.iter() { + testing_price += price.value; + } + + for price in genetic_analysis_order.additional_prices.iter() { + qc_price += price.value; + } let asset_id = genetic_analysis_order.asset_id; let account_id = Self::account_id(); @@ -245,7 +254,15 @@ impl GeneticAnalysisOrderInterface for Pallet { &genetic_analysis_order.currency, &account_id, &genetic_analysis_order.customer_id, - total_price, + testing_price, + asset_id, + )?; + + Self::do_transfer( + &genetic_analysis_order.currency, + &account_id, + &genetic_analysis_order.seller_id, + qc_price, asset_id, )?; From f17eb1c9ddfcee521655c5eec2b3c9d0bc1d710e Mon Sep 17 00:00:00 2001 From: RXRD Date: Mon, 18 Sep 2023 15:41:24 +0700 Subject: [PATCH 2/8] Update impl_genetic_analysis_orders.rs --- .../genetic-analysis-orders/src/impl_genetic_analysis_orders.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs b/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs index 911fc268..bc227767 100644 --- a/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs +++ b/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs @@ -2,6 +2,7 @@ use crate::*; use traits_genetic_analysis_orders::{ GeneticAnalysisOrderEventEmitter, GeneticAnalysisOrderStatusUpdater, }; +use frame_support::sp_runtime::traits::Zero impl GeneticAnalysisOrderInterface for Pallet { type GeneticAnalysisOrder = GeneticAnalysisOrderOf; From 752ea9534fa6e86883fb5cef3c89c8f97fc54c86 Mon Sep 17 00:00:00 2001 From: RXRD Date: Mon, 18 Sep 2023 15:45:12 +0700 Subject: [PATCH 3/8] Update impl_genetic_analysis_orders.rs --- .../genetic-analysis-orders/src/impl_genetic_analysis_orders.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs b/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs index bc227767..8c0ea6e2 100644 --- a/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs +++ b/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs @@ -2,7 +2,7 @@ use crate::*; use traits_genetic_analysis_orders::{ GeneticAnalysisOrderEventEmitter, GeneticAnalysisOrderStatusUpdater, }; -use frame_support::sp_runtime::traits::Zero +use frame_support::sp_runtime::traits::Zero; impl GeneticAnalysisOrderInterface for Pallet { type GeneticAnalysisOrder = GeneticAnalysisOrderOf; From f47454d416c6f571897c8bfc7c94868cf0a59ae1 Mon Sep 17 00:00:00 2001 From: RXRD Date: Mon, 18 Sep 2023 15:48:39 +0700 Subject: [PATCH 4/8] Update impl_genetic_analysis_orders.rs --- .../genetic-analysis-orders/src/impl_genetic_analysis_orders.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs b/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs index 8c0ea6e2..5cbe950d 100644 --- a/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs +++ b/pallets/genetic-analysis-orders/src/impl_genetic_analysis_orders.rs @@ -1,8 +1,8 @@ use crate::*; +use frame_support::sp_runtime::traits::Zero; use traits_genetic_analysis_orders::{ GeneticAnalysisOrderEventEmitter, GeneticAnalysisOrderStatusUpdater, }; -use frame_support::sp_runtime::traits::Zero; impl GeneticAnalysisOrderInterface for Pallet { type GeneticAnalysisOrder = GeneticAnalysisOrderOf; From 86f342e90b7377e4ca170e9472e81fb3853f1abe Mon Sep 17 00:00:00 2001 From: RXRD Date: Mon, 9 Oct 2023 17:14:50 +0700 Subject: [PATCH 5/8] Update types.rs --- pallets/genetic-analysis-orders/src/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/genetic-analysis-orders/src/types.rs b/pallets/genetic-analysis-orders/src/types.rs index bd3b13da..f0cf3f07 100644 --- a/pallets/genetic-analysis-orders/src/types.rs +++ b/pallets/genetic-analysis-orders/src/types.rs @@ -126,7 +126,7 @@ where } pub fn can_refunded(self) -> Option { - if self.status == GeneticAnalysisOrderStatus::Paid { + if (self.status == GeneticAnalysisOrderStatus::Paid || self.status == GeneticAnalysisOrderStatus::Failed) { Some(self) } else { None From d2f2d157705a38c6ac6a6abbd56470ac1790b7ab Mon Sep 17 00:00:00 2001 From: RXRD Date: Mon, 9 Oct 2023 17:24:58 +0700 Subject: [PATCH 6/8] format fix --- pallets/genetic-analysis-orders/src/types.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pallets/genetic-analysis-orders/src/types.rs b/pallets/genetic-analysis-orders/src/types.rs index f0cf3f07..5ae3ab8b 100644 --- a/pallets/genetic-analysis-orders/src/types.rs +++ b/pallets/genetic-analysis-orders/src/types.rs @@ -126,7 +126,9 @@ where } pub fn can_refunded(self) -> Option { - if (self.status == GeneticAnalysisOrderStatus::Paid || self.status == GeneticAnalysisOrderStatus::Failed) { + if (self.status == GeneticAnalysisOrderStatus::Paid + || self.status == GeneticAnalysisOrderStatus::Failed) + { Some(self) } else { None From c6f25b43b33b6a52343b1c1c186eba63b07452ed Mon Sep 17 00:00:00 2001 From: RXRD Date: Mon, 9 Oct 2023 17:30:11 +0700 Subject: [PATCH 7/8] format fix --- pallets/genetic-analysis-orders/src/types.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/genetic-analysis-orders/src/types.rs b/pallets/genetic-analysis-orders/src/types.rs index 5ae3ab8b..b46e128e 100644 --- a/pallets/genetic-analysis-orders/src/types.rs +++ b/pallets/genetic-analysis-orders/src/types.rs @@ -126,8 +126,8 @@ where } pub fn can_refunded(self) -> Option { - if (self.status == GeneticAnalysisOrderStatus::Paid - || self.status == GeneticAnalysisOrderStatus::Failed) + if (self.status == GeneticAnalysisOrderStatus::Paid || + self.status == GeneticAnalysisOrderStatus::Failed) { Some(self) } else { From b95f817dc014f3cee280a2e560f7606147887973 Mon Sep 17 00:00:00 2001 From: RXRD Date: Tue, 10 Oct 2023 09:41:03 +0700 Subject: [PATCH 8/8] Update types.rs --- pallets/genetic-analysis-orders/src/types.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/genetic-analysis-orders/src/types.rs b/pallets/genetic-analysis-orders/src/types.rs index b46e128e..60baa9b7 100644 --- a/pallets/genetic-analysis-orders/src/types.rs +++ b/pallets/genetic-analysis-orders/src/types.rs @@ -126,8 +126,8 @@ where } pub fn can_refunded(self) -> Option { - if (self.status == GeneticAnalysisOrderStatus::Paid || - self.status == GeneticAnalysisOrderStatus::Failed) + if self.status == GeneticAnalysisOrderStatus::Paid || + self.status == GeneticAnalysisOrderStatus::Failed { Some(self) } else {