本文整理汇总了C#中Models.SetPaidForOthers方法的典型用法代码示例。如果您正苦于以下问题:C# Models.SetPaidForOthers方法的具体用法?C# Models.SetPaidForOthers怎么用?C# Models.SetPaidForOthers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Models
的用法示例。
在下文中一共展示了Models.SetPaidForOthers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RefreshPaymentAsync
// TODO:
// 이 로직은 비지니스 로직을 담고 있습니다.
// 비즈니스 레이어로 옮기는 것이 좋습니다.
private async Task RefreshPaymentAsync(Models.Payment payment)
{
var iamportPayment = await paymentsApi.GetByTransactionIdAsync(payment.TransactionId);
if (iamportPayment == null)
{
throw new InvalidOperationException("Failed to get payment information from Iamport.");
}
// 기존 상태(payment.State)와 최신 상태(iamportPayment.Status)를 비교합니다.
switch (iamportPayment.Status)
{
case PaymentStatus.Ready:
if (iamportPayment.Method == PaymentMethod.VirtualBank
&& !string.IsNullOrEmpty(iamportPayment.VirtualBankAccount))
{
payment.SetAwatingForVirtualBank(
iamportPayment.IamportId,
iamportPayment.PaymentGatewayTransactionId,
iamportPayment.VirtualBankName,
iamportPayment.VirtualBankAccount,
iamportPayment.VirtualBankAccountHolder);
}
else
{
payment.SetInProgress(iamportPayment.IamportId);
}
break;
case PaymentStatus.Paid:
switch (iamportPayment.Method)
{
case PaymentMethod.CreditCard:
payment.SetPaidForCreditCard(
iamportPayment.IamportId,
iamportPayment.PaidAtUtc,
iamportPayment.PaymentGatewayTransactionId,
iamportPayment.ApplyNumber,
iamportPayment.CreditCardCompanyName,
iamportPayment.InstallmentPlanPeriod);
break;
case PaymentMethod.VirtualBank:
payment.SetPaiedForVirtualBank(
iamportPayment.IamportId,
iamportPayment.PaidAtUtc,
iamportPayment.PaymentGatewayTransactionId,
iamportPayment.VirtualBankName,
iamportPayment.VirtualBankAccount,
iamportPayment.VirtualBankAccountHolder);
break;
case PaymentMethod.Transfer:
case PaymentMethod.Mobile:
case PaymentMethod.CultureLand:
case PaymentMethod.SmartCulture:
case PaymentMethod.HappyMoney:
default:
payment.SetPaidForOthers(
iamportPayment.IamportId,
iamportPayment.PaidAtUtc,
iamportPayment.PaymentGatewayTransactionId);
break;
}
break;
case PaymentStatus.Cancelled:
payment.SetCancelled(
iamportPayment.IamportId,
iamportPayment.CancelledAtUtc,
iamportPayment.CancelledReason,
iamportPayment.CancelledAmount);
break;
case PaymentStatus.Failed:
payment.SetFailed(
iamportPayment.IamportId,
iamportPayment.FailedAtUtc,
iamportPayment.FailedReason);
break;
default:
break;
}
paymentRepository.Update(payment);
}