internal static ReservationToPurchaseCalculateExchange DeserializeReservationToPurchaseCalculateExchange(JsonElement element)
        {
            Optional <PurchaseRequestContent> properties           = default;
            Optional <PurchasePrice>          billingCurrencyTotal = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    properties = PurchaseRequestContent.DeserializePurchaseRequestContent(property.Value);
                    continue;
                }
                if (property.NameEquals("billingCurrencyTotal"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    billingCurrencyTotal = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
            }
            return(new ReservationToPurchaseCalculateExchange(properties.Value, billingCurrencyTotal.Value));
        }
 internal ReservationOrderBillingPlanInformation(PurchasePrice pricingCurrencyTotal, DateTimeOffset?startOn, DateTimeOffset?nextPaymentDueOn, IReadOnlyList <PaymentDetail> transactions)
 {
     PricingCurrencyTotal = pricingCurrencyTotal;
     StartOn          = startOn;
     NextPaymentDueOn = nextPaymentDueOn;
     Transactions     = transactions;
 }
Ejemplo n.º 3
0
        internal static ReservationToReturnForExchange DeserializeReservationToReturnForExchange(JsonElement element)
        {
            Optional <string>             reservationId       = default;
            Optional <int>                quantity            = default;
            Optional <PurchasePrice>      billingRefundAmount = default;
            Optional <BillingInformation> billingInformation  = default;
            Optional <OperationStatus>    status = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("reservationId"))
                {
                    reservationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("quantity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    quantity = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("billingRefundAmount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    billingRefundAmount = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
                if (property.NameEquals("billingInformation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    billingInformation = BillingInformation.DeserializeBillingInformation(property.Value);
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = new OperationStatus(property.Value.GetString());
                    continue;
                }
            }
            return(new ReservationToReturnForExchange(reservationId.Value, Optional.ToNullable(quantity), billingRefundAmount.Value, billingInformation.Value, Optional.ToNullable(status)));
        }
        internal static ReservationOrderBillingPlanInformation DeserializeReservationOrderBillingPlanInformation(JsonElement element)
        {
            Optional <PurchasePrice>  pricingCurrencyTotal         = default;
            Optional <DateTimeOffset> startDate                    = default;
            Optional <DateTimeOffset> nextPaymentDueDate           = default;
            Optional <IReadOnlyList <PaymentDetail> > transactions = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("pricingCurrencyTotal"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    pricingCurrencyTotal = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
                if (property.NameEquals("startDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    startDate = property.Value.GetDateTimeOffset("D");
                    continue;
                }
                if (property.NameEquals("nextPaymentDueDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    nextPaymentDueDate = property.Value.GetDateTimeOffset("D");
                    continue;
                }
                if (property.NameEquals("transactions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <PaymentDetail> array = new List <PaymentDetail>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(PaymentDetail.DeserializePaymentDetail(item));
                    }
                    transactions = array;
                    continue;
                }
            }
            return(new ReservationOrderBillingPlanInformation(pricingCurrencyTotal.Value, Optional.ToNullable(startDate), Optional.ToNullable(nextPaymentDueDate), Optional.ToList(transactions)));
        }
 internal ExchangeResponseProperties(string sessionId, PurchasePrice netPayable, PurchasePrice refundsTotal, PurchasePrice purchasesTotal, IReadOnlyList <ReservationToPurchaseExchange> reservationsToPurchase, IReadOnlyList <ReservationToReturnForExchange> reservationsToExchange, ExchangePolicyErrors policyResult)
 {
     SessionId              = sessionId;
     NetPayable             = netPayable;
     RefundsTotal           = refundsTotal;
     PurchasesTotal         = purchasesTotal;
     ReservationsToPurchase = reservationsToPurchase;
     ReservationsToExchange = reservationsToExchange;
     PolicyResult           = policyResult;
 }
Ejemplo n.º 6
0
 internal PaymentDetail(DateTimeOffset?dueOn, DateTimeOffset?paymentOn, PurchasePrice pricingCurrencyTotal, PurchasePrice billingCurrencyTotal, string billingAccount, PaymentStatus?status, ExtendedStatusInfo extendedStatusInfo)
 {
     DueOn                = dueOn;
     PaymentOn            = paymentOn;
     PricingCurrencyTotal = pricingCurrencyTotal;
     BillingCurrencyTotal = billingCurrencyTotal;
     BillingAccount       = billingAccount;
     Status               = status;
     ExtendedStatusInfo   = extendedStatusInfo;
 }
Ejemplo n.º 7
0
        internal static ReservationToPurchaseExchange DeserializeReservationToPurchaseExchange(JsonElement element)
        {
            Optional <string> reservationOrderId                   = default;
            Optional <string> reservationId                        = default;
            Optional <PurchaseRequestContent> properties           = default;
            Optional <PurchasePrice>          billingCurrencyTotal = default;
            Optional <OperationStatus>        status               = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("reservationOrderId"))
                {
                    reservationOrderId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("reservationId"))
                {
                    reservationId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    properties = PurchaseRequestContent.DeserializePurchaseRequestContent(property.Value);
                    continue;
                }
                if (property.NameEquals("billingCurrencyTotal"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    billingCurrencyTotal = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = new OperationStatus(property.Value.GetString());
                    continue;
                }
            }
            return(new ReservationToPurchaseExchange(reservationOrderId.Value, reservationId.Value, properties.Value, billingCurrencyTotal.Value, Optional.ToNullable(status)));
        }
        internal static CatalogMsrp DeserializeCatalogMsrp(JsonElement element)
        {
            Optional <PurchasePrice> p1Y = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("p1Y"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    p1Y = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
            }
            return(new CatalogMsrp(p1Y.Value));
        }
        internal static BillingInformation DeserializeBillingInformation(JsonElement element)
        {
            Optional <PurchasePrice> billingCurrencyTotalPaidAmount           = default;
            Optional <PurchasePrice> billingCurrencyProratedAmount            = default;
            Optional <PurchasePrice> billingCurrencyRemainingCommitmentAmount = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("billingCurrencyTotalPaidAmount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    billingCurrencyTotalPaidAmount = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
                if (property.NameEquals("billingCurrencyProratedAmount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    billingCurrencyProratedAmount = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
                if (property.NameEquals("billingCurrencyRemainingCommitmentAmount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    billingCurrencyRemainingCommitmentAmount = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
            }
            return(new BillingInformation(billingCurrencyTotalPaidAmount.Value, billingCurrencyProratedAmount.Value, billingCurrencyRemainingCommitmentAmount.Value));
        }
        internal static ExchangeResponseProperties DeserializeExchangeResponseProperties(JsonElement element)
        {
            Optional <string>        sessionId      = default;
            Optional <PurchasePrice> netPayable     = default;
            Optional <PurchasePrice> refundsTotal   = default;
            Optional <PurchasePrice> purchasesTotal = default;
            Optional <IReadOnlyList <ReservationToPurchaseExchange> >  reservationsToPurchase = default;
            Optional <IReadOnlyList <ReservationToReturnForExchange> > reservationsToExchange = default;
            Optional <ExchangePolicyErrors> policyResult = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sessionId"))
                {
                    sessionId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("netPayable"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    netPayable = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
                if (property.NameEquals("refundsTotal"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    refundsTotal = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
                if (property.NameEquals("purchasesTotal"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    purchasesTotal = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
                if (property.NameEquals("reservationsToPurchase"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ReservationToPurchaseExchange> array = new List <ReservationToPurchaseExchange>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ReservationToPurchaseExchange.DeserializeReservationToPurchaseExchange(item));
                    }
                    reservationsToPurchase = array;
                    continue;
                }
                if (property.NameEquals("reservationsToExchange"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ReservationToReturnForExchange> array = new List <ReservationToReturnForExchange>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ReservationToReturnForExchange.DeserializeReservationToReturnForExchange(item));
                    }
                    reservationsToExchange = array;
                    continue;
                }
                if (property.NameEquals("policyResult"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    policyResult = ExchangePolicyErrors.DeserializeExchangePolicyErrors(property.Value);
                    continue;
                }
            }
            return(new ExchangeResponseProperties(sessionId.Value, netPayable.Value, refundsTotal.Value, purchasesTotal.Value, Optional.ToList(reservationsToPurchase), Optional.ToList(reservationsToExchange), policyResult.Value));
        }
Ejemplo n.º 11
0
        internal static PaymentDetail DeserializePaymentDetail(JsonElement element)
        {
            Optional <DateTimeOffset>     dueDate              = default;
            Optional <DateTimeOffset>     paymentDate          = default;
            Optional <PurchasePrice>      pricingCurrencyTotal = default;
            Optional <PurchasePrice>      billingCurrencyTotal = default;
            Optional <string>             billingAccount       = default;
            Optional <PaymentStatus>      status             = default;
            Optional <ExtendedStatusInfo> extendedStatusInfo = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("dueDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    dueDate = property.Value.GetDateTimeOffset("D");
                    continue;
                }
                if (property.NameEquals("paymentDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    paymentDate = property.Value.GetDateTimeOffset("D");
                    continue;
                }
                if (property.NameEquals("pricingCurrencyTotal"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    pricingCurrencyTotal = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
                if (property.NameEquals("billingCurrencyTotal"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    billingCurrencyTotal = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
                if (property.NameEquals("billingAccount"))
                {
                    billingAccount = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = new PaymentStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("extendedStatusInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedStatusInfo = ExtendedStatusInfo.DeserializeExtendedStatusInfo(property.Value);
                    continue;
                }
            }
            return(new PaymentDetail(Optional.ToNullable(dueDate), Optional.ToNullable(paymentDate), pricingCurrencyTotal.Value, billingCurrencyTotal.Value, billingAccount.Value, Optional.ToNullable(status), extendedStatusInfo.Value));
        }