private void updateInvoiceExpirationTimeInTable()

in src/main/java/com/amazonaws/partners/saasfactory/metering/aggregation/StripeBillingPublish.java [291:323]


    private void updateInvoiceExpirationTimeInTable(TenantConfiguration tenantConfiguration, Instant invoiceClosingTime) {
        Map<String, AttributeValue> key = new HashMap<>();
        AttributeValue primaryKeyValue = AttributeValue.builder()
                .s(tenantConfiguration.getTenantID())
                .build();
        key.put(PRIMARY_KEY_NAME, primaryKeyValue);
        AttributeValue sortKeyValue = AttributeValue.builder()
                .s(CONFIG_SORT_KEY_VALUE)
                .build();
        key.put(SORT_KEY_NAME, sortKeyValue);

        Map <String, String> expressionAttributeNames = new HashMap<>();
        expressionAttributeNames.put(CLOSING_INVOICE_TIME_EXPRESSION_NAME, CLOSING_INVOICE_TIME_ATTRIBUTE_NAME);

        Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
        expressionAttributeValues.put(CLOSING_INVOICE_TIME_EXPRESSION_VALUE, AttributeValue.builder()
                .s(invoiceClosingTime.toString())
                .build());

        String updateExpression = String.format(
                "SET %s = %s",
                CLOSING_INVOICE_TIME_EXPRESSION_NAME,
                CLOSING_INVOICE_TIME_EXPRESSION_VALUE);

        UpdateItemRequest updateItemRequest = UpdateItemRequest.builder()
                .tableName(tableConfig.getTableName())
                .key(key)
                .expressionAttributeNames(expressionAttributeNames)
                .expressionAttributeValues(expressionAttributeValues)
                .updateExpression(updateExpression)
                .build();
        this.ddb.updateItem(updateItemRequest);
    }