Class: DevDraftAI::CreatePaymentLinkDto
- Inherits:
-
Object
- Object
- DevDraftAI::CreatePaymentLinkDto
- Defined in:
- lib/devdraft/models/create_payment_link_dto.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#allow_business_tax_id ⇒ Object
Whether to allow business tax ID.
-
#allow_mobile_payment ⇒ Object
Whether to allow mobile payment.
-
#allow_quantity_adjustment ⇒ Object
Whether to allow quantity adjustment.
-
#amount ⇒ Object
Amount for the payment link.
-
#collect_address ⇒ Object
Whether to collect address.
-
#collect_tax ⇒ Object
Whether to collect tax.
-
#confirmation_page ⇒ Object
Confirmation page type.
-
#cover_image ⇒ Object
Cover image URL.
-
#create_invoice_pdf ⇒ Object
Whether to create invoice PDF.
-
#currency ⇒ Object
Currency.
-
#custom_fields ⇒ Object
Custom fields.
-
#customer_id ⇒ Object
Customer ID.
-
#description ⇒ Object
Detailed description of what the customer is purchasing.
-
#expiration_date ⇒ Object
Expiration date.
-
#is_for_all_product ⇒ Object
Whether the payment link is for all products.
-
#limit_payments ⇒ Object
Whether to limit payments.
-
#link_type ⇒ Object
Type of the payment link.
-
#max_payments ⇒ Object
Maximum number of payments.
-
#payment_for_id ⇒ Object
Payment for ID.
-
#payment_link_products ⇒ Object
Array of products in the payment link.
-
#recurring_type ⇒ Object
Recurring type.
-
#require_phone_number ⇒ Object
Whether to require phone number.
-
#tax_id ⇒ Object
Tax ID.
-
#title ⇒ Object
Display title for the payment link.
-
#url ⇒ Object
Unique URL slug for the payment link.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CreatePaymentLinkDto
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ CreatePaymentLinkDto
Initializes the object
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 183 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `DevDraftAI::CreatePaymentLinkDto` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `DevDraftAI::CreatePaymentLinkDto`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'title') self.title = attributes[:'title'] end if attributes.key?(:'url') self.url = attributes[:'url'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'cover_image') self.cover_image = attributes[:'cover_image'] end if attributes.key?(:'link_type') self.link_type = attributes[:'link_type'] end if attributes.key?(:'amount') self.amount = attributes[:'amount'] end if attributes.key?(:'payment_for_id') self.payment_for_id = attributes[:'payment_for_id'] end if attributes.key?(:'recurring_type') self.recurring_type = attributes[:'recurring_type'] else self.recurring_type = 'ONE_TIME' end if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] end if attributes.key?(:'payment_link_products') if (value = attributes[:'payment_link_products']).is_a?(Array) self.payment_link_products = value end end if attributes.key?(:'is_for_all_product') self.is_for_all_product = attributes[:'is_for_all_product'] else self.is_for_all_product = false end if attributes.key?(:'allow_quantity_adjustment') self.allow_quantity_adjustment = attributes[:'allow_quantity_adjustment'] else self.allow_quantity_adjustment = true end if attributes.key?(:'collect_tax') self.collect_tax = attributes[:'collect_tax'] else self.collect_tax = false end if attributes.key?(:'tax_id') self.tax_id = attributes[:'tax_id'] end if attributes.key?(:'collect_address') self.collect_address = attributes[:'collect_address'] else self.collect_address = false end if attributes.key?(:'require_phone_number') self.require_phone_number = attributes[:'require_phone_number'] else self.require_phone_number = false end if attributes.key?(:'limit_payments') self.limit_payments = attributes[:'limit_payments'] else self.limit_payments = false end if attributes.key?(:'max_payments') self.max_payments = attributes[:'max_payments'] end if attributes.key?(:'custom_fields') self.custom_fields = attributes[:'custom_fields'] end if attributes.key?(:'allow_business_tax_id') self.allow_business_tax_id = attributes[:'allow_business_tax_id'] else self.allow_business_tax_id = false end if attributes.key?(:'allow_mobile_payment') self.allow_mobile_payment = attributes[:'allow_mobile_payment'] else self.allow_mobile_payment = false end if attributes.key?(:'confirmation_page') self.confirmation_page = attributes[:'confirmation_page'] else self.confirmation_page = 'SHOW' end if attributes.key?(:'create_invoice_pdf') self.create_invoice_pdf = attributes[:'create_invoice_pdf'] else self.create_invoice_pdf = false end if attributes.key?(:'currency') self.currency = attributes[:'currency'] else self.currency = 'usdc' end if attributes.key?(:'expiration_date') self.expiration_date = attributes[:'expiration_date'] end end |
Instance Attribute Details
#allow_business_tax_id ⇒ Object
Whether to allow business tax ID
74 75 76 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 74 def allow_business_tax_id @allow_business_tax_id end |
#allow_mobile_payment ⇒ Object
Whether to allow mobile payment
77 78 79 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 77 def allow_mobile_payment @allow_mobile_payment end |
#allow_quantity_adjustment ⇒ Object
Whether to allow quantity adjustment
50 51 52 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 50 def allow_quantity_adjustment @allow_quantity_adjustment end |
#amount ⇒ Object
Amount for the payment link
32 33 34 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 32 def amount @amount end |
#collect_address ⇒ Object
Whether to collect address
59 60 61 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 59 def collect_address @collect_address end |
#collect_tax ⇒ Object
Whether to collect tax
53 54 55 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 53 def collect_tax @collect_tax end |
#confirmation_page ⇒ Object
Confirmation page type
80 81 82 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 80 def confirmation_page @confirmation_page end |
#cover_image ⇒ Object
Cover image URL
26 27 28 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 26 def cover_image @cover_image end |
#create_invoice_pdf ⇒ Object
Whether to create invoice PDF
83 84 85 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 83 def create_invoice_pdf @create_invoice_pdf end |
#currency ⇒ Object
Currency
86 87 88 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 86 def currency @currency end |
#custom_fields ⇒ Object
Custom fields
71 72 73 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 71 def custom_fields @custom_fields end |
#customer_id ⇒ Object
Customer ID
41 42 43 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 41 def customer_id @customer_id end |
#description ⇒ Object
Detailed description of what the customer is purchasing. Supports markdown formatting.
23 24 25 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 23 def description @description end |
#expiration_date ⇒ Object
Expiration date
89 90 91 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 89 def expiration_date @expiration_date end |
#is_for_all_product ⇒ Object
Whether the payment link is for all products
47 48 49 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 47 def is_for_all_product @is_for_all_product end |
#limit_payments ⇒ Object
Whether to limit payments
65 66 67 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 65 def limit_payments @limit_payments end |
#link_type ⇒ Object
Type of the payment link
29 30 31 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 29 def link_type @link_type end |
#max_payments ⇒ Object
Maximum number of payments
68 69 70 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 68 def max_payments @max_payments end |
#payment_for_id ⇒ Object
Payment for ID
35 36 37 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 35 def payment_for_id @payment_for_id end |
#payment_link_products ⇒ Object
Array of products in the payment link
44 45 46 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 44 def payment_link_products @payment_link_products end |
#recurring_type ⇒ Object
Recurring type
38 39 40 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 38 def recurring_type @recurring_type end |
#require_phone_number ⇒ Object
Whether to require phone number
62 63 64 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 62 def require_phone_number @require_phone_number end |
#tax_id ⇒ Object
Tax ID
56 57 58 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 56 def tax_id @tax_id end |
#title ⇒ Object
Display title for the payment link. This appears on the checkout page and in customer communications.
17 18 19 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 17 def title @title end |
#url ⇒ Object
Unique URL slug for the payment link. Can be a full URL or just the path segment. Must be unique within your account.
20 21 22 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 20 def url @url end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 114 def self.attribute_map { :'title' => :'title', :'url' => :'url', :'description' => :'description', :'cover_image' => :'coverImage', :'link_type' => :'linkType', :'amount' => :'amount', :'payment_for_id' => :'paymentForId', :'recurring_type' => :'recurringType', :'customer_id' => :'customerId', :'payment_link_products' => :'paymentLinkProducts', :'is_for_all_product' => :'isForAllProduct', :'allow_quantity_adjustment' => :'allowQuantityAdjustment', :'collect_tax' => :'collectTax', :'tax_id' => :'taxId', :'collect_address' => :'collectAddress', :'require_phone_number' => :'requirePhoneNumber', :'limit_payments' => :'limitPayments', :'max_payments' => :'maxPayments', :'custom_fields' => :'customFields', :'allow_business_tax_id' => :'allowBusinessTaxId', :'allow_mobile_payment' => :'allowMobilePayment', :'confirmation_page' => :'confirmationPage', :'create_invoice_pdf' => :'createInvoicePdf', :'currency' => :'currency', :'expiration_date' => :'expiration_date' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
491 492 493 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 491 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
176 177 178 179 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 176 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 145 def self.openapi_types { :'title' => :'Object', :'url' => :'Object', :'description' => :'Object', :'cover_image' => :'Object', :'link_type' => :'Object', :'amount' => :'Object', :'payment_for_id' => :'Object', :'recurring_type' => :'Object', :'customer_id' => :'Object', :'payment_link_products' => :'Object', :'is_for_all_product' => :'Object', :'allow_quantity_adjustment' => :'Object', :'collect_tax' => :'Object', :'tax_id' => :'Object', :'collect_address' => :'Object', :'require_phone_number' => :'Object', :'limit_payments' => :'Object', :'max_payments' => :'Object', :'custom_fields' => :'Object', :'allow_business_tax_id' => :'Object', :'allow_mobile_payment' => :'Object', :'confirmation_page' => :'Object', :'create_invoice_pdf' => :'Object', :'currency' => :'Object', :'expiration_date' => :'Object' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 446 def ==(o) return true if self.equal?(o) self.class == o.class && title == o.title && url == o.url && description == o.description && cover_image == o.cover_image && link_type == o.link_type && amount == o.amount && payment_for_id == o.payment_for_id && recurring_type == o.recurring_type && customer_id == o.customer_id && payment_link_products == o.payment_link_products && is_for_all_product == o.is_for_all_product && allow_quantity_adjustment == o.allow_quantity_adjustment && collect_tax == o.collect_tax && tax_id == o.tax_id && collect_address == o.collect_address && require_phone_number == o.require_phone_number && limit_payments == o.limit_payments && max_payments == o.max_payments && custom_fields == o.custom_fields && allow_business_tax_id == o.allow_business_tax_id && allow_mobile_payment == o.allow_mobile_payment && confirmation_page == o.confirmation_page && create_invoice_pdf == o.create_invoice_pdf && currency == o.currency && expiration_date == o.expiration_date end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 521 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model DevDraftAI.const_get(type).build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
590 591 592 593 594 595 596 597 598 599 600 601 602 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 590 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 498 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) end end self end |
#eql?(o) ⇒ Boolean
478 479 480 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 478 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
484 485 486 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 484 def hash [title, url, description, cover_image, link_type, amount, payment_for_id, recurring_type, customer_id, payment_link_products, is_for_all_product, allow_quantity_adjustment, collect_tax, tax_id, collect_address, require_phone_number, limit_payments, max_payments, custom_fields, allow_business_tax_id, allow_mobile_payment, confirmation_page, create_invoice_pdf, currency, expiration_date].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 325 def list_invalid_properties invalid_properties = Array.new if @title.nil? invalid_properties.push('invalid value for "title", title cannot be nil.') end if @url.nil? invalid_properties.push('invalid value for "url", url cannot be nil.') end if @link_type.nil? invalid_properties.push('invalid value for "link_type", link_type cannot be nil.') end if @recurring_type.nil? invalid_properties.push('invalid value for "recurring_type", recurring_type cannot be nil.') end if @allow_quantity_adjustment.nil? invalid_properties.push('invalid value for "allow_quantity_adjustment", allow_quantity_adjustment cannot be nil.') end if @collect_tax.nil? invalid_properties.push('invalid value for "collect_tax", collect_tax cannot be nil.') end if @collect_address.nil? invalid_properties.push('invalid value for "collect_address", collect_address cannot be nil.') end if @require_phone_number.nil? invalid_properties.push('invalid value for "require_phone_number", require_phone_number cannot be nil.') end if @allow_mobile_payment.nil? invalid_properties.push('invalid value for "allow_mobile_payment", allow_mobile_payment cannot be nil.') end if @confirmation_page.nil? invalid_properties.push('invalid value for "confirmation_page", confirmation_page cannot be nil.') end if @create_invoice_pdf.nil? invalid_properties.push('invalid value for "create_invoice_pdf", create_invoice_pdf cannot be nil.') end if @currency.nil? invalid_properties.push('invalid value for "currency", currency cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
566 567 568 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 566 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
572 573 574 575 576 577 578 579 580 581 582 583 584 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 572 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
560 561 562 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 560 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/devdraft/models/create_payment_link_dto.rb', line 380 def valid? return false if @title.nil? return false if @url.nil? return false if @link_type.nil? link_type_validator = EnumAttributeValidator.new('Object', ['INVOICE', 'PRODUCT', 'COLLECTION', 'SUBSCRIPTION', 'DONATION']) return false unless link_type_validator.valid?(@link_type) return false if @recurring_type.nil? recurring_type_validator = EnumAttributeValidator.new('Object', ['ONE_TIME', 'WEEKLY', 'BI_WEEKLY', 'MONTHLY', 'BI_MONTHLY', 'QUARTERLY', 'ANNUALLY']) return false unless recurring_type_validator.valid?(@recurring_type) return false if @allow_quantity_adjustment.nil? return false if @collect_tax.nil? return false if @collect_address.nil? return false if @require_phone_number.nil? return false if @allow_mobile_payment.nil? return false if @confirmation_page.nil? confirmation_page_validator = EnumAttributeValidator.new('Object', ['SHOW', 'REDIRECT']) return false unless confirmation_page_validator.valid?(@confirmation_page) return false if @create_invoice_pdf.nil? return false if @currency.nil? currency_validator = EnumAttributeValidator.new('Object', ['usdc', 'eurc']) return false unless currency_validator.valid?(@currency) true end |