Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ismcagdas committed Dec 24, 2019
2 parents 2befd8b + 3e933f0 commit 7baee57
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 27 deletions.
12 changes: 8 additions & 4 deletions docs/en/Features-Angular-Entity-History.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ When we click the magnifier icon, we can see all the details about a change log:

<img src="images/entity-history-log-detail.png" alt="Change Log Detail" class="img-thumbnail" />

You should add entity type that you want to track to ***.Core\EntityHistory\EntityHistoryHelper.TrackedTypes**. And make sure you uncomment following lines in ***.EntityFrameworkCore\EntityFrameworkCore\{YourProjectName}EntityFrameworkCoreModule.cs**
You should add entity type that you want to track to ***.Core\EntityHistory\EntityHistoryHelper.TrackedTypes**. Make sure you uncomment following lines in ***.EntityFrameworkCore\EntityFrameworkCore\{YourProjectName}EntityFrameworkCoreModule.cs** and set **Configuration.EntityHistory.IsEnabled** to **true**.

```csharp
//Configuration.EntityHistory.Selectors.Add("AbpZeroTemplateEntities", EntityHistoryHelper.TrackedTypes);
//Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration));
// Set this setting to true for enabling entity history.
Configuration.EntityHistory.IsEnabled = false;

// Uncomment below line to write change logs for the entities below:
// Configuration.EntityHistory.Selectors.Add("AbpZeroTemplateEntities", EntityHistoryHelper.TrackedTypes);
// Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration));
```

The first line here adds entity types defined in `EntityHistoryHelper.TrackedTypes` to entity history config, so changes on those entities will be recorded. The second line adds a custom config provider to `CustomConfigProviders` list. ASP.NET Zero executes `GetConfig` method of each `CustomConfigProvider` and returns the result of `GetConfig` to Angular client app.
The first commented line here adds entity types defined in `EntityHistoryHelper.TrackedTypes` to entity history config, so changes on those entities will be recorded. The second commented line adds a custom config provider to `CustomConfigProviders` list. ASP.NET Zero executes `GetConfig` method of each `CustomConfigProvider` and returns the result of `GetConfig` to Angular client app.

So, in this particular case, `EntityHistoryConfigProvider` returns if entity history feature is enabled or not and if enabled, it returns list of entities enabled for entity history. Angular client app uses those information to show entity history related buttons on each entity page.

Expand Down
51 changes: 42 additions & 9 deletions docs/en/Features-Angular-Subscription-Stripe-Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,64 @@ In order to configure Stripe, open `appsettings.json` file in ***.Web.Host** pro
- **SecretKey:** Your Stripe SecretKey.
- **PublishableKey:** Your Stripe PublishableKey.
- **WebhookSecret:** Your Stripe WebHookSecret which is used to validate WebHook requests.
- **PaymentMethodTypes** (array containing strings): Supported payment method types, check [stripe payment method types](https://stripe.com/docs/payments/payment-methods)

Stripe supports recurring payments. If a tenant wants to pay via Stripe and accepts automatically billing the account used for the initial payment, then Stripe charges the amount from Tenants account on each subscription cycle and notifies ASP.NET Zero. Then, ASP.NET Zero extends the subscription for the paid period (either monthly or annual).

<img src="images/subscription-stripe-recurring-payments.png" alt="Stripe recurring payments" class="img-thumbnail" />

If "Automatically bill my account" option is not selected on the payment page, tenants should login to the system and manually extend their subscription by clicking the "**Extend**" button on the subscription page and pay manually.



## Testing Stripe WebHooks on Localhost

In order to get Stripe's WebHook request on your local environment, you need to use an external tool. [https://webhookrelay.com](https://webhookrelay.com) is one of the best tools on the web at the moment. [How to receive Stripe webhooks on localhost](https://webhookrelay.com/blog/2017/12/26/receiving-stripe-webhooks-localhost/) can be used to test Stripe's WebHooks on the localhost. Basically, you need to create an account on [https://webhookrelay.com](https://webhookrelay.com), then need to download relay.exe to your development machine.
##### Stripe-Cli

You can use stripe-cli in order to get Stripe's WebHooks requests on your local environment. To download it, go to https://dashboard.stripe.com/webhooks page. And install stripe-cli

![stripe-test-stripe-cli-download](D:/GitHub/documents/docs/en/images/stripe-test-stripe-cli-download.png)

After you download it, login to stripe-cli https://github.com/stripe/stripe-cli/wiki/login-command

Then you can forward webhooks to AspNet Zero with running listener.

```powershell
stripe listen --forward-to http://localhost:22742/Stripe/WebHooks
```

That will forward all events to your local project. For more information check: https://github.com/stripe/stripe-cli/wiki/listen-command

*After you connect successfully your device will be listed.*

![stripe-test-stripe-cli-list](D:/GitHub/documents/docs/en/images/stripe-test-stripe-cli-list.png)

##### Webhookrelay

In order to get Stripe's webhook request on your local environment, you can also use external tools like [https://webhookrelay.com](https://webhookrelay.com).It is one of the best tools on the web at the moment. [How to receive Stripe webhooks on localhost](https://webhookrelay.com/blog/2017/12/26/receiving-stripe-webhooks-localhost/) can be used to test Stripe's webhook on the localhost. Basically, you need to create an account on [https://webhookrelay.com](https://webhookrelay.com), then need to download relay.exe to your development machine.

Then, you need to run relay.exe like this;

```./relay.exe forward --bucket stripe http://localhost:22742/Stripe/WebHooks```
```powershell
./relay.exe forward --bucket stripe http://localhost:22742/Stripe/WebHooks
```

This will give you an url something like "https://my.webhookrelay.com/v1/webhooks/aa180d45-87d5-4e9c-8bfa-e535a91df3fc". You need to enter this url as an webhook endpoint on Stripe's webhook dashboard ([https://dashboard.stripe.com/account/webhooks](https://dashboard.stripe.com/account/webhooks)).

Don't forget to enter your production app's URL as a webhook endpoint when you publish your app to production.



**Note that;**

This will give you an url something like "https://my.webhookrelay.com/v1/webhooks/aa180d45-87d5-4e9c-8bfa-e535a91df3fc". You need to enter this url as an WebHook endpoint on Stripe's WebHook dashboard ([https://dashboard.stripe.com/account/webhooks](https://dashboard.stripe.com/account/webhooks)).
- Tenants can disable or enable Stripe to charge their accounts automatically on the Subscription page.

Don't forget to enter your production app's URL as a WebHook endpoint when you publish your app to production.
- When upgrading to an higher edition, AspNet Zero calculates the cost for upgrade and charges it from Tenants account(with using checkout).

Note that;
- When a tenant subscribes to an edition using Stripe and if admin user changes the edition of the Tenant on Tenant page to a higher edition, Tenant's account will be charged on stripe automatically.

- Tenants can disable or enable Stripe to charge their accounts automatically on the Subscription Page.
- When upgrading to an higher edition, stripe calculates the cost for upgrade and charges it from Tenants account. However, ASP.NET Zero can't show this amount during the edition upgrade process. But, this amount can be seen at the Payment History tab on Subscription page after a successful payment process.
- When a tenant subscribes to an edition using Stripe and if admin user changes the edition of the Tenant on Tenant page to a higher edition, Tenant's account will be charged on stripe automatically. If the Tenant is moved to an Edition with a lower price, there will be no change or refund on Stripe.
(https://stripe.com/docs/billing/subscriptions/prorations )

## Next

- [Visual Settings](Features-Angular-Visual-Settings)
- [Visual Settings](Features-Angular-Visual-Settings)
41 changes: 36 additions & 5 deletions docs/en/Features-Mvc-Core-Entity-History.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,49 @@

In change logs under audit logs menu, we can see all change logs (entity history) in the application:

<img src="images/entity-history-logs.png" alt="Change Logs" class="img-thumbnail" />
<img src="D:/Github/documents/docs/en/images/change-logs-core.png" alt="Change Logs" class="img-thumbnail" />

When we click the magnifier icon, we can see all details a change log. We can see which properties are changed.
When we click the magnifier icon, we can see all the details about a change log:

<img src="images/entity-history-log-detail.png" alt="Change Log Detail" class="img-thumbnail" />
<img src="D:/Github/documents/docs/en/images/entity-history-log-detail.png" alt="Change Log Detail" class="img-thumbnail" />

You should add entity type that you want to track to `*.Core\EntityHistory\EntityHistoryHelper.TrackedTypes`. And make sure you uncomment following line in `*.EntityFrameworkCore\EntityFrameworkCore\YourProjectNameEntityFrameworkCoreModule.cs`
You should add entity type that you want to track to ***.Core\EntityHistory\EntityHistoryHelper.TrackedTypes**. Make sure you uncomment following lines in ***.EntityFrameworkCore\EntityFrameworkCore\{YourProjectName}EntityFrameworkCoreModule.cs** and set **Configuration.EntityHistory.IsEnabled** to **true**.

```csharp
//Configuration.EntityHistory.Selectors.Add("AbpZeroTemplateEntities", EntityHistoryHelper.TrackedTypes);
// Set this setting to true for enabling entity history.
Configuration.EntityHistory.IsEnabled = false;

// Uncomment below line to write change logs for the entities below:
// Configuration.EntityHistory.Selectors.Add("AbpZeroTemplateEntities", EntityHistoryHelper.TrackedTypes);
// Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration));
```

The first commented line here adds entity types defined in `EntityHistoryHelper.TrackedTypes` to entity history config, so changes on those entities will be recorded. The second commented line adds a custom config provider to `CustomConfigProviders` list. ASP.NET Zero executes `GetConfig` method of each `CustomConfigProvider` and returns the result of `GetConfig` to Angular client app.

So, in this particular case, `EntityHistoryConfigProvider` returns if entity history feature is enabled or not and if enabled, it returns list of entities enabled for entity history. Angular client app uses those information to show entity history related buttons on each entity page.

For example, when entity history is enabled for an Entity, Angular client shows history dropdown menu item for each entity record on the related page. Here is a sample screenshot for role list:

<img src="D:/Github/documents/docs/en/images/change-logs-history-action-item.png" alt="Entity History Action" class="img-thumbnail" />

In this way, history of an entity can be retrieved both on change logs tab in audit logs page or on the list page of the entity itself.

The entity history config can be accessed on the Angular app like below:

```javascript
abp.custom.EntityHistory
```

The abp.custom.EntityHistory object contains properties below:

- **isEnabled**: Boolean field represents if entity history is enabled or not.
- **enabledEntities**: Array of string contains full name of entity types entity history is enabled for.

Here is a sample screenshot which show the value of **abp.custom.EntityHistory**:

<img src="D:/Github/documents/docs/en/images/change-logs-custom-config-result-core.png" alt="Entity history custom config" class="img-thumbnail" />


## Next

- [Subscription](Features-Mvc-Core-Subscription)
53 changes: 44 additions & 9 deletions docs/en/Features-Mvc-Core-Subscription-Stripe.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,70 @@
# Stripe

In order to configure Stripe, open appsettings.json file in *.Web.Mvc project and fill the values;
In order to configure Stripe, open ``appsettings.json` file in ***.Web.Mvc** project and fill the values;

- **IsActive:** This setting can be used to enable/disable Stripe. If set to false, end users will not see Stripe option during the payment process.
- **BaseUrl:** Url for making API calls to Stripe. You can find correct urls in your Stripe dashboard.
- **SecretKey:** Your Stripe SecretKey.
- **PublishableKey:** Your Stripe PublishableKey.
- **WebhookSecret:** Your Stripe WebhookSecret which is used to validate WebHook requests.
- **PaymentMethodTypes** (array containing strings): Supported payment method types, check [stripe payment method types](https://stripe.com/docs/payments/payment-methods)

Stripe supports recurring payments. If a tenant wants to pay via Stripe and accepts automatically billing the account used for the initial payment, then Stripe charges the amount from Tenants account on each subscription cycle and notifies AspNet Zero. Then, AspNet Zero extends the subscription for the paid period (either monthly or annual).

<img src="images/subscription-stripe-recurring-payments.png" alt="Stripe recurring payments" class="img-thumbnail" />

If "Automatically bill my account" option is not selected on the payment page, tenants should login to the system and manually extend their subscription by clicking the "**Extend**" button on the subscription page and pay manually.



## Testing Stripe WebHooks on Localhost

In order to get Stripe's WebHook request on your local environment, you need to use an external tool. [https://webhookrelay.com](https://webhookrelay.com) is one of the best tools on the web at the moment. [How to receive Stripe webhooks on localhost](https://webhookrelay.com/blog/2017/12/26/receiving-stripe-webhooks-localhost/) can be used to test Stripe's WebHooks on the localhost. Basically, you need to create an account on [https://webhookrelay.com](https://webhookrelay.com), then need to download relay.exe to your development machine.
##### Stripe-Cli

You can use stripe-cli in order to get Stripe's WebHooks requests on your local environment. To download it, go to https://dashboard.stripe.com/webhooks page. And install stripe-cli

![stripe-test-stripe-cli-download](images/stripe-test-stripe-cli-download.png)

After you download it, login to stripe-cli https://github.com/stripe/stripe-cli/wiki/login-command

Then you can forward webhooks to AspNet Zero with running listener.

```powershell
stripe listen --forward-to http://localhost:62114/Stripe/WebHooks
```

That will forward all events to your local project. For more information check: https://github.com/stripe/stripe-cli/wiki/listen-command

*After you connect successfully your device will be listed.*

![stripe-test-stripe-cli-list](images/stripe-test-stripe-cli-list.png)

##### Webhookrelay

In order to get Stripe's webhook request on your local environment, you can also use external tools like [https://webhookrelay.com](https://webhookrelay.com). It is one of the best tools on the web at the moment. [How to receive Stripe webhooks on localhost](https://webhookrelay.com/blog/2017/12/26/receiving-stripe-webhooks-localhost/) can be used to test Stripe's webhook on the localhost. Basically, you need to create an account on [https://webhookrelay.com](https://webhookrelay.com), then need to download relay.exe to your development machine.

Then, you need to run relay.exe like this;

```./relay.exe forward --bucket stripe http://localhost:62114/Stripe/WebHooks```
```powershell
./relay.exe forward --bucket stripe http://localhost:62114/Stripe/WebHooks
```

This will give you an url something like "https://my.webhookrelay.com/v1/webhooks/aa180d45-87d5-4e9c-8bfa-e535a91df3fc". You need to enter this url as an WebHook endpoint on Stripe's WebHook dashboard ([https://dashboard.stripe.com/account/webhooks](https://dashboard.stripe.com/account/webhooks)).
This will give you an url something like "https://my.webhookrelay.com/v1/webhooks/aa180d45-87d5-4e9c-8bfa-e535a91df3fc". You need to enter this url as an webhook endpoint on Stripe's webhook dashboard ([https://dashboard.stripe.com/account/webhooks](https://dashboard.stripe.com/account/webhooks)).

Don't forget to enter your production app's url as a WebHook endpoint when you publish your app to production.
Don't forget to enter your production app's url as a webhook endpoint when you publish your app to production.

Note that;


**Note that;**

- Tenants can disable or enable Stripe to charge their accounts automatically on the Subscription page.

- When upgrading to an higher edition, stripe calculates the cost for upgrade and charges it from Tenants account. However, AspNet Zero can't show this amount during the edition upgrade process. But, this amount can be seen at the Payment History tab on Subscription page after a successful payment process.
- When upgrading to an higher edition, AspNet Zero calculates the cost for upgrade and charges it from Tenants account(with using checkout).

- When a tenant subscribes to an edition using Stripe and if admin user changes the edition of the Tenant on Tenant page to a higher edition, Tenant's account will be charged on stripe automatically.

## Next
(https://stripe.com/docs/billing/subscriptions/prorations )

- [Visual Settings](Features-Mvc-Core-Visual-Settings)
## Next

- [Visual Settings](Features-Mvc-Core-Visual-Settings)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/en/images/stripe-test-stripe-cli-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7baee57

Please sign in to comment.