Пример #1
0
        public override void doRefundPayment(string orderId, string paymentId, long? amount, bool? fullRefund)
        {
            notifyObserversUiState(new UiStateMessage(UiState.RECEIPT_OPTIONS, "Customer is selecting receipt type.", UiDirection.ENTER, new InputOption[0]));
            Console.WriteLine("Received UiStateMessage: RECEIPT_OPTIONS Customer is selecting receipt type. Enter");
            Thread.Sleep(3000);
            notifyObserversUiState(new UiStateMessage(UiState.RECEIPT_OPTIONS, "Customer is selecting receipt type.", UiDirection.EXIT, new InputOption[0]));
            Console.WriteLine("Received UiStateMessage: RECEIPT_OPTIONS Customer is selecting receipt type. Exit");
            Thread.Sleep(3000);

            Refund refund = new Refund();
            refund.payment = new Reference();
            if (paymentId != null)
            {
                refund.payment.id = paymentId;
            }
            refund.orderRef = new Reference();
            if (orderId != null)
            {
                refund.orderRef.id = orderId;
            }
            Object tempPayment;
            TempObjectMap.TryGetValue(paymentId, out tempPayment);
            if (tempPayment != null)
            {
                if (((Payment)tempPayment).tipAmount > 0)
                {
                    refund.amount = ((Payment)tempPayment).amount + ((Payment)tempPayment).tipAmount;
                }
                else
                {
                    refund.amount = ((Payment)tempPayment).amount;
                }
            }
            refund.id = Guid.NewGuid().ToString();
            FinishOkMessage okMsg = new FinishOkMessage();
            okMsg.refund = refund;
            notifyObserversFinishOk(okMsg);
            Console.WriteLine("Received FINISH_OK: " + okMsg.refund);
        }
Пример #2
0
 public RefundResponseMessage(string oid, string pid, Refund refund, TxState state, string msg, ResponseReasonCode reason)
     : base(Methods.REFUND_RESPONSE)
 {
     this.orderId = oid;
     this.paymentId = pid;
     this.refund = refund;
     this.code = state;
     this.message = msg;
     this.reason = reason;
 }