Automation of billing

It will be very convenient if you can control "PayPal" as a billing system from the workflow system "Questetra".

For example, if you create a mechanism that automatically issues a "PayPal invoice according to delivery details" immediately after "product delivery flow" is completed, it is possible to prevent the occurrence of "billing mistake" or "billing omission". If the current situation is a billing operation that mails a "paper invoice", it is also possible to reduce all stamp fee, printing fee and office work labor costs to zero.

In the previous article, I introduced you mechanisms that automatically instructs PayPal "to generate invoices in PayPal" and "to send the invoice generated in PayPal further to customers".

Further automation

If you could automate
  • letting PayPal generate a "PayPal Invoice", and
  • letting PayPal send a "PayPal Invoice" via email,

I would like to further automate
  • confirming payment to PayPal. (Improve efficiency of debt collection business)

In this article, we will consider assembling the automatic Steps cleverly and making the "payment check flow" unmanned.

* Here, programming knowledge is required since we are going to use "Script Task" which is a type of automatic Step

[Entry reception system-PayPal billing-Payment confirmation]

PayPal as a Billing System

"PayPal Invoice" is very useful.

Just by logging-in to PayPal and entering "destination email address" and "details of sold item", anyone can easily send the invoice. It can be said that it is one of a few settlement methods that can flexibly deal with "a little consignment work" or "special discounts". It almost makes me think that procedures of shopping at EC site is rather more difficult. Moreover, there is no need to tell "credit card number" from the buyer to the seller.

However, if dozens of issuance must be, it will inevitably be troublesome. (Its "flexibility" serves harmful.)

If the billing contents were exactly the same, there was a function to process collectively, but if the contents are subtly different from each other, you have to set the billing information one by one. However, repetition of manual work falls into error, by all means.

Automate invoice creation and transmission

In the previous article (*), I introduced you "a mechanism to automatically generate a request that "Generate a PayPal invoice" and transmit it to the PayPal system.
* Episode 525: How to Send OAuth2 Request from Automatic Step

In this article, I would like to study further about "a mechanism to automatically send a request that "generate and send PayPal invoice to the buyer". (Programming knowledge is required)

[Entry reception system]

Japanese calendar text

There are many cases in Japan that use "Japanese calendar" instead of "Western (Gregorian) calendar".

This year is "2017" as well as "Heisei 29".

In other words, there are many cases where Date type data such as "2017-03-13" should be displayed as "March 13, Heisei 29" in prints and email texts. In the article (*) about one year ago, I introduced you the Japanese calendar conversion using the [Script Task], the automatic step. (Automatic conversion of Issue data flowing in the Cloud-based Workflow "Questetra BPM Suite")

Episode 467: Certificate Issue Date on Auto-generated PDF in Japanese Era Name (2016-01-25)

Script step and Service step

However, as of version 11.1 or later (2016-09-05) of the Cloud-based Workflow "Questetra BPM Suite", it is possible to add arbitrary [Service step] by "Service definition file" (add-on XML).

That is, if you use [Service step] which performs Japanese calendar conversion, you do not need to use [Script step] (which requires programming knowledge).

[Certificate Issuance-Japanese Calendar]

Automation with server side JavaScript

In the last article (*), I mentioned that "automatic Step of Questetra BPM Suite can implement (not only simple numerical calculation) OAuth2 communication".
* Episode 524: Automation of Work with Server-side JavaScript

Therefore, in this article, I would like to briefly summarize about "what kind of external service is specifically possible with OAuth2 communication" and "what kind of programming is required specifically". (In the viewpoint of requesting from the workflow system side.)

What is OAuth2 communication

OAuth is a "scheme for authorizing requests to servers".

Reference) What is "OAuth", the Cloud Technology which Everyone should Know?

Since OAuth2 first appeared in 2012, APIs of many "resource servers", such as Google Drive and Dropbox, are now compatible with "OAuth2 access". That is, the external system can throw various "Reference request" and "Update request" to "resource server". (RFC6749/6750)

In the cloud-based Workflow "Questetra BPM Suite", it is possible for an automatic Step placed in a business process definition to behave as an "external system" (OAuth2 client). In other words, you can set so that the following requests are automatically executed each time an Issue reaches the automatic Step (Script Task / Service Task).

  • Script Task: a Step in which a Business designer can set server-side JavaScript (Communication using HttpClientWrapper can also be implemented) M230
  • Service Task (Addon): Step which packaged Script Task. Only configure setting is allowed for Business designer. M415 M416
Reference)


How to get access token

"Access token" is required for such request communication.

"Access token" is "a proof that it is a request authorized by the owner of the resource", and the entity is a string of from about several tens to 200 characters. However, the access token acquisition method differs depending on "resource server".

As main method, there are
  • A. Let the owner click on "grant button" and then automatically obtain. (Authorization Code Grant)
  • B. Set secret credentials, then retrieve automatically (Client Credentials Grant)
  • C. Set the access token itself (e.g. when an Access Token without expiration date is possible)

However, it varies depending on the type or characteristic of data managed by "resource server".

Caution) Even with the OAuth 2 authorization method that the destination API can implement, there might be cases where automatic communication can not be set depending on implementation restrictions (Questetra side) regarding "HTTP header" and "Content - Type format".

[Invoice Submission]

Utilization of programming knowledge

"Script Step" is a kind of "automated Step" within a Business Process.

These are Steps for automatically executing "program processing", such as, for example;
  • with reference to "attendance time" and "leaving time" entered in the upstream process,
  • automatically calculates "working time" ({leaving time} - {attendance time}).
Conversely, if you incorporated such a Script Step into the Daily report flow, employees do not have to fill in "hours worked " each time.

What can be done?

Automatic processing performed on the Workflow platform is so-called "Server side processing".

In other words, when an Issue flowing through a Business Process reaches the "Script step", data are automatically referenced and updated. All processing is executed while human beings are not aware or concerned.

The program code to be set there will be a configuration like;
  • starting with "to reference business data",
  • via "various arithmetic processing",
  • end with "updating business data".

What kinds of "operations" are possible?

For example, in the case of "Questetra BPM Suite" which is a cloud based Workflow product, it is given the specification as "(*) capable of setting Server-side JavaScript (ECMA Script)". And the following operations are available.
  • Basic numerical data operation (four arithmetic operations, square root, exponent, round-off, random number...)
  • Basic character string data manipulation (join, split, reshape, extract, replace, search ...)
  • Basic date and time data operation (addition, subtraction, progress calculation, day of week judgement, Japanese calendar conversion ...)
  • Generation and analysis of JSON data
  • Generation and analysis of XML data
  • Sending HTTP request (data GET, data POST, OAuth2 communication, Basic authentication ...)
  • Send SMTP request (send email, attachment file generation, convert character code ...)
* You can also use Java methods that can be handled by the Rhino engine, and Questetra extension methods. [R2300]
※ The details are HERE and THERE.

[Hours-worked report-Hours and minutes]

Amelioration of Excessive Work Hours

In the Japanese government, "health damage due to overwork" has been actively discussed. The rise of this discussion is not an exaggeration to say that triggered by the "new employee suicide for overwork" (2015) in a major advertising agency. And it is expected that a new rule will be added such as "at most of 60 hours of monthly average overtime work under whatever employment contract", within the next one or two years.

In companies and government agencies where work hours are over 220 hours a month persistently, it may be necessary to take various actions, such as "drastic review of business processes" and "consideration of adopting of deemed hours worked system".

Reference) Labor Standards Act of Japan
  • Employers shall not have Workers work more than 40 hours per week, excluding rest periods.
  • Employers shall not have Workers work more than 8 hours per day for each day of the week, excluding rest periods.

Learning by implicit instruction is also included to hours worked

Certainly, it is true that there are people who think "want to work more for learning and experience" (staying in the office) with a pure heart.

Today, however, "learning necessary for work" is also defined as working hours. Given the fact that the case of trying to disguise the working hours as short as possible by letting workers to report as "self-development" or "private information gathering", this guidelines may be "unavoidable".


Common recognition within the team about working hours

Hours worked is defined as "time that a worker is objectively evaluated as being placed under command of the employer".

However, taking into consideration the situation as described above, it is very effective to once again discuss the common perception of each department of each company regarding "how to measure working hours concretely".

For example, not only "preparation of materials" at home but also "learning of technology trends" should be measured as working hours. However, on the other hand, if a server administrator who is required to confirm the latest security trends, included the time for "checking the Web for information" and "subscribing to the email newsletter", all the awaking time could be the hours worked.

[Hours-worked report]

Who is holding it?

Laser pointers, portable battery chargers, portable projectors...
Corporate credit card, airline mileage card, PC software license...

Equipments in a company would like to be actively "utilized". However, "management" on these items is very troublesome. It will become a mere facade sooner or later if it is by the management method, for example, "record in Excel or Spreadsheet".
  • Cumbersome to update.
  • Don't know who should update.
  • Don't know when it was updated last time.
  • First of all, don't know where the management file is.
  • Oh no, there are lots of management files...
Hopeless, if it is a premise of"Long-term lending". As a result, even the essential matters, such as who is holding it, or is he or she really holding cannot be managed.

Firstly "loose management"

The following Workflow definition is a mechanism to record lending and return of goods. It can be said to be a system that records "inventory" such as "offered" and "returned".

As you can see from the Workflow diagram, I haven't done anything complicated. It is only a mechanism that the user of goods entries about "goods wanting long-term lending", and the goods manager (teller) records about "contents lent out". In this example, it is unique that the lend period is managed in year, month (e.g. 2017-02) rather than the date (e.g. 2017-02-13). It seems like suggesting "application for short-term lending is unnecessary".

[Lending Management]