Class: Stripe::V2::Core::EventNotification

Inherits:
Object
  • Object
show all
Defined in:
lib/stripe/resources/v2/core/event_notification.rb

Direct Known Subclasses

Events::UnknownEventNotification, Events::V1AccountSignalsIncludingDelinquencyCreatedEventNotification, Events::V1BillingMeterErrorReportTriggeredEventNotification, Events::V1BillingMeterNoMeterFoundEventNotification, Events::V2BillingCadenceBilledEventNotification, Events::V2BillingCadenceCanceledEventNotification, Events::V2BillingCadenceCreatedEventNotification, Events::V2BillingLicenseFeeCreatedEventNotification, Events::V2BillingLicenseFeeUpdatedEventNotification, Events::V2BillingLicenseFeeVersionCreatedEventNotification, Events::V2BillingLicensedItemCreatedEventNotification, Events::V2BillingLicensedItemUpdatedEventNotification, Events::V2BillingMeteredItemCreatedEventNotification, Events::V2BillingMeteredItemUpdatedEventNotification, Events::V2BillingPricingPlanComponentCreatedEventNotification, Events::V2BillingPricingPlanComponentUpdatedEventNotification, Events::V2BillingPricingPlanCreatedEventNotification, Events::V2BillingPricingPlanSubscriptionCollectionAwaitingCustomerActionEventNotification, Events::V2BillingPricingPlanSubscriptionCollectionCurrentEventNotification, Events::V2BillingPricingPlanSubscriptionCollectionPastDueEventNotification, Events::V2BillingPricingPlanSubscriptionCollectionPausedEventNotification, Events::V2BillingPricingPlanSubscriptionCollectionUnpaidEventNotification, Events::V2BillingPricingPlanSubscriptionServicingActivatedEventNotification, Events::V2BillingPricingPlanSubscriptionServicingCanceledEventNotification, Events::V2BillingPricingPlanSubscriptionServicingPausedEventNotification, Events::V2BillingPricingPlanUpdatedEventNotification, Events::V2BillingPricingPlanVersionCreatedEventNotification, Events::V2BillingRateCardCreatedEventNotification, Events::V2BillingRateCardCustomPricingUnitOverageRateCreatedEventNotification, Events::V2BillingRateCardRateCreatedEventNotification, Events::V2BillingRateCardSubscriptionActivatedEventNotification, Events::V2BillingRateCardSubscriptionCanceledEventNotification, Events::V2BillingRateCardSubscriptionCollectionAwaitingCustomerActionEventNotification, Events::V2BillingRateCardSubscriptionCollectionCurrentEventNotification, Events::V2BillingRateCardSubscriptionCollectionPastDueEventNotification, Events::V2BillingRateCardSubscriptionCollectionPausedEventNotification, Events::V2BillingRateCardSubscriptionCollectionUnpaidEventNotification, Events::V2BillingRateCardSubscriptionServicingActivatedEventNotification, Events::V2BillingRateCardSubscriptionServicingCanceledEventNotification, Events::V2BillingRateCardSubscriptionServicingPausedEventNotification, Events::V2BillingRateCardUpdatedEventNotification, Events::V2BillingRateCardVersionCreatedEventNotification, Events::V2CoreAccountClosedEventNotification, Events::V2CoreAccountCreatedEventNotification, Events::V2CoreAccountIncludingConfigurationCardCreatorCapabilityStatusUpdatedEventNotification, Events::V2CoreAccountIncludingConfigurationCardCreatorUpdatedEventNotification, Events::V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification, Events::V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification, Events::V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification, Events::V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification, Events::V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification, Events::V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification, Events::V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventNotification, Events::V2CoreAccountIncludingConfigurationStorerUpdatedEventNotification, Events::V2CoreAccountIncludingDefaultsUpdatedEventNotification, Events::V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification, Events::V2CoreAccountIncludingIdentityUpdatedEventNotification, Events::V2CoreAccountIncludingRequirementsUpdatedEventNotification, Events::V2CoreAccountLinkReturnedEventNotification, Events::V2CoreAccountPersonCreatedEventNotification, Events::V2CoreAccountPersonDeletedEventNotification, Events::V2CoreAccountPersonUpdatedEventNotification, Events::V2CoreAccountSignalsFraudulentWebsiteReadyEventNotification, Events::V2CoreAccountUpdatedEventNotification, Events::V2CoreBatchJobBatchFailedEventNotification, Events::V2CoreBatchJobCanceledEventNotification, Events::V2CoreBatchJobCompletedEventNotification, Events::V2CoreBatchJobCreatedEventNotification, Events::V2CoreBatchJobReadyForUploadEventNotification, Events::V2CoreBatchJobTimeoutEventNotification, Events::V2CoreBatchJobUpdatedEventNotification, Events::V2CoreBatchJobUploadTimeoutEventNotification, Events::V2CoreBatchJobValidatingEventNotification, Events::V2CoreBatchJobValidationFailedEventNotification, Events::V2CoreClaimableSandboxClaimedEventNotification, Events::V2CoreClaimableSandboxCreatedEventNotification, Events::V2CoreClaimableSandboxExpiredEventNotification, Events::V2CoreClaimableSandboxExpiringEventNotification, Events::V2CoreClaimableSandboxSandboxDetailsOwnerAccountUpdatedEventNotification, Events::V2CoreEventDestinationPingEventNotification, Events::V2CoreHealthApiErrorFiringEventNotification, Events::V2CoreHealthApiErrorResolvedEventNotification, Events::V2CoreHealthApiLatencyFiringEventNotification, Events::V2CoreHealthApiLatencyResolvedEventNotification, Events::V2CoreHealthAuthorizationRateDropFiringEventNotification, Events::V2CoreHealthAuthorizationRateDropResolvedEventNotification, Events::V2CoreHealthEventGenerationFailureResolvedEventNotification, Events::V2CoreHealthFraudRateIncreasedEventNotification, Events::V2CoreHealthIssuingAuthorizationRequestErrorsFiringEventNotification, Events::V2CoreHealthIssuingAuthorizationRequestErrorsResolvedEventNotification, Events::V2CoreHealthIssuingAuthorizationRequestTimeoutFiringEventNotification, Events::V2CoreHealthIssuingAuthorizationRequestTimeoutResolvedEventNotification, Events::V2CoreHealthPaymentMethodErrorFiringEventNotification, Events::V2CoreHealthPaymentMethodErrorResolvedEventNotification, Events::V2CoreHealthSepaDebitDelayedFiringEventNotification, Events::V2CoreHealthSepaDebitDelayedResolvedEventNotification, Events::V2CoreHealthTrafficVolumeDropFiringEventNotification, Events::V2CoreHealthTrafficVolumeDropResolvedEventNotification, Events::V2CoreHealthWebhookLatencyFiringEventNotification, Events::V2CoreHealthWebhookLatencyResolvedEventNotification, Events::V2IamApiKeyCreatedEventNotification, Events::V2IamApiKeyDefaultSecretRevealedEventNotification, Events::V2IamApiKeyExpiredEventNotification, Events::V2IamApiKeyPermissionsUpdatedEventNotification, Events::V2IamApiKeyRotatedEventNotification, Events::V2IamApiKeyUpdatedEventNotification, Events::V2IamStripeAccessGrantApprovedEventNotification, Events::V2IamStripeAccessGrantCanceledEventNotification, Events::V2IamStripeAccessGrantDeniedEventNotification, Events::V2IamStripeAccessGrantRemovedEventNotification, Events::V2IamStripeAccessGrantRequestedEventNotification, Events::V2IamStripeAccessGrantUpdatedEventNotification, Events::V2MoneyManagementAdjustmentCreatedEventNotification, Events::V2MoneyManagementFinancialAccountCreatedEventNotification, Events::V2MoneyManagementFinancialAccountUpdatedEventNotification, Events::V2MoneyManagementFinancialAddressActivatedEventNotification, Events::V2MoneyManagementFinancialAddressFailedEventNotification, Events::V2MoneyManagementInboundTransferAvailableEventNotification, Events::V2MoneyManagementInboundTransferBankDebitFailedEventNotification, Events::V2MoneyManagementInboundTransferBankDebitProcessingEventNotification, Events::V2MoneyManagementInboundTransferBankDebitQueuedEventNotification, Events::V2MoneyManagementInboundTransferBankDebitReturnedEventNotification, Events::V2MoneyManagementInboundTransferBankDebitSucceededEventNotification, Events::V2MoneyManagementOutboundPaymentCanceledEventNotification, Events::V2MoneyManagementOutboundPaymentCreatedEventNotification, Events::V2MoneyManagementOutboundPaymentFailedEventNotification, Events::V2MoneyManagementOutboundPaymentPostedEventNotification, Events::V2MoneyManagementOutboundPaymentReturnedEventNotification, Events::V2MoneyManagementOutboundPaymentUpdatedEventNotification, Events::V2MoneyManagementOutboundTransferCanceledEventNotification, Events::V2MoneyManagementOutboundTransferCreatedEventNotification, Events::V2MoneyManagementOutboundTransferFailedEventNotification, Events::V2MoneyManagementOutboundTransferPostedEventNotification, Events::V2MoneyManagementOutboundTransferReturnedEventNotification, Events::V2MoneyManagementOutboundTransferUpdatedEventNotification, Events::V2MoneyManagementPayoutMethodCreatedEventNotification, Events::V2MoneyManagementPayoutMethodUpdatedEventNotification, Events::V2MoneyManagementReceivedCreditAvailableEventNotification, Events::V2MoneyManagementReceivedCreditFailedEventNotification, Events::V2MoneyManagementReceivedCreditReturnedEventNotification, Events::V2MoneyManagementReceivedCreditSucceededEventNotification, Events::V2MoneyManagementReceivedDebitCanceledEventNotification, Events::V2MoneyManagementReceivedDebitFailedEventNotification, Events::V2MoneyManagementReceivedDebitPendingEventNotification, Events::V2MoneyManagementReceivedDebitSucceededEventNotification, Events::V2MoneyManagementReceivedDebitUpdatedEventNotification, Events::V2MoneyManagementRecipientVerificationCreatedEventNotification, Events::V2MoneyManagementRecipientVerificationUpdatedEventNotification, Events::V2MoneyManagementTransactionCreatedEventNotification, Events::V2MoneyManagementTransactionUpdatedEventNotification, Events::V2PaymentsOffSessionPaymentAttemptFailedEventNotification, Events::V2PaymentsOffSessionPaymentAttemptStartedEventNotification, Events::V2PaymentsOffSessionPaymentAuthorizationAttemptFailedEventNotification, Events::V2PaymentsOffSessionPaymentAuthorizationAttemptStartedEventNotification, Events::V2PaymentsOffSessionPaymentCanceledEventNotification, Events::V2PaymentsOffSessionPaymentCreatedEventNotification, Events::V2PaymentsOffSessionPaymentFailedEventNotification, Events::V2PaymentsOffSessionPaymentRequiresCaptureEventNotification, Events::V2PaymentsOffSessionPaymentSucceededEventNotification, Events::V2PaymentsSettlementAllocationIntentCanceledEventNotification, Events::V2PaymentsSettlementAllocationIntentCreatedEventNotification, Events::V2PaymentsSettlementAllocationIntentErroredEventNotification, Events::V2PaymentsSettlementAllocationIntentFundsNotReceivedEventNotification, Events::V2PaymentsSettlementAllocationIntentMatchedEventNotification, Events::V2PaymentsSettlementAllocationIntentNotFoundEventNotification, Events::V2PaymentsSettlementAllocationIntentSettledEventNotification, Events::V2PaymentsSettlementAllocationIntentSplitCanceledEventNotification, Events::V2PaymentsSettlementAllocationIntentSplitCreatedEventNotification, Events::V2PaymentsSettlementAllocationIntentSplitSettledEventNotification, Events::V2PaymentsSettlementAllocationIntentSubmittedEventNotification, Events::V2ReportingReportRunCreatedEventNotification, Events::V2ReportingReportRunFailedEventNotification, Events::V2ReportingReportRunSucceededEventNotification, Events::V2ReportingReportRunUpdatedEventNotification, Events::V2SignalsAccountSignalFraudulentMerchantReadyEventNotification

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_payload, client) ⇒ EventNotification

Returns a new instance of EventNotification.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 37

def initialize(event_payload, client)
  @id = event_payload[:id]
  @type = event_payload[:type]
  @created = event_payload[:created]
  @livemode = event_payload[:livemode]
  @reason = EventReason.new(event_payload[:reason]) if event_payload[:reason]
  if event_payload[:context] && !event_payload[:context].empty?
    @context = StripeContext.parse(event_payload[:context])
  end
  # private unless a child declares an attr_reader
  @related_object = RelatedObject.new(event_payload[:related_object]) if event_payload[:related_object]

  # internal use
  @client = client
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



35
36
37
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 35

def context
  @context
end

#createdObject (readonly)

Returns the value of attribute created.



35
36
37
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 35

def created
  @created
end

#idObject (readonly)

Returns the value of attribute id.



35
36
37
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 35

def id
  @id
end

#livemodeObject (readonly)

Returns the value of attribute livemode.



35
36
37
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 35

def livemode
  @livemode
end

#reasonObject (readonly)

Returns the value of attribute reason.



35
36
37
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 35

def reason
  @reason
end

#typeObject (readonly)

Returns the value of attribute type.



35
36
37
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 35

def type
  @type
end

Instance Method Details

#fetch_eventObject

Retrieves the Event that generated this EventNotification.



54
55
56
57
58
59
# File 'lib/stripe/resources/v2/core/event_notification.rb', line 54

def fetch_event
  resp = @client.raw_request(:get, "/v2/core/events/#{id}", opts: { stripe_context: context,
                                                                    "Stripe-Request-Trigger" => "event=#{id}", },
                                                            usage: ["fetch_event"])
  @client.deserialize(resp.http_body, api_mode: :v2)
end