question

slicedev avatar image
slicedev asked digilax605 answered

Is OrderV31Connector.createLineItemsFrom() method usable for custom applications?

Hello everyone,

I'm getting the "java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.clover.common2.clover.Clover.getUserOrderTypes()' on a null object reference" exception on an attempt to use the connector.createLineItemsFrom() method.

My steps are next:

  1. Register an Activity to be aware of the clover.intent.action.MODIFY_ORDER intent.
  2. In the Register app create order with two or more items and tap Pay.
  3. On the Register's Payment activity tap the custom button to start the Activity.
  4. The Activity contains Split Order button that runs code like next:
  5. override suspend fun splitOrder(
        orderId: OrderId, // just a wrapper around the Order.id string
        lineItems: List<LineItem>,
    ): Order {
        val connector = connector.first() // provides OrderConnector instance
        return withContext(Dispatchers.IO) {
            try {
                val order = connector.createOrder(Order())
                val items = connector.createLineItemsFrom(orderId.value, order.id, lineItems.map { it.id })
                connector.getOrder(order.id)
            } catch (e: Exception) {
                throw e
            }
        }
    }

it fails on the connector.createLineItemsFrom() line, I tried to use the deprecated copyLineItems with exactly same result.

I'm trying to work around this issue with implementing a Split Order functionality through Inventory but it is hard to manage and update two orders.

I found similar topic here but unfortunately w/o a clear response https://community.clover.com/questions/30998/orderconnector-createlineitemsfrom-has-stopped-wor.html

This one could be similar as well https://community.clover.com/questions/23506/split-customer-amount-issue-with-adding-discount-u.html

Any help would be appreciated.

Thanks



OrdersClover Android SDK
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

slicedev avatar image slicedev commented ·

Here is a related logcat: SPLIT_ORDER_logcat.txt

0 Likes 0 ·

1 Answer

·
digilax605 avatar image
digilax605 answered

Enjoy a family-friendly game of uno online with simplified rules and a kid-friendly interface.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community