Beispiel #1
0
        public MultiPaymentRequestResult CreateMultiPaymentRequest(MultiPaymentRequestRequest request)
        {
            var parameters = GetBasicCreatePaymentRequestParameters(request);

            // Mandatory arguments
            parameters.Add("multi", GetMultiPaymentRequestChildrenAsParameter(request));

            return(new MultiPaymentRequestResult(GetResponseFromApiCall("createMultiPaymentRequest", parameters)));
        }
Beispiel #2
0
        private Dictionary <string, Object> GetMultiPaymentRequestChildrenAsParameter(MultiPaymentRequestRequest request)
        {
            var parameter = new Dictionary <string, Object>();

            int childIndex = 0;

            foreach (MultiPaymentRequestRequestChild child in request.Children)
            {
                var childParam = new Dictionary <string, Object>();

                childParam.Add("amount", child.Amount.GetAmountString());

                if (child.TypeIsSet)
                {
                    childParam.Add("type", child.Type);
                }

                if (!String.IsNullOrEmpty(child.Terminal))
                {
                    childParam.Add("terminal", child.Terminal);
                }

                if (!String.IsNullOrEmpty(child.ShopOrderId))
                {
                    childParam.Add("shop_orderid", child.ShopOrderId);
                }

                if (child.PaymentInfos != null && child.PaymentInfos.Count > 0)
                {
                    childParam.Add("transaction_info", request.PaymentInfos);
                }

                if (child.ShippingTypeIsSet)
                {
                    childParam.Add("shipping_method", child.ShippingType);
                }

                if (!String.IsNullOrEmpty(child.SalesReconciliationIdentifier))
                {
                    childParam.Add("sale_reconciliation_identifier", child.SalesReconciliationIdentifier);
                }

                if (child.OrderLines != null && child.OrderLines.Count > 0)
                {
                    childParam = getOrderLines(childParam, child.OrderLines);
                }


                parameter.Add(childIndex.ToString(), childParam);
                childIndex++;
            }

            return(parameter);
        }