• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

softlayer / softlayer-go / 13824212013

13 Mar 2025 12:26AM UTC coverage: 95.953% (-2.2%) from 98.143%
13824212013

Pull #201

github

web-flow
Merge 0268bb9e4 into 80a745b76
Pull Request #201: Bump golang.org/x/net from 0.23.0 to 0.36.0

36825 of 38378 relevant lines covered (95.95%)

7.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/helpers/order/order.go
1
/**
2
 * Copyright 2016 IBM Corp.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *    http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package order
18

19
import (
20
        "github.com/softlayer/softlayer-go/datatypes"
21
        "github.com/softlayer/softlayer-go/services"
22
        "github.com/softlayer/softlayer-go/session"
23
        "github.com/softlayer/softlayer-go/sl"
24
)
25

26
// CheckBillingOrderStatus returns true if the status of the billing order for
27
// the provided product order receipt is in the list of provided statuses.
28
// Returns false otherwise, along with the billing order item used to check the statuses,
29
// and any error encountered.
30
func CheckBillingOrderStatus(sess *session.Session, receipt *datatypes.Container_Product_Order_Receipt, statuses []string) (bool, *datatypes.Billing_Order_Item, error) {
×
31
        service := services.GetBillingOrderItemService(sess)
×
32

×
33
        item, err := service.
×
34
                Id(*receipt.PlacedOrder.Items[0].Id).
×
35
                Mask("mask[id,billingItem[id,provisionTransaction[id,transactionStatus[name]]]]").
×
36
                GetObject()
×
37

×
38
        if err != nil {
×
39
                return false, nil, err
×
40
        }
×
41

42
        currentStatus, ok := sl.GrabOk(item, "BillingItem.ProvisionTransaction.TransactionStatus.Name")
×
43

×
44
        if ok {
×
45
                for _, status := range statuses {
×
46
                        if currentStatus == status {
×
47
                                return true, &item, nil
×
48
                        }
×
49
                }
50
        }
51

52
        return false, &item, nil
×
53
}
54

55
// CheckBillingOrderComplete returns true if the status of the billing order for
56
// the provided product order receipt is "COMPLETE". Returns false otherwise,
57
// along with the billing order item used to check the statuses, and any error encountered.
58
func CheckBillingOrderComplete(sess *session.Session, receipt *datatypes.Container_Product_Order_Receipt) (bool, *datatypes.Billing_Order_Item, error) {
×
59
        return CheckBillingOrderStatus(sess, receipt, []string{"COMPLETE"})
×
60
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc