Class: Inttegro::PurchaseIntent

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/inttegro/purchase_intent/purchase_intent.rb,
lib/inttegro/purchase_intent/base.rb,
lib/inttegro/purchase_intent/page.rb,
lib/inttegro/purchase_intent/price.rb,
lib/inttegro/purchase_intent/usage.rb,
lib/inttegro/purchase_intent/bundle.rb,
lib/inttegro/purchase_intent/status.rb,
lib/inttegro/purchase_intent/product.rb,
lib/inttegro/purchase_intent/variant.rb,
lib/inttegro/purchase_intent/merchant.rb,
lib/inttegro/purchase_intent/quantity.rb,
lib/inttegro/purchase_intent/response.rb,
lib/inttegro/purchase_intent/questions.rb,
lib/inttegro/purchase_intent/usage_order.rb,
lib/inttegro/purchase_intent/variant_set.rb,
lib/inttegro/purchase_intent/bundle_price.rb,
lib/inttegro/purchase_intent/page_request.rb,
lib/inttegro/purchase_intent/presentation.rb,
lib/inttegro/purchase_intent/price_inline.rb,
lib/inttegro/purchase_intent/variant_axis.rb,
lib/inttegro/purchase_intent/page_response.rb,
lib/inttegro/purchase_intent/product_media.rb,
lib/inttegro/purchase_intent/cancel_request.rb,
lib/inttegro/purchase_intent/create_request.rb,
lib/inttegro/purchase_intent/lookup_request.rb,
lib/inttegro/purchase_intent/merchant_asset.rb,
lib/inttegro/purchase_intent/original_price.rb,
lib/inttegro/purchase_intent/update_request.rb,
lib/inttegro/purchase_intent/cancel_response.rb,
lib/inttegro/purchase_intent/create_response.rb,
lib/inttegro/purchase_intent/multi_use_usage.rb,
lib/inttegro/purchase_intent/price_selection.rb,
lib/inttegro/purchase_intent/bundle_component.rb,
lib/inttegro/purchase_intent/bundle_selection.rb,
lib/inttegro/purchase_intent/merchant_profile.rb,
lib/inttegro/purchase_intent/merchant_support.rb,
lib/inttegro/purchase_intent/single_use_usage.rb,
lib/inttegro/purchase_intent/merchant_branding.rb,
lib/inttegro/purchase_intent/product_selection.rb,
lib/inttegro/purchase_intent/product_dimensions.rb,
lib/inttegro/purchase_intent/create_presentation.rb,
lib/inttegro/purchase_intent/update_presentation.rb,
lib/inttegro/purchase_intent/create_request_usage.rb,
lib/inttegro/purchase_intent/merchant_color_scheme.rb,
lib/inttegro/purchase_intent/presentation_buy_page.rb,
lib/inttegro/purchase_intent/update_request_fields.rb,
lib/inttegro/purchase_intent/create_request_quantity.rb,
lib/inttegro/purchase_intent/price_selection_nominal.rb,
lib/inttegro/purchase_intent/product_attributes_item.rb,
lib/inttegro/purchase_intent/update_request_quantity.rb,
lib/inttegro/purchase_intent/price_selection_original.rb,
lib/inttegro/purchase_intent/presentation_buy_page_text.rb,
lib/inttegro/purchase_intent/create_presentation_buy_page.rb,
lib/inttegro/purchase_intent/update_presentation_buy_page.rb,
lib/inttegro/purchase_intent/cancel_response_purchase_intent.rb,
lib/inttegro/purchase_intent/create_response_purchase_intent.rb,
lib/inttegro/purchase_intent/price_selection_original_nominal.rb,
lib/inttegro/purchase_intent/create_presentation_buy_page_text.rb,
lib/inttegro/purchase_intent/update_presentation_buy_page_text.rb,
lib/inttegro/purchase_intent/cancel_response_purchase_intent_status.rb,
lib/inttegro/purchase_intent/create_response_purchase_intent_status.rb

Overview

Typed representation of the purchase intent object in the Inttegro API.

This generated model is immutable. Construct it with .new, or decode a string-keyed API payload with .from_hash. #serialize produces a string-keyed hash using the original wire field names and serialized enum values.

Defined Under Namespace

Classes: Bundle, BundleComponent, BundlePrice, BundleSelection, CancelRequest, CancelResponse, CancelResponsePurchaseIntent, CancelResponsePurchaseIntentStatus, CreatePresentation, CreatePresentationBuyPage, CreatePresentationBuyPageText, CreateRequest, CreateRequestQuantity, CreateRequestUsage, CreateResponse, CreateResponsePurchaseIntent, CreateResponsePurchaseIntentStatus, LookupRequest, Merchant, MerchantAsset, MerchantBranding, MerchantColorScheme, MerchantProfile, MerchantSupport, MultiUseUsage, OriginalPrice, Page, PageRequest, PageResponse, Presentation, PresentationBuyPage, PresentationBuyPageText, Price, PriceInline, PriceSelection, PriceSelectionNominal, PriceSelectionOriginal, PriceSelectionOriginalNominal, Product, ProductAttributesItem, ProductDimensions, ProductMedia, ProductSelection, Quantity, Response, SingleUseUsage, Status, UpdatePresentation, UpdatePresentationBuyPage, UpdatePresentationBuyPageText, UpdateRequest, UpdateRequestFields, UpdateRequestQuantity, UsageOrder, Variant, VariantAxis, VariantSet

Constant Summary collapse

Usage =

Exactly one of multi_use or single_use is returned as true. Order is present after a single-use intent is consumed.

T.type_alias { T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage) }

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#allow_variants ⇒ Boolean (readonly)

Whether the intent was configured with a variant set

Required in the API payload. Wire name: allow_variants.

Returns:

  • (Boolean)


128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#application_id ⇒ String (readonly)

Application that owns the purchase intent. This is routing metadata, not merchant presentation.

Required in the API payload. Wire name: application_id.

Returns:

  • (String)


128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#bundle ⇒ Inttegro::PurchaseIntent::Bundle? (readonly)

Value of the bundle field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: bundle.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#created_at ⇒ Time (readonly)

Creation timestamp

Required in the API payload. Wire name: created_at.

Returns:

  • (Time)


128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#expires_at ⇒ Time? (readonly)

Timestamp at or after which the Buy link is expired

Optional in the API payload; omitted values default to nil. Wire name: expires_at.

Returns:

  • (Time, nil)


128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#id ⇒ String (readonly)

Unique purchase intent identifier with sale_ prefix. Append it to https://pages.inttegro.com/buy/ to build the hosted Buy link.

Required in the API payload. Wire name: id.

Returns:

  • (String)


128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#inactive_at ⇒ Time? (readonly)

When the Buy link was explicitly canceled

Optional in the API payload; omitted values default to nil. Wire name: inactive_at.

Returns:

  • (Time, nil)


128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#merchant ⇒ Inttegro::PurchaseIntent::Merchant? (readonly)

Current public merchant presentation resolved from the purchase intent's application. It is hydrated at lookup time and is not stored on the purchase intent.

Optional in the API payload; omitted values default to nil. Wire name: merchant.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#presentation ⇒ Inttegro::PurchaseIntent::Presentation? (readonly)

Value of the presentation field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: presentation.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#price ⇒ Inttegro::PurchaseIntent::PriceInline? (readonly)

Effective Buy-link offer price. For a bundle without an explicit override, this is the current catalog default.

Optional in the API payload; omitted values default to nil. Wire name: price.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#product ⇒ Inttegro::PurchaseIntent::Product? (readonly)

Value of the product field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: product.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#quantity ⇒ Inttegro::PurchaseIntent::Quantity (readonly)

Quantity bounds enforced by the hosted checkout. max is omitted when the offer has no upper bound.

Required in the API payload. Wire name: quantity.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#status ⇒ Inttegro::PurchaseIntent::Status (readonly)

Effective lifecycle state derived from expiry, cancellation, and single-use order creation

Required in the API payload. Wire name: status.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#updated_at ⇒ Time? (readonly)

Last mutation timestamp

Optional in the API payload; omitted values default to nil. Wire name: updated_at.

Returns:

  • (Time, nil)


128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#usage ⇒ Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage (readonly)

Exactly one of multi_use or single_use is returned as true. Order is present after a single-use intent is consumed.

Required in the API payload. Wire name: usage.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

#variant_set ⇒ Inttegro::PurchaseIntent::VariantSet? (readonly)

Value of the variant_set field in the Inttegro API payload.

Optional in the API payload; omitted values default to nil. Wire name: variant_set.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 128

class PurchaseIntent
  const :allow_variants, T::Boolean
  const :application_id, String
  const :bundle, T.nilable(Inttegro::PurchaseIntent::Bundle), default: nil
  const :created_at, Time
  const :expires_at, T.nilable(Time), default: nil
  const :id, String
  const :inactive_at, T.nilable(Time), default: nil
  const :merchant, T.nilable(Inttegro::PurchaseIntent::Merchant), default: nil
  const :price, T.nilable(Inttegro::PurchaseIntent::PriceInline), default: nil
  const :presentation, T.nilable(Inttegro::PurchaseIntent::Presentation), default: nil
  const :product, T.nilable(Inttegro::PurchaseIntent::Product), default: nil
  const :quantity, Inttegro::PurchaseIntent::Quantity
  const :status, Inttegro::PurchaseIntent::Status
  const :updated_at, T.nilable(Time), default: nil
  const :usage, T.any(Inttegro::PurchaseIntent::MultiUseUsage, Inttegro::PurchaseIntent::SingleUseUsage)
  const :variant_set, T.nilable(Inttegro::PurchaseIntent::VariantSet), default: nil

  extend T::Sig

  sig { params(hash: T::Hash[String, Object], strict: T::Boolean).returns(T.attached_class) }
  def self.from_hash(hash, strict = false)
    data = hash.dup
    if (usage_value = data["usage"]).is_a?(Hash)
      data["usage"] = if usage_value.key?("multi_use")
        Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
      elsif usage_value.key?("single_use")
        Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
      else
        usage_value
      end
    end
    super(data, strict)
  end
end

Class Method Details

.from_hash(hash, strict = false) ⇒ Object



149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/inttegro/purchase_intent/purchase_intent.rb', line 149

def self.from_hash(hash, strict = false)
  data = hash.dup
  if (usage_value = data["usage"]).is_a?(Hash)
    data["usage"] = if usage_value.key?("multi_use")
      Inttegro::PurchaseIntent::MultiUseUsage.from_hash(usage_value)
    elsif usage_value.key?("single_use")
      Inttegro::PurchaseIntent::SingleUseUsage.from_hash(usage_value)
    else
      usage_value
    end
  end
  super(data, strict)
end

Instance Method Details

#active? ⇒ Boolean

Determine whether the purchase intent's effective status is Status::ACTIVE.

Returns:

  • (Boolean) —

    whether the purchase intent is active



12
13
14
# File 'lib/inttegro/purchase_intent/questions.rb', line 12

def active?
  status == Inttegro::PurchaseIntent::Status::ACTIVE
end

#single_use? ⇒ Boolean

Determine whether the purchase intent is configured for one order only.

Returns:

  • (Boolean) —

    whether #usage marks the purchase intent as single-use



20
21
22
# File 'lib/inttegro/purchase_intent/questions.rb', line 20

def single_use?
  usage.is_a?(Inttegro::PurchaseIntent::SingleUseUsage)
end

#used_order_id ⇒ String?

Return the order created from a consumed single-use purchase intent.

Reusable intents, unused intents, and usage records with an empty order identifier return nil. This method reads the embedded usage snapshot and performs no lookup request.

Returns:

  • (String, nil) —

    created order identifier when present



31
32
33
34
35
36
37
# File 'lib/inttegro/purchase_intent/questions.rb', line 31

def used_order_id
  return nil unless single_use?

  single_use_usage = T.cast(usage, Inttegro::PurchaseIntent::SingleUseUsage)
  id = single_use_usage.order&.id
  id unless id&.empty?
end