remp / crm-subscriptions-module
CRM Subscriptions Module
Installs: 37 753
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 8
Open Issues: 2
Requires
- php: ^8.1
- dev-master
- 3.5.0
- 3.4.0
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.1
- 3.0.0
- 2.11.1
- 2.11.0
- 2.10.0
- 2.9.1
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.0
- 1.2.0
- 1.1.0
- 1.0.0
- 1.0.0-beta2
- 1.0.0-beta1
- 0.39.0
- 0.38.0
- 0.37.0
- 0.36.1
- 0.36.0
- 0.35.0
- 0.34.0
- 0.33.1
- 0.33.0
- 0.32.1
- 0.32.0
- 0.31.0
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.0
- 0.26.0
- 0.25.0
- 0.24.1
- 0.24.0
- 0.23.0
- 0.22.0
- 0.21.0
- 0.20.0
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.0
- 0.13.0
- 0.12.0
- 0.11.0
- 0.10.0
- 0.9.0
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.0
- 0.6.0
- 0.5.0
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.1
This package is auto-updated.
Last update: 2024-10-25 12:18:29 UTC
README
This documentation describes API handlers provided by this module for others to use. It expects your application is based on the CRM skeleton provided by us.
Installing module
We recommend using Composer for installation and update management.
composer require remp/crm-subscriptions-module
Enabling module
Add installed extension to your app/config/config.neon
file.
extensions: - Crm\SubscriptionsModule\DI\SubscriptionsModuleExtension
Widgets
Widgets are small reusable components that can be used on different places within CRM. Module can provide widget placeholders for other modules to populate or widget implementations.
Available widgets
SubscribersWithMissingAddressWidget
Widget displays list of all subscribers with specified content access that don't have specified address type entered in the system. It is placed at the admin.payments.top
placeholder, above the payments listing.
By default the widget displays all print
subscribers without print
address type entered. You can change the configuration in your config.local.neon
and check different content access names against different address types:
subscribersWithMissingAddressWidget: setup: - setContentAccessNames(print, print_friday) - setAddressTypes(print, print_other)
Available placeholders
These are widget placeholders provided by Payments Module. You can register your own widgets to be displayed at following places:
admin.payments.top
payments.banktransfer.right
payments.admin.payment_source_listing
payments.admin.payment_item_listing
payments.frontend.payments_my.top
payments.arpu.bottom
API documentation
All examples use http://crm.press
as a base domain. Please change the host to the one you use
before executing the examples.
All examples use XXX
as a default value for authorization token, please replace it with the
real tokens:
- API tokens. Standard API keys for server-server communication. It identifies the calling application as a whole.
They can be generated in CRM Admin (
/api/api-tokens-admin/
) and each API key has to be whitelisted to access specific API endpoints. By default the API key has access to no endpoint. - User tokens. Generated for each user during the login process, token identify single user when communicating between
different parts of the system. The token can be read:
- From
n_token
cookie if the user was logged in via CRM. - From the response of
/api/v1/users/login
endpoint - you're free to store the response into your own cookie/local storage/session.
- From
API responses can contain following HTTP codes:
If possible, the response includes application/json
encoded payload with message explaining
the error further.
GET /api/v1/users/subscriptions
Returns all user subscriptions with information when they start/end and which content type they give an access to.
Headers:
Params:
Example:
curl -X POST \ http://crm.press/api/v1/users/subscriptions \ -H 'Authorization: Bearer XXX' \ -H 'Content-Type: application/x-www-form-urlencoded'
Response:
{ "status": "ok", "subscriptions": [ // Array; list of subscriptions { "start_at": "2019-01-15T00:00:00+01:00", // String; RFC3339 encoded start time "end_at": "2020-01-15T00:00:00+01:00", // String; RFC3339 encoded end time "code": "web_year", // String; subscription code (slug) "access": [ // Array: list of all types of content subscription includes "web" // String; name of the content type ], "name": "Web year subscription type", "user_label": "Web year", }, { "start_at": "2019-03-05T00:00:00+01:00", "end_at": "2019-03-19T00:00:00+01:00", "code": "mobile-welcome-action", "access": [ "web", "mobile" ], "name": "Web year subscription type with mobile access", "user_label": "Web & Mobile", } ] }
POST /api/v1/subscriptions/create
Creates new subscription for given user and returns new instance.
Headers:
Params:
Example:
curl -X POST \ http://crm.press/api/v1/subscriptions/create \ -H 'Authorization: Bearer XXX' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'email=user%40user.sk&subscription_type_id=73&is_paid=true'
Response:
{ "status": "ok", "message": "Subscription created", "subscriptions": { "id": 628893, // string; ID of new subscription "start_time": "2019-03-08T13:35:05+01:00", // String; RFC3339 formatted start time of subscription "end_time": "2019-05-09T13:35:05+02:00" // String; RFC3339 formatted end time of subscription } }
POST /api/v1/subscriptions/update
Update subscription based on sent parameters.
Headers:
Params:
Example:
curl -X POST \ http://crm.press/api/v1/subscriptions/update \ -H 'Authorization: Bearer XXX' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'id=12345&subscription_type_id=73&is_paid=true'
Response:
{ "status": "ok", "message": "Subscription updated", "subscriptions": { "id": 628893, // string; ID of subscription "start_time": "2019-03-08T13:35:05+01:00", // String; RFC3339 formatted start time of subscription "end_time": "2019-05-09T13:35:05+02:00" // String; RFC3339 formatted end time of subscription } }
Components
ActualSubscribersRegistrationSourceStatsWidget
Admin dashboard stats graph widget.
ActualSubscribersStatWidget
Admin dashboard stats widget.
ActualSubscriptionLabel
Admin user listing component.
ActualSubscriptionsStatWidget
Admin dashboard actual subscriptions count widget.
ActualUserSubscriptions
Admin user detail stats widget.
EndingSubscriptionsWidget
Admin ending subscriptions listing widget.
MonthSubscriptionsSmallBarGraphWidget
Admin users header graph widget.
MonthSubscriptionStatWidget
Admin dashboard single stat widget.
MonthToDateSubscriptionStatWidget
Admin dashboard single stat widget.
PrintSubscribersWithoutPrintAddressWidget
Admin payments listing header widget.
RenewedSubscriptionsEndingWithinPeriodWidget
Admin dashboard stats widget.
SubscriptionButton
Admin listing edit subscription button widget.
SubscriptionEndsStats
Admin ending subscriptions types and content access listing component.
SubscriptionsEndingWithinPeriodWidget
Admin dashboard ending subscriptions stats widget.
TodaySubscriptionsStatWidget
Admin dashboard single stat widget.
TotalSubscriptionsStatWidget
Admin dashboard single stat widget.
UserSubscriptions
Admin user detail subscriptions listing widget.