- 04 Dec 2024
- 6 Minutes to read
- Print
- PDF
Events
- Updated on 04 Dec 2024
- 6 Minutes to read
- Print
- PDF
Introduction
The payload of an event will consist of two parts:
- General fields, common to all events
- Event specific fields, nested within the data field
General payload fields
Field | Type | Description |
---|---|---|
time | Integer | Epoch timestamp in milliseconds of the event. |
type | String | Type of the event. Possible values are listed below. |
source | String | Source of the event. Is equal to the Connect client schema name. |
status | String | Status of the resource associated to the event. |
data | Object | Data for the resource associated to the event. |
Event types
- subscription
- product
- order
- coupon
- customer
- consent
Subscription
This event is generated by Connect when there is an update on a subscription.
General fields
Field | Description |
---|---|
type | The field will contain the value 'subscription'. |
status | The status of the subscription. Possible values: 'start': The subscription is started. 'stop': The subscription is stopped. 'renew': The subscription is renewed. 'stop_reset': The subscription was stopped and starts agian. 'deliveryplan_changed:' Deliveryplan has been changed on subscription. |
Event specific fields
Field | Type | Description | Nullable |
---|---|---|---|
customerNumber | Integer | Connect customer number related to the event. | No |
productCode | String | Product code of the subscription that has started. | No |
periodEnd | Integer | Epoch timestamp in milliseconds for end of current subscription period. | Yes |
Example payload
{
"time": 1610665200000,
"type": "subscription",
"source": "CN_DEV",
"status": "start",
"data": {
"customerNumber": 12345,
"productCode": "PROD1",
"periodEnd": 1610665200000
}
}
Product
This event is generated when a product is new, updated or deleted.
General fields
Field | Description |
---|---|
type | The field will contain the value 'product'. |
status | The status of the product. Possible values: 'new': The product is active. 'update': The product is updated. 'delete': The product is deleted. |
Event specific fields
Field | Type | Description | Nullable |
---|---|---|---|
productCode | String | Product code | No |
companyCode | String | Company code | Yes |
Example payload
{
"time": 1610665200000,
"type": "product",
"source": "CN_DEV",
"status": "new",
"data": {
"productCode": "KUP",
"companyCode": "468979834"
}
}
Coupon
This event is generated when a coupon is created, updated or deleted.
General fields
Field | Description |
---|---|
type | The field will contain the value 'coupon'. |
status | The status of the coupon. Possible values: 'new': The coupon is new. 'update': The coupon is updated. 'delete': The coupon is deleted. |
Event specific fields
Field | Type | Description | Nullable |
---|---|---|---|
couponCode | String | Coupon code | No |
couponNumber | Integer | Coupon number | No |
Example payload
{
"time": 1610665200000,
"type": "coupon",
"source": "CN_DEV",
"status": "new",
"data": {
"couponCode": "KUP",
"couponNumber": 99
}
}
Order
This event is generated when order process is initiated or processed.
General fields
Field | Description |
---|---|
type | The field will contain the value 'order'. |
status | The status of the order. Possible values: 'verified': The verification process of an order is initiated. 'processed': The verification process of an order is processed. |
Event specific fields
Field | Type | Description | Nullable |
---|---|---|---|
receivers | Integer array | List of Connect customer numbers that are receivers in the order. This will be empty if payer is the same as the receiver. | Yes |
payer | Integer | Connect customer number of the payer of the order. | Yes |
connectOrderNumber | Integer | Connect order number. | No |
connectIDOrderNumber | Integer | ConnectID order number. | Yes |
status | String | Status code for the order. See description here. | Yes |
Example payload
{
"time": 1610665200000,
"type": "order",
"source": "CN_DEV",
"status": "verified",
"data": {
"receivers": [
23456,
34567
],
"payer": 12345,
"connectOrderNumber": 54321,
"connectIDOrderNumber": 24680,
"status": "B"
}
}
Customer
The event will be generated and sent to EventBrigde if customer data has been changed. This means the event will be trigged by a change of name, address, email address, or phone numbers.
General fields
Field | Description |
---|---|
type | The field will contain the value 'customer'. |
status | The status of the customer data. Possible values: 'data_changed': Customer data is updated. 'new': New customer is created. |
Event specific fields
Field | Type | Description | Nullable |
---|---|---|---|
customerNumber | Integer | Customer number. | No |
name | object | Object containing name information. | No |
firstName | String | Customer first name. | Yes |
middleName | String | Customer middle name. | Yes |
lastName | String | Customer last name. | Yes |
companyName | String | Name of the company. | Yes |
departmentName | String | department name. | Yes |
phoneNumbers | object array | Object containing phone numbers. | No |
phoneNumber | String | The phone number, following the E.164 standard. | Yes |
phoneNumberType | String | Phone number type: Company, Personal, Fax | Yes |
emails | String array | Email addresses. | No |
address | object | Object containing address information. | No |
addressType | String | Address type - possible values: 'currentAddress' 'historicalAddress' 'futureAddress' | No |
streetAddress | String | The street name for this address. | Yes |
streetNumber | Integer | The street number for this address. | Yes |
entrance | String | The entrance for this address. | Yes |
floor | Short | The floor for this address. | Yes |
postalCode | String | The postal code for this address. | Yes |
postalPlace | String | The postal place for this address. | Yes |
postalAddress | String | The postal address for this address. | Yes |
countryCode | String | The country code for this address - ISO 3166 - alpha-2. | Yes |
Example payload
{
"time": 1610665200000,
"type": "customer",
"source": "CN_DEV"
"status": "data_changed",
"data": {
"customerNumber": 3,
"name": {
"firstName": "Kari",
"middleName": "Fjordstrand",
"lastName": "Nordmann",
"companyName": "Mediaconnect",
"departmentName": "Support"
},
"phoneNumbers": [
{
"phoneNumber": "+4711122333",
"phoneNumberType": "personal"
},
{
"phoneNumber": "+4711133444",
"phoneNumberType": "company"
}
],
"emails": [
"email1@mediaconnnect.no",
"email2@mediaconnect.no"
],
"address": {
"addressType": "currentAddress",
"streetAddress": "Storgt.",
"streetNumber": 56,
"entrance": "A",
"floor": 2,
"postalCode": "2016",
"postalPlace": "Oslo",
"postalAddress": "Pb 265 Økern",
"countryCode": "NO"
}
}
}
Consent
This event is generated when a consent is changed.
The change of consent (consent event) can be done either in Connect KS or via API. It is important to be aware that if a consent event triggers "sub-consents" as well, then events will be sent for these as well.
General fields
Field | Description |
---|---|
type | The field will contain the value 'consent'. |
status | The status of the consent data. Possible values: 'new': The consent is created. 'updated': The consent is updated. |
Event specific fields
Field | Type | Description | Nullable |
---|---|---|---|
consentEventId | Integer | The consent event Id. | No |
consent | object | Object containing consent information. | No |
consentId | Integer | Consent ID for this event. | No |
consentTarget | String | Identification of the target of the consent (e.g. URL of a policy) | No |
consentScope | String | Scope of the consent. Typically, this will refer to a section or clause in the target | . Yes |
subject | String | Identification of the subject: Enter Customer number for subjectType CONNECT Enter Credential for subjectType CONNECTID Enter External id for subjectType EXTERNAL Enter ConnectID orderid for subjectType ORDER. | No |
subjectType | String | Type of subject - possible values: 'CONNECT' 'CONNECTID' 'EXTERNAL' 'ORDER' | No |
source | String | Identification of the source of the consent principal | Yes |
action | Boolean | It informs if the consent is granted. 'true': The consent is granted. 'false': The consent is revoked or granted. | No |
Example payload
{
"time": 1610665200000,
"type": "consent",
"source": "CNDEV",
"status": "updated",
"data": {
"consentEventId": 12345,
"consent": {
"consentId": 456,
"consentTarget": "target",
"consentScope": "scope",
"subject": 12345,
"subjectType": "CONNECT",
"action": true,
"source": "Selfservice"
}
}
}
Order status codes
The following status codes are used on Connect orders.
Code | Description |
---|---|
A | Preliminary order (not yet confirmed by the merchant service provider). |
B | Confirmed order, initial status for most orders. |
C | Order updated in client schema. |
D | An error occurred on this order. |
G | Duplicate order. |
H | Wrong coupon code or number. |
I | Error creating a name and/or address. |
J | Error creating recurring product. |
K | This order should not be processed. |
L | This order needs to be processed manually. |
M | This order has been processed manually. |
N | Error due to active gift subscription. |
O | Error due to active gift subscription, email sent. |
P | Error when handling prepaid/single credit card. |