• 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

/bitcointransaction.go
1
package stripe
2

3
import "encoding/json"
4

5
// BitcoinTransactionListParams is the set of parameters that can be used when listing BitcoinTransactions.
6
type BitcoinTransactionListParams struct {
7
        ListParams `form:"*"`
8
        Customer   *string `form:"customer"`
9
        Receiver   *string `form:"-"` // Sent in with the URL
10
}
11

12
// BitcoinTransactionList is a list object for BitcoinTransactions.
13
// It is a child object of BitcoinRecievers
14
// For more details see https://stripe.com/docs/api/#retrieve_bitcoin_receiver
15
type BitcoinTransactionList struct {
16
        ListMeta
17
        Data []*BitcoinTransaction `json:"data"`
18
}
19

20
// BitcoinTransaction is the resource representing a Stripe bitcoin transaction.
21
// For more details see https://stripe.com/docs/api/#bitcoin_receivers
22
type BitcoinTransaction struct {
23
        Amount        int64    `json:"amount"`
24
        BitcoinAmount int64    `json:"bitcoin_amount"`
25
        Created       int64    `json:"created"`
26
        Currency      Currency `json:"currency"`
27
        Customer      string   `json:"customer"`
28
        ID            string   `json:"id"`
29
        Receiver      string   `json:"receiver"`
30
}
31

32
// UnmarshalJSON handles deserialization of a BitcoinTransaction.
33
// This custom unmarshaling is needed because the resulting
34
// property may be an id or the full struct if it was expanded.
35
func (bt *BitcoinTransaction) UnmarshalJSON(data []byte) error {
10✔
36
        if id, ok := ParseID(data); ok {
15✔
37
                bt.ID = id
5✔
38
                return nil
5✔
39
        }
5✔
40

41
        type bitcoinTransaction BitcoinTransaction
5✔
42
        var v bitcoinTransaction
5✔
43
        if err := json.Unmarshal(data, &v); err != nil {
5✔
44
                return err
×
45
        }
×
46

47
        *bt = BitcoinTransaction(v)
5✔
48
        return nil
5✔
49
}
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