github.com/stripe/stripe-go/v76@v76.25.0/taxdeductedatsource.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  import "encoding/json"
    10  
    11  type TaxDeductedAtSource struct {
    12  	// Unique identifier for the object.
    13  	ID string `json:"id"`
    14  	// String representing the object's type. Objects of the same type share the same value.
    15  	Object string `json:"object"`
    16  	// The end of the invoicing period. This TDS applies to Stripe fees collected during this invoicing period.
    17  	PeriodEnd int64 `json:"period_end"`
    18  	// The start of the invoicing period. This TDS applies to Stripe fees collected during this invoicing period.
    19  	PeriodStart int64 `json:"period_start"`
    20  	// The TAN that was supplied to Stripe when TDS was assessed
    21  	TaxDeductionAccountNumber string `json:"tax_deduction_account_number"`
    22  }
    23  
    24  // UnmarshalJSON handles deserialization of a TaxDeductedAtSource.
    25  // This custom unmarshaling is needed because the resulting
    26  // property may be an id or the full struct if it was expanded.
    27  func (t *TaxDeductedAtSource) UnmarshalJSON(data []byte) error {
    28  	if id, ok := ParseID(data); ok {
    29  		t.ID = id
    30  		return nil
    31  	}
    32  
    33  	type taxDeductedAtSource TaxDeductedAtSource
    34  	var v taxDeductedAtSource
    35  	if err := json.Unmarshal(data, &v); err != nil {
    36  		return err
    37  	}
    38  
    39  	*t = TaxDeductedAtSource(v)
    40  	return nil
    41  }