896 lines
34 KiB
C#
896 lines
34 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Input;
|
|
using System.Windows.Threading;
|
|
using SPC.Kiosk.Base;
|
|
using SPC.Kiosk.Common;
|
|
using SPC.Kiosk.Popup.Model;
|
|
using SPC.Kiosk.Payments;
|
|
|
|
namespace SPC.Kiosk.Popup.ViewModel
|
|
{
|
|
/// <summary>
|
|
/// HappyPointCertify.xaml에 대한 ViewModel
|
|
/// </summary>
|
|
public class VmPaymentProcess : PopupViewModelBase
|
|
{
|
|
#region [ Members ]
|
|
private string titileImage;
|
|
/// <summary>
|
|
/// Read Barcode Formated Text
|
|
/// </summary>
|
|
public string TitileImage
|
|
{
|
|
get { return titileImage; }
|
|
set { titileImage = value; PropertyChange("TitileImage"); }
|
|
}
|
|
private string processingGIF;
|
|
/// <summary>
|
|
/// Processing GIF
|
|
/// </summary>
|
|
public string ProcessingGIF
|
|
{
|
|
get { return processingGIF; }
|
|
set { processingGIF = value; PropertyChange("ProcessingGIF"); }
|
|
}
|
|
private string errorImage;
|
|
/// <summary>
|
|
/// Error Icon
|
|
/// </summary>
|
|
public string ErrorImage
|
|
{
|
|
get { return errorImage; }
|
|
set { errorImage = value; PropertyChange("ErrorImage"); }
|
|
}
|
|
private string successImage;
|
|
/// <summary>
|
|
/// Sucess Icon
|
|
/// </summary>
|
|
public string SuccessImage
|
|
{
|
|
get { return successImage; }
|
|
set { successImage = value; PropertyChange("SuccessImage"); }
|
|
}
|
|
private List<M_Language> headerText;
|
|
/// <summary>
|
|
/// Top Header Text
|
|
/// </summary>
|
|
public List<M_Language> HeaderText
|
|
{
|
|
get { return headerText; }
|
|
set { headerText = value; PropertyChange("HeaderText"); }
|
|
}
|
|
private List<M_Language> scanGuidText;
|
|
/// <summary>
|
|
/// Second Sub Header Text
|
|
/// </summary>
|
|
public List<M_Language> ScanGuidText
|
|
{
|
|
get { return scanGuidText; }
|
|
set { scanGuidText = value; PropertyChange("ScanGuidText"); }
|
|
}
|
|
private List<M_Language> processingMessageText;
|
|
/// <summary>
|
|
/// Number Pad Input Guide Text
|
|
/// </summary>
|
|
public List<M_Language> ProcessingMessageText
|
|
{
|
|
get { return processingMessageText; }
|
|
set { processingMessageText = value; PropertyChange("ProcessingMessageText"); }
|
|
}
|
|
private List<M_Language> processingGuide;
|
|
/// <summary>
|
|
/// Processing Guide Text
|
|
/// </summary>
|
|
public List<M_Language> ProcessingGuide
|
|
{
|
|
get { return processingGuide; }
|
|
set { processingGuide = value; PropertyChange("ProcessingGuide"); }
|
|
}
|
|
private List<M_Language> errorGuide;
|
|
/// <summary>
|
|
/// Error Guide Text
|
|
/// </summary>
|
|
public List<M_Language> ErrorGuide
|
|
{
|
|
get { return errorGuide; }
|
|
set { errorGuide = value; PropertyChange("ErrorGuide"); }
|
|
}
|
|
|
|
private List<M_Language> infoGuid1Text;
|
|
/// <summary>
|
|
/// Bootom first infomation text
|
|
/// </summary>
|
|
public List<M_Language> InfoGuid1Text
|
|
{
|
|
get { return infoGuid1Text; }
|
|
set { infoGuid1Text = value; PropertyChange("InfoGuid1Text"); }
|
|
}
|
|
private TextAlignment infoGuid1TextAlignment = TextAlignment.Left;
|
|
public TextAlignment InfoGuid1TextAlignment
|
|
{
|
|
get { return infoGuid1TextAlignment; }
|
|
set { infoGuid1TextAlignment = value; PropertyChange("InfoGuid1TextAlignment"); }
|
|
}
|
|
private List<M_Language> infoGuid2Text;
|
|
/// <summary>
|
|
/// Bootom Second infomation text
|
|
/// </summary>
|
|
public List<M_Language> InfoGuid2Text
|
|
{
|
|
get { return infoGuid2Text; }
|
|
set { infoGuid2Text = value; PropertyChange("InfoGuid2Text"); }
|
|
}
|
|
private List<M_Language> leftInfomationText;
|
|
/// <summary>
|
|
/// Bootom Second infomation text
|
|
/// </summary>
|
|
public List<M_Language> LeftInfomationText
|
|
{
|
|
get { return leftInfomationText; }
|
|
set { leftInfomationText = value; PropertyChange("LeftInfomationText"); }
|
|
}
|
|
private bool paymentStartVisible = false;
|
|
/// <summary>
|
|
/// ReadCardOrBarCode Window Is Visible
|
|
/// </summary>
|
|
public bool PaymentStartVisible
|
|
{
|
|
get { return paymentStartVisible; }
|
|
set { paymentStartVisible = value; PropertyChange("PaymentStartVisible"); }
|
|
}
|
|
private bool readSignVisible = false;
|
|
/// <summary>
|
|
/// PaymentProcessing Window Is Visible
|
|
/// </summary>
|
|
public bool ReadSignVisible
|
|
{
|
|
get { return readSignVisible; }
|
|
set { readSignVisible = value; PropertyChange("ReadSignVisible"); }
|
|
}
|
|
private bool paymentProcessingVisible = false;
|
|
/// <summary>
|
|
/// PaymentProcessing Window Is Visible
|
|
/// </summary>
|
|
public bool PaymentProcessingVisible
|
|
{
|
|
get { return paymentProcessingVisible; }
|
|
set { paymentProcessingVisible = value; PropertyChange("PaymentProcessingVisible"); }
|
|
}
|
|
private bool processingErrorVisible = false;
|
|
/// <summary>
|
|
/// ProcessingError Window Is Visible
|
|
/// </summary>
|
|
public bool ProcessingErrorVisible
|
|
{
|
|
get { return processingErrorVisible; }
|
|
set { processingErrorVisible = value; PropertyChange("ProcessingErrorVisible"); }
|
|
}
|
|
|
|
private bool paymentSuccessVisible = false;
|
|
/// <summary>
|
|
/// Payment Success Window Is Visible
|
|
/// </summary>
|
|
public bool PaymentSuccessVisible
|
|
{
|
|
get { return paymentSuccessVisible; }
|
|
set { paymentSuccessVisible = value; PropertyChange("PaymentSuccessVisible"); }
|
|
}
|
|
private List<M_Language> errorText;
|
|
/// <summary>
|
|
/// Process Error Text
|
|
/// </summary>
|
|
public List<M_Language> ErrorText
|
|
{
|
|
get { return errorText; }
|
|
set { errorText = value; PropertyChange("ErrorText"); }
|
|
}
|
|
private bool isErrorBlink = false;
|
|
/// <summary>
|
|
/// Is Error Text Blink
|
|
/// </summary>
|
|
public bool IsErrorBlink
|
|
{
|
|
get { return isErrorBlink; }
|
|
set { isErrorBlink = value; PropertyChange("IsErrorBlink"); }
|
|
}
|
|
private string formatedBarCode;
|
|
/// <summary>
|
|
/// Read Barcode Formated Text
|
|
/// </summary>
|
|
public string FormatedBarCode
|
|
{
|
|
get { return formatedBarCode; }
|
|
set { formatedBarCode = value; PropertyChange("FormatedBarCode"); }
|
|
}
|
|
private string readBarCode;
|
|
/// <summary>
|
|
/// Read Barcode
|
|
/// </summary>
|
|
public string ReadBarCode
|
|
{
|
|
get { return readBarCode; }
|
|
set { readBarCode = value; PropertyChange("ReadBarCode"); }
|
|
}
|
|
private double payments;
|
|
/// <summary>
|
|
/// Total Payments
|
|
/// </summary>
|
|
public double Payments
|
|
{
|
|
get { return payments; }
|
|
set { payments = value; PropertyChange("Payments"); }
|
|
}
|
|
private string showPayment;
|
|
/// <summary>
|
|
/// Total Payments
|
|
/// </summary>
|
|
public string ShowPayment
|
|
{
|
|
get { return showPayment; }
|
|
set { showPayment = value; PropertyChange("ShowPayment"); }
|
|
}
|
|
private double popupWidth = 1300d;
|
|
/// <summary>
|
|
/// Popup Whidth (For Calculate OK Button Width)
|
|
/// </summary>
|
|
public double PopupWidth
|
|
{
|
|
get { return popupWidth; }
|
|
set { popupWidth = value; PropertyChange("PopupWidth"); }
|
|
}
|
|
private List<M_Language> cancelButtonText;
|
|
/// <summary>
|
|
/// Cancel Button Text
|
|
/// </summary>
|
|
public List<M_Language> CancelButtonText
|
|
{
|
|
get { return cancelButtonText; }
|
|
set { cancelButtonText = value; PropertyChange("CancelButtonText"); }
|
|
}
|
|
|
|
private double cancelButtonWidth = 650d;
|
|
/// <summary>
|
|
/// Cancel Button Width
|
|
/// </summary>
|
|
public double CancelButtonWidth
|
|
{
|
|
get { return cancelButtonWidth; }
|
|
set { cancelButtonWidth = value; PropertyChange("CancelButtonWidth"); }
|
|
}
|
|
|
|
private List<M_Language> okButtonText;
|
|
/// <summary>
|
|
/// OK Button Text
|
|
/// </summary>
|
|
public List<M_Language> OkButtonText
|
|
{
|
|
get { return okButtonText; }
|
|
set { okButtonText = value; PropertyChange("OkButtonText"); }
|
|
}
|
|
private bool oKButtonEnabled = false;
|
|
/// <summary>
|
|
/// OK Button Enabled
|
|
/// </summary>
|
|
public bool OKButtonEnabled
|
|
{
|
|
get { return oKButtonEnabled; }
|
|
set { oKButtonEnabled = value; PropertyChange("OKButtonEnabled"); }
|
|
}
|
|
|
|
private double okButtonWidth = 650d;
|
|
/// <summary>
|
|
/// OK Button Width
|
|
/// </summary>
|
|
public double OKButtonWidth
|
|
{
|
|
get { return okButtonWidth; }
|
|
set { okButtonWidth = value; PropertyChange("OKButtonWidth"); }
|
|
}
|
|
private string signData;
|
|
/// <summary>
|
|
/// SignData
|
|
/// </summary>
|
|
public string SignData
|
|
{
|
|
get { return signData; }
|
|
set { signData = value; PropertyChange("SignData"); }
|
|
}
|
|
private string signFile;
|
|
/// <summary>
|
|
/// SignFile
|
|
/// </summary>
|
|
public string SignFile
|
|
{
|
|
get { return signFile; }
|
|
set { signFile = value; PropertyChange("SignFile"); }
|
|
}
|
|
private bool useableSign;
|
|
/// <summary>
|
|
/// Useable Sign
|
|
/// </summary>
|
|
public bool UseableSign
|
|
{
|
|
get { return useableSign; }
|
|
set { useableSign = value; PropertyChange("UseableSign"); }
|
|
}
|
|
private bool signEnd;
|
|
/// <summary>
|
|
/// Sign End
|
|
/// </summary>
|
|
public bool SignEnd
|
|
{
|
|
get { return signEnd; }
|
|
set { signEnd = value; PropertyChange("SignEnd"); }
|
|
}
|
|
private bool signReset;
|
|
/// <summary>
|
|
/// Sign Reset
|
|
/// </summary>
|
|
public bool SignReset
|
|
{
|
|
get { return signReset; }
|
|
set { signReset = value; PropertyChange("SignReset"); }
|
|
}
|
|
/// <summary>
|
|
/// 결제 처리 정보
|
|
/// </summary>
|
|
public M_PaymentReturn PaymentReturn { get; set; }
|
|
/// <summary>
|
|
/// OK Click Command
|
|
/// </summary>
|
|
public ICommand OkCommand { get; protected set; }
|
|
|
|
/// <summary>
|
|
/// Cancel Click Command
|
|
/// </summary>
|
|
public ICommand CancelCommand { get; protected set; }
|
|
private LastPaymentsType paymentType = LastPaymentsType.None;
|
|
public LastPaymentsType PaymentType
|
|
{
|
|
get { return paymentType; }
|
|
set { paymentType = value; PropertyChange("PaymentType"); }
|
|
}
|
|
private PaymentWindowType paymentWindow = PaymentWindowType.None;
|
|
/// <summary>
|
|
/// Current View Window
|
|
/// </summary>
|
|
public PaymentWindowType PaymentWindow
|
|
{
|
|
get { return paymentWindow; }
|
|
set { paymentWindow = value; PropertyChange("PaymentWindow"); }
|
|
}
|
|
public bool ImmediatelyClose { get; protected set; } = false;
|
|
|
|
private bool ProcessStart = false;
|
|
private posLastPayments PosLastPayments = null;
|
|
|
|
private Task ProcessTask = null;
|
|
private Task ProcessTask2 = null;
|
|
private CancellationTokenSource TokenSource;
|
|
private string certifyKey = string.Empty;
|
|
|
|
#endregion
|
|
|
|
#region [ Ctor ]
|
|
/// <summary>
|
|
/// Ctor
|
|
/// </summary>
|
|
public VmPaymentProcess()
|
|
{
|
|
OkCommand = new Command(OkCommandHandler);
|
|
CancelCommand = new Command(CancelCommandHandler);
|
|
this.PropertyChanged += VmHappyPointCertify_PropertyChanged;
|
|
|
|
ProcessingGIF = ResourceManager.GetNximagePathAdd("ic_alert_ing2.gif", CommonValue.PBdesignImagesPath);
|
|
SuccessImage = ResourceManager.GetNximagePathAdd("ic_alert_check.png", CommonValue.PBdesignImagesPath);
|
|
ErrorImage = ResourceManager.GetNximagePathAdd("ic_alert_error.png", CommonValue.PBdesignImagesPath);
|
|
HeaderText = Languages.GetMessages("LBL0026");
|
|
|
|
ProcessingMessageText = Languages.GetMessages("LBL0031");
|
|
ProcessingGuide = Languages.GetMessages("LBL0140");
|
|
ErrorGuide = Languages.GetMessages("LBL0028");
|
|
ErrorText = new List<M_Language>();
|
|
ShowLanguageType = CommonValue.CommonLanguageType;
|
|
PaymentWindow = PaymentWindowType.PaymentStart;
|
|
PosLastPayments = new posLastPayments();
|
|
}
|
|
/// <summary>
|
|
/// Dispose()
|
|
/// </summary>
|
|
public new void Dispose()
|
|
{
|
|
this.TitileImage = string.Empty;
|
|
this.ProcessingGIF = string.Empty;
|
|
this.ErrorImage = string.Empty;
|
|
this.PropertyChanged -= VmHappyPointCertify_PropertyChanged;
|
|
if (TokenSource != null)
|
|
{
|
|
TokenSource.Cancel();
|
|
}
|
|
if (PosLastPayments != null)
|
|
{
|
|
PaymentProcessRemoveEvents();
|
|
PosLastPayments.Dispose();
|
|
PosLastPayments = null;
|
|
}
|
|
if (ProcessTask != null)
|
|
{
|
|
//ProcessTask.Dispose();
|
|
ProcessTask = null;
|
|
}
|
|
base.Dispose();
|
|
}
|
|
#endregion Ctor
|
|
|
|
#region [ Methods ]
|
|
private void PaymentProcessCreateEvents()
|
|
{
|
|
if (PosLastPayments != null)
|
|
{
|
|
PosLastPayments.ReadStart += posLastPayments_ReadStart;
|
|
PosLastPayments.ReadEnd += posLastPayments_ReadEnd;
|
|
PosLastPayments.SignStartEvent += posLastPayments_SignStartEvent;
|
|
PosLastPayments.SignEndEvent += PosLastPayments_SignEndEvent;
|
|
PosLastPayments.ErrorEvent += posLastPayments_ErrorEvent;
|
|
PosLastPayments.ErrorMessageEvent += posLastPayments_ErrorMessageEvent;
|
|
}
|
|
}
|
|
|
|
private void posLastPayments_SignStartEvent(object sender)
|
|
{
|
|
PaymentWindow = PaymentWindowType.ReadSign;
|
|
}
|
|
|
|
private void PosLastPayments_SignEndEvent(object sender)
|
|
{
|
|
PaymentWindow = PaymentWindowType.PaymentProcessing;
|
|
}
|
|
|
|
private void PaymentProcessRemoveEvents()
|
|
{
|
|
if (PosLastPayments != null)
|
|
{
|
|
PosLastPayments.ReadStart -= posLastPayments_ReadStart;
|
|
PosLastPayments.ReadEnd -= posLastPayments_ReadEnd;
|
|
PosLastPayments.SignStartEvent -= posLastPayments_SignStartEvent;
|
|
PosLastPayments.SignEndEvent -= PosLastPayments_SignEndEvent;
|
|
PosLastPayments.ErrorEvent -= posLastPayments_ErrorEvent;
|
|
PosLastPayments.ErrorMessageEvent -= posLastPayments_ErrorMessageEvent;
|
|
}
|
|
}
|
|
|
|
private void DoPaymentProcess()
|
|
{
|
|
|
|
|
|
try
|
|
{
|
|
#region 결제 처리 Task 처리
|
|
PosLastPayments.NoSignLimitAmount = CommonValue.NoSignAmountMaxLimit;
|
|
if (PosLastPayments != null)
|
|
{
|
|
TimerEnabled = false;
|
|
SignReset = false;
|
|
SignEnd = false;
|
|
PaymentProcessCreateEvents();
|
|
ProcessTask2 = new Task(() => PosLastPayments.StartCertifyProcessing(PaymentType, certifyKey, Payments));
|
|
TokenSource = new CancellationTokenSource();
|
|
ProcessTask2.Start();
|
|
ProcessTask2.Wait();
|
|
PaymentProcessRemoveEvents();
|
|
PaymentWindow = PosLastPayments.ProcessOK ? PaymentWindowType.PaymentSuccess : PaymentWindowType.ProcessingError;
|
|
TokenSource.Dispose();
|
|
ProcessTask2.Dispose();
|
|
ProcessTask2 = null;
|
|
TokenSource = null;
|
|
}
|
|
#endregion
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CommonLog.ErrorLogWrite(this, "DoPaymentProcess()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
|
|
}
|
|
finally
|
|
{
|
|
TimerEnabled = true;
|
|
}
|
|
}
|
|
#endregion Methods
|
|
|
|
#region [ Event Handlers ]
|
|
|
|
private void CancelCommandHandler(object obj)
|
|
{
|
|
switch (PaymentWindow)
|
|
{
|
|
case PaymentWindowType.ProcessingError:
|
|
case PaymentWindowType.PaymentStart:
|
|
TimerEnabled = false;
|
|
ReturnValue = new M_PopupReturn
|
|
{
|
|
OKAnswer = false,
|
|
TimeOut = false,
|
|
ReturnLanguage = ShowLanguageType,
|
|
PopupArgs = null
|
|
};
|
|
CanWindowClose = true;
|
|
break;
|
|
case PaymentWindowType.ReadSign:
|
|
SignReset = true;
|
|
break;
|
|
}
|
|
|
|
}
|
|
private void OkCommandHandler(object obj)
|
|
{
|
|
switch (PaymentWindow)
|
|
{
|
|
case PaymentWindowType.ProcessingError:
|
|
PaymentWindow = PaymentWindowType.PaymentStart;
|
|
break;
|
|
case PaymentWindowType.PaymentSuccess:
|
|
if (ProcessTask != null) ProcessTask.Wait();
|
|
CanWindowClose = true;
|
|
break;
|
|
case PaymentWindowType.ReadSign:
|
|
SignEnd = true;
|
|
break;
|
|
}
|
|
}
|
|
private void posLastPayments_ErrorMessageEvent(string ErrorString)
|
|
{
|
|
ErrorText = new List<M_Language>
|
|
{
|
|
new M_Language
|
|
{
|
|
Type = SupportLanguageType.ko,
|
|
LanguageData = ErrorString.Replace("\n"," ").Replace("\r","")
|
|
},
|
|
};
|
|
IsErrorBlink = true;
|
|
}
|
|
|
|
private void posLastPayments_ErrorEvent(posLastPayments.ErrorCode _errorCode)
|
|
{
|
|
//TODO: 공통에 에러 메세지 등록 필요
|
|
//ErrorText = Languages.GetMessages(_errorCode.ToString());
|
|
var errTxt = string.Empty;
|
|
|
|
switch (_errorCode)
|
|
{
|
|
case posLastPayments.ErrorCode.LastPaymentsCardNumberError:
|
|
errTxt = "카드를 리딩에 실패했습니다. \n다시 결제 버튼을 눌러 다시 시도하세요.";
|
|
break;
|
|
case posLastPayments.ErrorCode.LastPaymentsCardReadingError:
|
|
errTxt = "카드를 리딩에 실패했습니다. \n다시 결제 버튼을 눌러 다시 시도하세요.";
|
|
break;
|
|
case posLastPayments.ErrorCode.LastPaymentsEncrtipError:
|
|
errTxt = "암호화 에러가 발생했습니다.";
|
|
break;
|
|
case posLastPayments.ErrorCode.LastPaymentsNotInitailzedError:
|
|
errTxt = "초기화 에러가 발생했습니다.";
|
|
break;
|
|
case posLastPayments.ErrorCode.LastPaymentsProcessingTimeOut:
|
|
errTxt = "처리시간이 초과되었습니다. \n재결제 버튼을 눌러 다시 시도하세요.";
|
|
break;
|
|
case posLastPayments.ErrorCode.LastPaymentsUnknownError:
|
|
errTxt = "에러가 발생했습니다.";
|
|
break;
|
|
default:
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
ErrorText = new List<M_Language>
|
|
{
|
|
new M_Language
|
|
{
|
|
Type = SupportLanguageType.ko,
|
|
//LanguageData = _errorCode.ToString()
|
|
LanguageData = errTxt
|
|
},
|
|
};
|
|
IsErrorBlink = true;
|
|
}
|
|
|
|
private void posLastPayments_ReadStart(object sender)
|
|
{
|
|
TimerEnabled = false;
|
|
ProcessStart = true;
|
|
switch (PaymentType)
|
|
{
|
|
case LastPaymentsType.IcCard:
|
|
case LastPaymentsType.SsLgPay:
|
|
case LastPaymentsType.CashBee:
|
|
case LastPaymentsType.HappyGift:
|
|
case LastPaymentsType.Tmoney:
|
|
case LastPaymentsType.SpcEmployee:
|
|
case LastPaymentsType.SmilePay:
|
|
PaymentWindow = PaymentWindowType.PaymentProcessing;
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void posLastPayments_ReadEnd(object sender)
|
|
{
|
|
ProcessStart = false;
|
|
try
|
|
{
|
|
if (sender is posLastPayments getposLastPayments)
|
|
{
|
|
if (getposLastPayments.ProcessOK)
|
|
{
|
|
PaymentReturn = new M_PaymentReturn
|
|
{
|
|
IsProcessOK = true,
|
|
PaymentsTotal = getposLastPayments.PaymentsValue,
|
|
PaySEQ = getposLastPayments.PaySEQ,
|
|
|
|
};
|
|
ReturnValue = new M_PopupReturn
|
|
{
|
|
OKAnswer = true,
|
|
TimeOut = false,
|
|
ReturnLanguage = ShowLanguageType,
|
|
PopupArgs = PaymentReturn
|
|
|
|
};
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CommonLog.ErrorLogWrite(this, "posLastPayments_ReadEnd()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
|
|
}
|
|
|
|
}
|
|
private void VmHappyPointCertify_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
switch (e.PropertyName)
|
|
{
|
|
case "IsTimeout":
|
|
if (IsTimeout)
|
|
{
|
|
#region 입력시간 초과시
|
|
switch (PaymentWindow)
|
|
{
|
|
case PaymentWindowType.PaymentStart:
|
|
case PaymentWindowType.ProcessingError:
|
|
ReturnValue = new M_PopupReturn
|
|
{
|
|
OKAnswer = false,
|
|
TimeOut = true,
|
|
ReturnLanguage = ShowLanguageType,
|
|
PopupArgs = null
|
|
};
|
|
break;
|
|
}
|
|
if (!ProcessStart) CanWindowClose = true;
|
|
#endregion
|
|
}
|
|
break;
|
|
case "PaymentWindow":
|
|
#region 창 모두 안보이게 하기
|
|
PaymentStartVisible = false;
|
|
ReadSignVisible = false;
|
|
PaymentProcessingVisible = false;
|
|
ProcessingErrorVisible = false;
|
|
PaymentSuccessVisible = false;
|
|
#endregion
|
|
|
|
#region 선택창 보이기
|
|
switch (PaymentWindow)
|
|
{
|
|
case PaymentWindowType.PaymentStart:
|
|
PaymentStartVisible = true;
|
|
break;
|
|
case PaymentWindowType.ReadSign:
|
|
ReadSignVisible = true;
|
|
break;
|
|
case PaymentWindowType.PaymentProcessing:
|
|
PaymentProcessingVisible = true;
|
|
break;
|
|
case PaymentWindowType.ProcessingError:
|
|
ProcessingErrorVisible = true;
|
|
break;
|
|
case PaymentWindowType.PaymentSuccess:
|
|
PaymentSuccessVisible = true;
|
|
break;
|
|
}
|
|
#endregion
|
|
break;
|
|
case "PaymentType":
|
|
switch (PaymentType)
|
|
{
|
|
case LastPaymentsType.IcCard:
|
|
TitileImage = ResourceManager.GetNximagePathAdd("img_gif_card.gif", CommonValue.PBdesignImagesPath);
|
|
ScanGuidText = Languages.GetMessages("LBL0084");
|
|
break;
|
|
case LastPaymentsType.SsLgPay:
|
|
TitileImage = ResourceManager.GetNximagePathAdd("img_gif_pay.gif", CommonValue.PBdesignImagesPath);
|
|
ScanGuidText = Languages.GetMessages("LBL0083");
|
|
break;
|
|
case LastPaymentsType.SmilePay:
|
|
TitileImage = ResourceManager.GetNximagePathAdd("img_gif_barcode.gif", CommonValue.PBdesignImagesPath);
|
|
ScanGuidText = Languages.GetMessages("LBL0082");
|
|
break;
|
|
}
|
|
break;
|
|
case "PaymentStartVisible":
|
|
if (PaymentStartVisible)
|
|
{
|
|
#region 카드 또는 신용카드 리딩 처리
|
|
InfoGuid1Text = new List<M_Language>();
|
|
InfoGuid2Text = new List<M_Language>();
|
|
InfoGuid1TextAlignment = TextAlignment.Left;
|
|
CancelButtonText = Languages.GetMessages("BTN0033");
|
|
CancelButtonWidth = PopupWidth;
|
|
OKButtonWidth = 0;
|
|
TimeOutSeconds = CommonValue.TimeOutSeconds;
|
|
switch (PaymentType)
|
|
{
|
|
case LastPaymentsType.IcCard:
|
|
case LastPaymentsType.SsLgPay:
|
|
case LastPaymentsType.CashBee:
|
|
case LastPaymentsType.HappyGift:
|
|
case LastPaymentsType.Tmoney:
|
|
case LastPaymentsType.SpcEmployee:
|
|
if (ProcessTask != null) ProcessTask.Wait();
|
|
ProcessTask = new Task(DoPaymentProcess);
|
|
ProcessTask.Start();
|
|
break;
|
|
}
|
|
#endregion
|
|
}
|
|
break;
|
|
case "ReadSignVisible":
|
|
if (ReadSignVisible)
|
|
{
|
|
ScanGuidText = Languages.GetMessages("LBL0072");
|
|
InfoGuid1Text = Languages.GetMessages("LBL0066");
|
|
InfoGuid2Text = new List<M_Language>
|
|
{
|
|
new M_Language
|
|
{
|
|
Type = SupportLanguageType.ko,
|
|
LanguageData = "* 싸인이 너무 짧거나 길면 확인 버튼이 활성화 되지 않습니다."
|
|
},
|
|
new M_Language
|
|
{
|
|
Type = SupportLanguageType.en,
|
|
LanguageData = "en* * * 싸인이 너무 짧거나 길면 확인 버튼이 활성화 되지 않습니다."
|
|
},
|
|
};
|
|
CancelButtonText = Languages.GetMessages("BTN0007");
|
|
CancelButtonWidth = PopupWidth / 2;
|
|
OkButtonText = Languages.GetMessages("BTN0024");
|
|
OKButtonWidth = PopupWidth / 2;
|
|
OKButtonEnabled = false;
|
|
}
|
|
break;
|
|
case "PaymentProcessingVisible":
|
|
if (PaymentProcessingVisible)
|
|
{
|
|
if (PaymentType == LastPaymentsType.SmilePay)
|
|
{
|
|
//ScanGuidText = Languages.GetMessages("LBL0087");
|
|
ProcessingMessageText = Languages.GetMessages("LBL0087");
|
|
}
|
|
else
|
|
{
|
|
ScanGuidText = Languages.GetMessages("LBL0032");
|
|
}
|
|
|
|
InfoGuid1Text = new List<M_Language>();
|
|
InfoGuid2Text = new List<M_Language>();
|
|
OKButtonWidth = 0d;
|
|
CancelButtonWidth = 0d;
|
|
|
|
if (!SignEnd)
|
|
{
|
|
switch (PaymentType)
|
|
{
|
|
case LastPaymentsType.SmilePay:
|
|
case LastPaymentsType.AliPay:
|
|
case LastPaymentsType.ZeroPay:
|
|
if (ProcessTask != null) ProcessTask.Wait();
|
|
ProcessTask = new Task(DoPaymentProcess);
|
|
ProcessTask.Start();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
case "ProcessingErrorVisible":
|
|
if (ProcessingErrorVisible)
|
|
{
|
|
#region 처리 실패 오류 창
|
|
ScanGuidText = new List<M_Language>();
|
|
InfoGuid1Text = new List<M_Language>();
|
|
InfoGuid2Text = new List<M_Language>();
|
|
InfoGuid1TextAlignment = TextAlignment.Left;
|
|
CancelButtonText = Languages.GetMessages("BTN0003");
|
|
CancelButtonWidth = PopupWidth / 2;
|
|
OkButtonText = Languages.GetMessages("BTN0006");
|
|
OKButtonWidth = PopupWidth / 2;
|
|
OKButtonEnabled = true;
|
|
TimeOutSeconds = 10d;
|
|
#endregion
|
|
}
|
|
break;
|
|
case "PaymentSuccessVisible":
|
|
if (PaymentSuccessVisible)
|
|
{
|
|
if (PaymentType == LastPaymentsType.SmilePay)
|
|
{
|
|
ScanGuidText = Languages.GetMessages("LBL0087");
|
|
}
|
|
else
|
|
{
|
|
ScanGuidText = Languages.GetMessages("LBL0029");
|
|
}
|
|
|
|
InfoGuid1Text = new List<M_Language>();
|
|
InfoGuid2Text = new List<M_Language>();
|
|
OKButtonWidth = 0d;
|
|
CancelButtonWidth = 0d;
|
|
ImmediatelyClose = true;
|
|
TimeOutSeconds = 0d;
|
|
}
|
|
break;
|
|
case "ReadBarCode":
|
|
if (!ProcessStart)
|
|
{
|
|
switch (PaymentType)
|
|
{
|
|
case LastPaymentsType.SmilePay:
|
|
case LastPaymentsType.AliPay:
|
|
case LastPaymentsType.ZeroPay:
|
|
switch (ReadBarCode.Length)
|
|
{
|
|
case 16:
|
|
case 17:
|
|
certifyKey = ReadBarCode.Substring(0, 16);
|
|
FormatedBarCode = ReadBarCode.GetEncriptCardNo();
|
|
PaymentWindow = PaymentWindowType.PaymentProcessing;
|
|
break;
|
|
default:
|
|
FormatedBarCode = string.Empty;
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
case "UseableSign":
|
|
OKButtonEnabled = UseableSign;
|
|
break;
|
|
case "SignData":
|
|
if (PosLastPayments != null && !string.IsNullOrEmpty(SignData))
|
|
{
|
|
PosLastPayments.SignData = SignData;
|
|
PosLastPayments.SignEndStatus = true;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
CommonLog.ErrorLogWrite(this, "VmHappyPointCertify_PropertyChanged()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
|
|
}
|
|
}
|
|
#endregion Event Handlers
|
|
}
|
|
|
|
} |