Giter Site home page Giter Site logo

onify / blueprint-cloudblue-commerce-change-subscription Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 812 KB

Onify Blueprint: Change subscription in CloudBlue Commerce

Home Page: https://onify.co

License: MIT License

JavaScript 100.00%
bpmn cloudblue flow integration onify onify-blueprint onify-blueprints rest-api

blueprint-cloudblue-commerce-change-subscription's Introduction

Onify Blueprints

Project Status: WIP โ€“ Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Test suite

Onify Blueprint: Change subscription in CloudBlue Commerce

About

About CloudBlue

CloudBlue is a SaaS company that is helping businesses transform themselves, whatever their position in the supply chain. They provide a managed marketplace platform that takes the complexity out of distributing subscription- based solutions in the everything-as-a-service world. CloudBlue Commerce is multi-tier commerce platform that allows companies to build marketplaces.

Also checkout https://github.com/cloudblue.

About this Blueprint

This Blueprint increases or decreases product quantity for a specific subscription via CloudBlue REST-API. I only works if you have one product per subscription! If you have multiple products in the same subscription, only the first will be updated.

Note: The provisioning of licenses is async and you are not allowed to update a subscription that is currently in provisioning mode.

Onify Blueprint: Change subscription in CloudBlue Commerce

Requirements

Included

  • 1 x Flow (BPMN)

Setup

CloudBlue Commerce

Follow these instructions to get a API Subscription Key.

For more information about the CloudBlue Commerce API, please see https://apidocs.cloud.im/1.8/howto/ready.

Onify

Add the following settings in Onify.

Key Name Value Type Tag Role Description
cloudblue_baseurl CloudBlue Base URL <BASEURL> string cloudblue, frontend admin The Base URL for the API, eg. https://api.cloud.im/marketplace/eu
cloudblue_marketplace CloudBlue Marketplace <MARKETPLACE> string cloudblue, frontend admin The short name for the commercial marketplace, eg. se
cloudblue_subscriptionkey CloudBlue Subscription Key <KEY> password cloudblue, frontend admin Subscription to API services that contains certain limits on the API usage, for example, it defines the upper limit on the number of requests your system can send per a period of time.
cloudblue_username CloudBlue Username <USERNAME> string cloudblue, frontend admin Username is the login name to authenticate your system.
cloudblue_password CloudBlue Password <PASSWORD> password cloudblue, frontend admin Password for the user

Note: Creating settings via admin interface add a trailing _ in key. This is required for flow to work.

Deploy

  1. Open the BPMN diagram in Camunda Modeler.
  2. Deploy the BPMN diagram (click Deploy current diagram and follow the steps).

Run

This workflow should be run as a adhoc workflow and can be part of another process. Here is an example how to get a secret using a simple curl command.

Variables

  • subscriptionId - The id for the subscription
  • poNumber - Purchase order number (optional)
  • changeType - increase or decrease the quantity
  • units - Units to either increase or decrease product quantity

Example request

curl -X 'POST' \
  '{url}/api/v2/my/workflows/run/cloudblue-commerce-change-subscription?timeout=180' \
  -H 'accept: application/json' \
  -H 'authorization: {auth-token}' \
  -H 'Content-Type: application/json' \
  -d '{
 "subscriptionId": 123456,
 "poNumber": "9999",
 "changeType": "increase",
 "units" : 1
}'

Note: It can take more than 60 seconds for the order request, so make sure you increase default timeout.

Error responses

Timeout for CloudBlue

It seems that sometime CloudBlue times out...

{
  "output": "<html>\r\n<head><title>504 Gateway Time-out</title></head>\r\n<body>\r\n<center><h1>504 Gateway Time-out</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n",
  "status": {
    "statuskey": "complete"
  }
}

changeType incorrect

{
  "statusCode": 502,
  "message": "<changeType> no conditional flow taken",
  "error": {
    "message": "<changeType> no conditional flow taken"
  }
}

Subscription not found

{
  "statusCode": 404,
  "message": "Response code 404 (Not Found)",
  "error": {
    "message": "Response code 404 (Not Found)"
  }
}

If provisioning already in progress

{
  "output": {
    "correlationId": "a8n-54bc6dc3-f496-84c7-dfe9-f459db8564b3",
    "status": 500,
    "message": "Cannot Upgrade/Downgrade Resources for Subscription #123456: there is already an Upgrade/Downgrade Order #CH009999 in status Provisioning is in progress(LO). This order prohibits placing an order of the same order type (per subscription). Please either cancel conflicting order or wait until it is processed by the system.",
    "path": "/orders",
    "timeStamp": "2023-02-22T07:45:08.223+00:00"
  },
  "status": {
    "statuskey": "complete"
  }
}

Support

License

This project is licensed under the MIT License - see the LICENSE file for details.

blueprint-cloudblue-commerce-change-subscription's People

Contributors

rolu01 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.