/// <summary> /// Initializes a new instance of the <see cref="CreateChargeRequest" /> class. /// </summary> /// <param name="Authority">Authority (required).</param> /// <param name="Reference">The reference for this charge (unique payment reference in your store).</param> /// <param name="Amount">The amount of the charge (required).</param> /// <param name="Currency">The currency (required).</param> /// <param name="Capture">If true this will be a direct capture, pass false to perform an authorisation only (default to true).</param> /// <param name="Order">Order.</param> /// <param name="Metadata">Metadata.</param> public CreateChargeRequest(AuthorityRequest Authority = default(AuthorityRequest), string Reference = default(string), decimal?Amount = default(decimal?), CurrencyEnum?Currency = default(CurrencyEnum?), bool?Capture = true, ChargeOrder Order = default(ChargeOrder), Object Metadata = default(Object)) { // to ensure "Authority" is required (not null) if (Authority == null) { throw new InvalidDataException("Authority is a required property for CreateChargeRequest and cannot be null"); } else { this.Authority = Authority; } // to ensure "Amount" is required (not null) if (Amount == null) { throw new InvalidDataException("Amount is a required property for CreateChargeRequest and cannot be null"); } else { this.Amount = Amount; } // to ensure "Currency" is required (not null) if (Currency == null) { throw new InvalidDataException("Currency is a required property for CreateChargeRequest and cannot be null"); } else { this.Currency = Currency; } this.Reference = Reference; // use default value if no "Capture" provided if (Capture == null) { this.Capture = true; } else { this.Capture = Capture; } this.Order = Order; this.Metadata = Metadata; }
/// <summary> /// Initializes a new instance of the <see cref="Charge" /> class. /// </summary> /// <param name="Id">Id (required).</param> /// <param name="Reference">Reference.</param> /// <param name="Amount">Amount (required).</param> /// <param name="Currency">Currency (required).</param> /// <param name="State">State (required).</param> /// <param name="CapturedAmount">CapturedAmount (required).</param> /// <param name="RefundedAmount">The amount of the charge that has been refunded (required).</param> /// <param name="CreatedDate">CreatedDate (required).</param> /// <param name="Order">Order.</param> /// <param name="Metadata">Metadata.</param> /// <param name="ReceiptNumber">ReceiptNumber (required).</param> public Charge(string Id = default(string), string Reference = default(string), decimal?Amount = default(decimal?), string Currency = default(string), StateEnum?State = default(StateEnum?), decimal?CapturedAmount = default(decimal?), decimal?RefundedAmount = default(decimal?), DateTime?CreatedDate = default(DateTime?), ChargeOrder Order = default(ChargeOrder), Object Metadata = default(Object), string ReceiptNumber = default(string)) { // to ensure "Id" is required (not null) if (Id == null) { throw new InvalidDataException("Id is a required property for Charge and cannot be null"); } else { this.Id = Id; } // to ensure "Amount" is required (not null) if (Amount == null) { throw new InvalidDataException("Amount is a required property for Charge and cannot be null"); } else { this.Amount = Amount; } // to ensure "Currency" is required (not null) if (Currency == null) { throw new InvalidDataException("Currency is a required property for Charge and cannot be null"); } else { this.Currency = Currency; } // to ensure "State" is required (not null) if (State == null) { throw new InvalidDataException("State is a required property for Charge and cannot be null"); } else { this.State = State; } // to ensure "CapturedAmount" is required (not null) if (CapturedAmount == null) { throw new InvalidDataException("CapturedAmount is a required property for Charge and cannot be null"); } else { this.CapturedAmount = CapturedAmount; } // to ensure "RefundedAmount" is required (not null) if (RefundedAmount == null) { throw new InvalidDataException("RefundedAmount is a required property for Charge and cannot be null"); } else { this.RefundedAmount = RefundedAmount; } // to ensure "CreatedDate" is required (not null) if (CreatedDate == null) { throw new InvalidDataException("CreatedDate is a required property for Charge and cannot be null"); } else { this.CreatedDate = CreatedDate; } // to ensure "ReceiptNumber" is required (not null) if (ReceiptNumber == null) { throw new InvalidDataException("ReceiptNumber is a required property for Charge and cannot be null"); } else { this.ReceiptNumber = ReceiptNumber; } this.Reference = Reference; this.Order = Order; this.Metadata = Metadata; }