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

stripe / stripe-go / 2793

pending completion
2793

Pull #578

travis-ci

web-flow
Convert the rest of expansion functions to safer style
Pull Request #578: Improve expansion parsing by not discarding unmarshal errors

373 of 373 new or added lines in 32 files covered. (100.0%)

2693 of 3179 relevant lines covered (84.71%)

180.81 hits per line

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

83.33
/review.go
1
package stripe
2

3
import "encoding/json"
4

5
// ReviewReasonType describes the reason why the review is open or closed.
6
type ReviewReasonType string
7

8
const (
9
        ReviewReasonApproved        ReviewReasonType = "approved"
10
        ReviewReasonDisputed        ReviewReasonType = "disputed"
11
        ReviewReasonManual          ReviewReasonType = "manual"
12
        ReviewReasonRefunded        ReviewReasonType = "refunded"
13
        ReviewReasonRefundedAsFraud ReviewReasonType = "refunded_as_fraud"
14
        ReviewReasonRule            ReviewReasonType = "rule"
15
)
16

17
type Review struct {
18
        Charge   *Charge          `json:"charge"`
19
        Created  int64            `json:"created"`
20
        ID       string           `json:"id"`
21
        Livemode bool             `json:"livemode"`
22
        Open     bool             `json:"open"`
23
        Reason   ReviewReasonType `json:"reason"`
24
}
25

26
func (r *Review) UnmarshalJSON(data []byte) error {
10✔
27
        if id, ok := ParseID(data); ok {
15✔
28
                r.ID = id
5✔
29
                return nil
5✔
30
        }
5✔
31

32
        type review Review
5✔
33
        var v review
5✔
34
        if err := json.Unmarshal(data, &v); err != nil {
5✔
35
                return err
×
36
        }
×
37

38
        *r = Review(v)
5✔
39
        return nil
5✔
40
}
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