/// <summary>
		/// Patch CatalogBase type
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this PaymentInEntity source, PaymentInEntity target)
		{
			if (target == null)
				throw new ArgumentNullException("target");

			source.Patch((OperationEntity)target);

			var patchInjectionPolicy = new PatchInjection<PaymentInEntity>(x => x.CustomerId, x => x.OrganizationId, x => x.GatewayCode, x => x.Purpose, x => x.OuterId);
			target.InjectFrom(patchInjectionPolicy, source);

			if (!source.Addresses.IsNullCollection())
			{
				source.Addresses.Patch(target.Addresses, new AddressComparer(), (sourceAddress, targetAddress) => sourceAddress.Patch(targetAddress));
			}
		}
        public static PaymentInEntity ToDataModel(this PaymentIn paymentIn, CustomerOrderEntity orderEntity)
        {
            if (paymentIn == null)
                throw new ArgumentNullException("paymentIn");

            var retVal = new PaymentInEntity();
            retVal.InjectFrom(paymentIn);

            retVal.Currency = paymentIn.Currency.ToString();
            retVal.Status = paymentIn.PaymentStatus.ToString();

         
            if (paymentIn.BillingAddress != null)
            {
                retVal.Addresses = new ObservableCollection<AddressEntity>(new AddressEntity[] { paymentIn.BillingAddress.ToDataModel() });
            }
            return retVal;
        }
		public static PaymentInEntity ToDataModel(this PaymentIn paymentIn)
		{
			if (paymentIn == null)
				throw new ArgumentNullException("paymentIn");

			var retVal = new PaymentInEntity();
			retVal.InjectFrom(paymentIn);

			retVal.Currency = paymentIn.Currency.ToString();

			if (paymentIn.Properties != null)
			{
				retVal.Properties = new ObservableCollection<OperationPropertyEntity>(paymentIn.Properties.Select(x => x.ToDataModel()));
			}
			if (paymentIn.BillingAddress != null)
			{
				retVal.Addresses = new ObservableCollection<AddressEntity>(new AddressEntity[] { paymentIn.BillingAddress.ToDataModel() });
			}
			return retVal;
		}