github.com/Ingenico-ePayments/connect-sdk-go@v0.0.0-20240318153750-1f8cd329b9c9/merchant/refunds/FindParams.go (about)

     1  // This class was auto-generated from the API references found at
     2  // https://epayments-api.developer-ingenico.com/
     3  
     4  package refunds
     5  
     6  import (
     7  	"strconv"
     8  
     9  	"github.com/Ingenico-ePayments/connect-sdk-go/communicator"
    10  )
    11  
    12  // FindParams represents query parameters for Find refunds
    13  // Documentation can be found at https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/go/refunds/find.html
    14  type FindParams struct {
    15  	HostedCheckoutID  *string
    16  	MerchantReference *string
    17  	MerchantOrderID   *int64
    18  	Offset            *int32
    19  	Limit             *int32
    20  }
    21  
    22  // ToRequestParameters converts the query to communicator.RequestParams
    23  func (params *FindParams) ToRequestParameters() communicator.RequestParams {
    24  	reqParams := communicator.RequestParams{}
    25  
    26  	if params.HostedCheckoutID != nil {
    27  		param, _ := communicator.NewRequestParam("hostedCheckoutId", *params.HostedCheckoutID)
    28  		reqParams = append(reqParams, *param)
    29  	}
    30  	if params.MerchantReference != nil {
    31  		param, _ := communicator.NewRequestParam("merchantReference", *params.MerchantReference)
    32  		reqParams = append(reqParams, *param)
    33  	}
    34  	if params.MerchantOrderID != nil {
    35  		param, _ := communicator.NewRequestParam("merchantOrderId", strconv.FormatInt(*params.MerchantOrderID, 10))
    36  		reqParams = append(reqParams, *param)
    37  	}
    38  	if params.Offset != nil {
    39  		param, _ := communicator.NewRequestParam("offset", strconv.FormatInt(int64(*params.Offset), 10))
    40  		reqParams = append(reqParams, *param)
    41  	}
    42  	if params.Limit != nil {
    43  		param, _ := communicator.NewRequestParam("limit", strconv.FormatInt(int64(*params.Limit), 10))
    44  		reqParams = append(reqParams, *param)
    45  	}
    46  
    47  	return reqParams
    48  }
    49  
    50  // NewFindParams constructs an instance of FindParams
    51  func NewFindParams() *FindParams {
    52  	return &FindParams{}
    53  }