This is my interface
public partial interface IPaymentMethod
{
void ProcessPayment(PaymentInfo paymentInfo, Customer customer,
Guid orderGuid, ref ProcessPaymentResult processPaymentResult);
void Capture(Order order, ref ProcessPaymentResult processPaymentResult);
void Refund(Order order, ref CancelPaymentResult cancelPaymentResult);
}
我想實現PaypalPaymentProcessor.cs這個接口正確,AuthorizeNet.cs是下面的執行實現支付網關是應用服務
public class PayPalExpressPaymentProcessor : IPaymentMethod
{
public void ProcessPayment(PaymentInfo paymentInfo, Customer customer, Guid orderGuid, ref ProcessPaymentResult processPaymentResult)
{
//Some code
}
void Capture(Order order, ref ProcessPaymentResult processPaymentResult)
{
// Some Code
}
void Refund(Order order, ref CancelPaymentResult cancelPaymentResult)
{
// Some Code
}
}
//同爲AuthorizNetPaymentProcessor類。這兩個類都用於支付網關。但我很困惑,我把以上界面和類在應用程序服務。因爲這兩個類都不適合成爲域的一部分而不適用於域服務。
是否可以將它們放在應用程序服務,並創建從那裏,我會打電話給他們在應用服務PaymentService類。我可以做這些嗎?
PayPalExpressPaymentProcessor,這個類通過調用PayPal的api函數與所需的參數進行對話,與AuthorizePaymentProcessor相同,它將與授權支付網關進行通信。但是我在想如何將這些類放在應用層中,並創建另一個類叫PaymentService,它將在這個類中調用函數。但是現在你已經說過它應該在INFRA層中。因此,如果我們想與外部系統進行交流,那麼包裝類應該位於底層,並從App服務層調用函數。我對嗎 ? – kamal 2011-04-08 10:18:05
DO應用層只能包含服務類,而不是包裝類。我正在考慮將包裝類放在應用層的文件夾中,因爲我讀了很多應用層與外部系統交談的地方。 – kamal 2011-04-08 10:21:37
看到我的第二個答案。無法創建評論。我不知道爲什麼... – 2011-04-08 11:25:35