Ejemplo n.º 1
0
        /// <summary>
        /// Добавление отложенного платежа Diners.
        /// </summary>
        private void AddCardPreliminaryPaymentItem()
        {
            var deliveryOrder  = PluginContext.Operations.GetDeliveryOrders().Last(o => o.Status == OrderStatus.New);
            var paymentType    = PluginContext.Operations.GetPaymentTypes().Last(x => x.Kind == PaymentTypeKind.Card && x.Name.ToUpper() == "DINERS");
            var additionalData = new CardPaymentItemAdditionalData {
                CardNumber = "123456"
            };

            PluginContext.Operations.AddPreliminaryPaymentItem(150, additionalData, paymentType, deliveryOrder, PluginContext.Operations.GetCredentials());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Добавление внешнего проведенного платежа Diners.
        /// </summary>
        private void AddCardExternalProcessedPaymentItem()
        {
            var order          = PluginContext.Operations.GetOrders().Last(o => o.Status == OrderStatus.New);
            var paymentType    = PluginContext.Operations.GetPaymentTypes().Last(x => x.Kind == PaymentTypeKind.Card && x.Name.ToUpper() == "DINERS");
            var additionalData = new CardPaymentItemAdditionalData {
                CardNumber = "123456"
            };

            PluginContext.Operations.AddExternalPaymentItem(150, true, additionalData, paymentType, order, PluginContext.Operations.GetCredentials());
        }
Ejemplo n.º 3
0
        private void AddProcessedCardDonation()
        {
            const bool isProcessed    = true;
            var        order          = PluginContext.Operations.GetOrders().Last(o => o.Status == OrderStatus.Closed);
            var        donationType   = PluginContext.Operations.GetDonationTypesCompatibleWith(order).First(dt => dt.PaymentTypes.Any(pt => pt.Kind == PaymentTypeKind.Card));
            var        paymentType    = donationType.PaymentTypes.First(x => x.Kind == PaymentTypeKind.Card && x.Name.ToUpper() == "VISA");
            var        additionalData = new CardPaymentItemAdditionalData {
                CardNumber = "123456"
            };
            var credentials = PluginContext.Operations.GetCredentials();

            var paymentItem = PluginContext.Operations.AddDonation(credentials, order, donationType, paymentType, additionalData, isProcessed, order.ResultSum / 4);

            order = PluginContext.Operations.GetOrderById(order.Id);
            Debug.Assert(order.Donations.Contains(paymentItem));
        }
Ejemplo n.º 4
0
 internal bool PayOrder_With_ExternalPayments_And_Use_CardPaymentItemAdditionalData(Guid orderId)
 {
     try
     {
         var additionalData = new CardPaymentItemAdditionalData {
             CardNumber = "123456"
         };
         logger.Info("Close order with external payments when additionalData is NOT NULL ");
         CloseForExternalPayment(orderId, additionalData);
         return(true);
     }
     catch (InvalidCastException e)
     {
         //Got exception with message "Не удалось привести тип объекта "Resto.Front.Api.V6.Data.Payments.CardPaymentItemAdditionalData" к типу "Resto.Front.Api.V6.PaymentTypes.IikoNetPaymentItemAdditionalData"."
         //Type "IikoNetPaymentItemAdditionalData" is not available in this API...
         logger.Error($"Can not close order {orderId} for external payments", e);
         return(false);
     }
 }