Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating format and presentation of JSON #553

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 116 additions & 90 deletions docs/Publisher-Experience.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Publisher Portal - Sample Web Application

## Table of contents

<!-- no toc -->
- [Table of contents](#table-of-contents)
- [Overview](#overview)
- [Manage new subscription landing page input fields](#manage-new-subscription-landing-page-input-fields)
Expand All @@ -13,8 +15,9 @@
- [Change quantity](#change-quantity)
- [Emit usage events](#emit-usage-events)
- [Unsubscribe](#unsubscribe)
- [View activity log](#view-activity-log)
- [View activity log](#view-activity-log)
- [External Web Notification Setup](#external-web-notification-setup)

- [Metered Scheduler Manager](./Metered-Scheduler-Manager-Instruction.md)

## Overview
Expand Down Expand Up @@ -285,114 +288,137 @@ Task<OperationResult> GetOperationStatusResultAsync(Guid subscriptionId, Guid op
The "External Notification Configuration" feature enables publishers to set up an external notification URL to receive event notifications for specific actions performed by customers. Publishers can configure the URL to which notifications will be sent when customers interact on thie SaaS Accelerator instance with the following events:

1. **Subscribe or Activate Button Click:** Whenever a customer clicks on the "Subscribe" or "Activate" button on the Landing Page, an event notification will be triggered.

2. **Webhook Notifications is received:** This feature supports various webhook notifications, including "Change Plan," "Change Quantity," and "Unsubscribe" events. Whenever any of these events occur and as they are received on Webhook endpoint, the corresponding notifications will be sent to the configured external URL.

### How to setup

1. Go to Application configuration on the Admin portal
1. Edit the config ```WebNotificationUrl``` and set the external web notification URL value (If this setting doesnt exist please make sure you are running the latest version of the Accelerator)

### Monitoring and payload information
1. ISV can monitor these events in the Application log page
1. Below is the format of the body, ISV can expect when they recieve the notification. ```payloadFromLandingpage``` is empty for Webhook notifications and ```payloadFromWebhook``` is empty for Landingpage notification
### Monitoring

ISV can review these events in the Application log page of the administration portal

#### Example payload from landingpage
```
"body": {
"applicationName": "Contoso", [App Name from Config]
"eventType": "LandingPage", [LandingPage/Webhook]
"payloadFromLandingpage": {
"landingpageSubscriptionParams": [
{
"key": "country",
"value": "test"
},
{
"key": "phone",
"value": "test"
}
],
"id": "<Guid>",
"publisherId": "test",
"offerId": "test",
"name": "test",
"saasSubscriptionStatus": "PendingFulfillmentStart",
"planId": "basic",
"quantity": 0,
"purchaser": {
"tenantId": "<Guid>",
"emailId": "test",
"objectId": "<Guid>"
},
"beneficiary": {
"tenantId": "<Guid>",
"emailId": "[email protected]",
"puid": null,
"objectId": "<Guid>"
### Payload information


Below is the format of the body, ISV can expect when they recieve the notification.

`payloadFromLandingpage` is empty for Webhook notifications and `payloadFromWebhook` is empty for Landingpage notification.

#### Interesting JSON values

| Value | Notes |
| -------- | ------- |
| `applicationName` | App name from settings |
| `eventType` | LandingPage or Webhook |
| `payloadFromLandingpage` | Empty if `payloadFromWebhook` present |
| `payloadFromWebhook` | Empty if `payloadFromLandingpage` present |
| `payloadFromWebhook` > `action` | One of: `ChangePlan`, `ChangeQuantity`, `Renew`, `Suspend`, `Unsubscribe`, `Reinstate`. For more detail [see here](https://learn.microsoft.com/en-us/partner-center/marketplace/partner-center-portal/pc-saas-fulfillment-webhook). |

#### Landing page sample payload

```json
{
"applicationName": "Contoso",
"eventType": "LandingPage",
"payloadFromLandingpage": {
"landingpageSubscriptionParams":
[

{
"key": "country",
"value": "test"
},
"term": {
"endDate": "0001-01-01T00:00:00+00:00",
"startDate": "0001-01-01T00:00:00+00:00",
"termUnit": "P1M"
{
"key": "phone",
"value": "test"
}
],
"id": "<Guid>",
"publisherId": "test",
"offerId": "test",
"name": "test",
"saasSubscriptionStatus": "PendingFulfillmentStart",
"planId": "basic",
"quantity": 0,
"purchaser": {
"tenantId": "<Guid>",
"emailId": "test",
"objectId": "<Guid>"
},
"payloadFromWebhook": {}
}
"beneficiary": {
"tenantId": "<Guid>",
"emailId": "[email protected]",
"puid": null,
"objectId": "<Guid>"
},
"term": {
"endDate": "0001-01-01T00:00:00+00:00",
"startDate": "0001-01-01T00:00:00+00:00",
"termUnit": "P1M"
}
},
"payloadFromWebhook": {}
}
```

#### Example payload from Webhook events
```
"body": {
"applicationName": "Contoso", [App Name from Config]
"eventType": "Webhook", [LandingPage/Webhook]
"payloadFromLandingpage": {},
"payloadFromWebhook": {
"action": "ChangePlan",
"activityId": "<Guid>",
#### Webhook `Unsubscribe` event sample payload

```json
{
"applicationName": "Contoso",
"eventType": "Webhook",
"payloadFromLandingpage": {},
"payloadFromWebhook": {
"action": "Unsubscribe",
"activityId": "<Guid>",
"offerId": "test",
"Id": "<Guid>",
"PlanId": "test",
"PublisherId": "test",
"Quantity": 1,
"status": "Succeeded",
"subscriptionId": "<Guid>",
"timeStamp": "2023-07-01T21:26:08.1492174+00:00",
"subscription": {
"id": "<Guid>",
"name": "test",
"offerId": "test",
"Id": "<Guid>",
"PlanId": "basic",
"PublisherId": "test",
"Quantity": 1,
"status": "InProgress",
"subscriptionId": "<Guid>",
"timeStamp": "2023-07-01T21:23:24.2354373+00:00",
"subscription": {
"id": "<Guid>",
"name": "test",
"offerId": "test",
"planId": "test",
"quantity": null,
"saasSubscriptionStatus": "Subscribed"
}
"planId": "test",
"quantity": null,
"saasSubscriptionStatus": "Unsubscribed"
}
}
}
```

"body": {
"applicationName": "Contoso", [App Name from Config]
"eventType": "Webhook", [LandingPage/Webhook]
"payloadFromLandingpage": {},
"payloadFromWebhook": {
"action": "Unsubscribe",
"activityId": "<Guid>",
#### Webhook `ChangePlan` event sample payload

```json
{
"applicationName": "Contoso",
"eventType": "Webhook",
"payloadFromLandingpage": {},
"payloadFromWebhook": {
"action": "ChangePlan",
"activityId": "<Guid>",
"offerId": "test",
"Id": "<Guid>",
"PlanId": "basic",
"PublisherId": "test",
"Quantity": 1,
"status": "InProgress",
"subscriptionId": "<Guid>",
"timeStamp": "2023-07-01T21:23:24.2354373+00:00",
"subscription": {
"id": "<Guid>",
"name": "test",
"offerId": "test",
"Id": "<Guid>",
"PlanId": "test",
"PublisherId": "test",
"Quantity": 1,
"status": "Succeeded",
"subscriptionId": "<Guid>",
"timeStamp": "2023-07-01T21:26:08.1492174+00:00",
"subscription": {
"id": "<Guid>",
"name": "test",
"offerId": "test",
"planId": "test",
"quantity": null,
"saasSubscriptionStatus": "Unsubscribed"
}
"planId": "test",
"quantity": null,
"saasSubscriptionStatus": "Subscribed"
}
}
}
```