DataONEorg / bookkeeper

Bookkeeper keeps track of DataONE product subscriptions and quotas for researchers using the extended services.
Other
1 stars 2 forks source link

Quota 'name' not passed from order #68

Closed gothub closed 3 years ago

gothub commented 3 years ago

The quota name is not being relayed from an order 'name' field to the quota 'name' field when an order is payed. For example, create an order using this JSON document:

{
    "object": "order",
    "customer": 1,
    "status": "created",
    "amount": 1,
    "items": [{
        "object": "order_item",
        "name": "OPC Order # 1",
        "amount": 200000,
        "type": "sku",
        "parent": 2,
        "quantity": 1
        }],
  "name": "OPC Order # 1",
  "subject":"membership-090E3A1B-9E79-4CC5-964B-2598EEEBFC8C",
  "seriesId": "E3F7D9F1-D669-42BF-A399-76FF566A455A"
}

which will result in the following order entry:

 id | object | amount | amountreturned | charge |        created         | currency | customer |                     subject                     | email |                                                                            items                                                                             | metadata |     name      | status |              statustransitions               |        updated         |               seriesid               |       startdate        |        enddate
----+--------+--------+----------------+--------+------------------------+----------+----------+-------------------------------------------------+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------------+--------+----------------------------------------------+------------------------+--------------------------------------+------------------------+------------------------
  5 | order  | 200000 |              0 | {}     | 2020-10-12 18:34:40+00 |          |        1 | membership-090E3A1B-9E79-4CC5-964B-2598EEEBFC8C |       | [{"object":"order_item","amount":200000,"currency":"USD","description":"DataONE Membership Plan - Small Organization","parent":2,"quantity":1,"type":"sku"}] | {}       | OPC Order # 1 | paid   | {"created":1602527680,"trialing":1602527766} | 2020-10-12 18:36:06+00 | E3F7D9F1-D669-42BF-A399-76FF566A455A | 2020-10-12 18:36:06+00 | 2021-04-10 18:36:06+00
(1 row)

Next, pay the order and the following quota will be created:

 id | object | quotatype | softlimit | hardlimit | totalusage |  unit  | orderid |                     subject                     | name
----+--------+-----------+-----------+-----------+------------+--------+---------+-------------------------------------------------+------
  8 | quota  | portal    |         5 |         5 |            | portal |       5 | membership-090E3A1B-9E79-4CC5-964B-2598EEEBFC8C |
(

Notice that the 'name' field is not filled in. Is this an error in the request or in the processing?

csjx commented 3 years ago

Thanks @gothub Working on it now

csjx commented 3 years ago

This is fixed and tested locally. Closing for now, but reopen this if you see issues.