Esempio n. 1
0
        /// <summary>
        /// Converts the PaymentInfo ViewModel into a PaymentInfo Model to be used with the service.
        /// </summary>
        /// <param name="paymentInfo">ViewModel to convert.</param>
        /// <returns>PaymentInfoReturns null if parameter is null. Otherwise, returns Model to be used with the service.</returns>
        public static SP.PaymentInfoSvc.PaymentInfo ToModel(this VM.PaymentInfoViewModel paymentInfo)
        {
            if (null == paymentInfo) { return null; }

            SP.PaymentInfoSvc.PaymentInfo result = new SP.PaymentInfoSvc.PaymentInfo()
            {
                PaymentInfoGuid = paymentInfo.PaymentInfoGuid,
                PaymentInfoID = paymentInfo.PaymentInfoID,
                AmazonToken = paymentInfo.AmazonToken,
            };

            return result;
        }
Esempio n. 2
0
        public static int InsertPaymentInfo(int paymentInfoID, string amazonToken)
        {
            try
            {
                // Create the service proxy object and populate it.
                SP.PaymentInfoSvc.PaymentInfo request = new SP.PaymentInfoSvc.PaymentInfo();

                request.PaymentInfoGuid = Guid.Empty;
                request.PaymentInfoID = paymentInfoID;
                request.AmazonToken = amazonToken;

                // Call the service insert method.
                _paymentInfoClient.InsertPaymentInfo(request);

                return 1;
            }
            catch (System.ServiceModel.FaultException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }