From b5de66dd63ae278e2f8b5c0bf1c3f79b49d5f3ee Mon Sep 17 00:00:00 2001 From: michaelpa Date: Mon, 6 Nov 2023 13:27:34 +0100 Subject: [PATCH 1/3] Delete downloadDisputeDefenseDocument --- src/disputes/api_general.go | 47 ----- ...model_download_defense_document_request.go | 172 ---------------- ...odel_download_defense_document_response.go | 189 ------------------ 3 files changed, 408 deletions(-) delete mode 100644 src/disputes/model_download_defense_document_request.go delete mode 100644 src/disputes/model_download_defense_document_response.go diff --git a/src/disputes/api_general.go b/src/disputes/api_general.go index b92caa90c..c687e30ff 100644 --- a/src/disputes/api_general.go +++ b/src/disputes/api_general.go @@ -160,53 +160,6 @@ func (a *GeneralApi) DeleteDisputeDefenseDocument(ctx context.Context, r General return *res, httpRes, err } -// All parameters accepted by GeneralApi.DownloadDisputeDefenseDocument -type GeneralApiDownloadDisputeDefenseDocumentInput struct { - downloadDefenseDocumentRequest *DownloadDefenseDocumentRequest -} - -func (r GeneralApiDownloadDisputeDefenseDocumentInput) DownloadDefenseDocumentRequest(downloadDefenseDocumentRequest DownloadDefenseDocumentRequest) GeneralApiDownloadDisputeDefenseDocumentInput { - r.downloadDefenseDocumentRequest = &downloadDefenseDocumentRequest - return r -} - -/* -Prepare a request for DownloadDisputeDefenseDocument - -@return GeneralApiDownloadDisputeDefenseDocumentInput -*/ -func (a *GeneralApi) DownloadDisputeDefenseDocumentInput() GeneralApiDownloadDisputeDefenseDocumentInput { - return GeneralApiDownloadDisputeDefenseDocumentInput{} -} - -/* -DownloadDisputeDefenseDocument Download a defense document - -Downloads a specific dispute defense document that was supplied earlier. - -@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). -@param r GeneralApiDownloadDisputeDefenseDocumentInput - Request parameters, see DownloadDisputeDefenseDocumentInput -@return DownloadDefenseDocumentResponse, *http.Response, error -*/ -func (a *GeneralApi) DownloadDisputeDefenseDocument(ctx context.Context, r GeneralApiDownloadDisputeDefenseDocumentInput) (DownloadDefenseDocumentResponse, *http.Response, error) { - res := &DownloadDefenseDocumentResponse{} - path := "/downloadDisputeDefenseDocument" - queryParams := url.Values{} - headerParams := make(map[string]string) - httpRes, err := common.SendAPIRequest( - ctx, - a.Client, - r.downloadDefenseDocumentRequest, - res, - http.MethodPost, - a.BasePath()+path, - queryParams, - headerParams, - ) - - return *res, httpRes, err -} - // All parameters accepted by GeneralApi.RetrieveApplicableDefenseReasons type GeneralApiRetrieveApplicableDefenseReasonsInput struct { defenseReasonsRequest *DefenseReasonsRequest diff --git a/src/disputes/model_download_defense_document_request.go b/src/disputes/model_download_defense_document_request.go deleted file mode 100644 index 49f11add7..000000000 --- a/src/disputes/model_download_defense_document_request.go +++ /dev/null @@ -1,172 +0,0 @@ -/* -Disputes API - -API version: 30 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package disputes - -import ( - "encoding/json" - - "github.com/adyen/adyen-go-api-library/v8/src/common" -) - -// checks if the DownloadDefenseDocumentRequest type satisfies the MappedNullable interface at compile time -var _ common.MappedNullable = &DownloadDefenseDocumentRequest{} - -// DownloadDefenseDocumentRequest struct for DownloadDefenseDocumentRequest -type DownloadDefenseDocumentRequest struct { - // The document type code of the defense document. - DefenseDocumentType string `json:"defenseDocumentType"` - // The PSP reference assigned to the dispute. - DisputePspReference string `json:"disputePspReference"` - // The merchant account identifier, for which you want to process the dispute transaction. - MerchantAccountCode string `json:"merchantAccountCode"` -} - -// NewDownloadDefenseDocumentRequest instantiates a new DownloadDefenseDocumentRequest object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewDownloadDefenseDocumentRequest(defenseDocumentType string, disputePspReference string, merchantAccountCode string) *DownloadDefenseDocumentRequest { - this := DownloadDefenseDocumentRequest{} - this.DefenseDocumentType = defenseDocumentType - this.DisputePspReference = disputePspReference - this.MerchantAccountCode = merchantAccountCode - return &this -} - -// NewDownloadDefenseDocumentRequestWithDefaults instantiates a new DownloadDefenseDocumentRequest object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewDownloadDefenseDocumentRequestWithDefaults() *DownloadDefenseDocumentRequest { - this := DownloadDefenseDocumentRequest{} - return &this -} - -// GetDefenseDocumentType returns the DefenseDocumentType field value -func (o *DownloadDefenseDocumentRequest) GetDefenseDocumentType() string { - if o == nil { - var ret string - return ret - } - - return o.DefenseDocumentType -} - -// GetDefenseDocumentTypeOk returns a tuple with the DefenseDocumentType field value -// and a boolean to check if the value has been set. -func (o *DownloadDefenseDocumentRequest) GetDefenseDocumentTypeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.DefenseDocumentType, true -} - -// SetDefenseDocumentType sets field value -func (o *DownloadDefenseDocumentRequest) SetDefenseDocumentType(v string) { - o.DefenseDocumentType = v -} - -// GetDisputePspReference returns the DisputePspReference field value -func (o *DownloadDefenseDocumentRequest) GetDisputePspReference() string { - if o == nil { - var ret string - return ret - } - - return o.DisputePspReference -} - -// GetDisputePspReferenceOk returns a tuple with the DisputePspReference field value -// and a boolean to check if the value has been set. -func (o *DownloadDefenseDocumentRequest) GetDisputePspReferenceOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.DisputePspReference, true -} - -// SetDisputePspReference sets field value -func (o *DownloadDefenseDocumentRequest) SetDisputePspReference(v string) { - o.DisputePspReference = v -} - -// GetMerchantAccountCode returns the MerchantAccountCode field value -func (o *DownloadDefenseDocumentRequest) GetMerchantAccountCode() string { - if o == nil { - var ret string - return ret - } - - return o.MerchantAccountCode -} - -// GetMerchantAccountCodeOk returns a tuple with the MerchantAccountCode field value -// and a boolean to check if the value has been set. -func (o *DownloadDefenseDocumentRequest) GetMerchantAccountCodeOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.MerchantAccountCode, true -} - -// SetMerchantAccountCode sets field value -func (o *DownloadDefenseDocumentRequest) SetMerchantAccountCode(v string) { - o.MerchantAccountCode = v -} - -func (o DownloadDefenseDocumentRequest) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o DownloadDefenseDocumentRequest) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["defenseDocumentType"] = o.DefenseDocumentType - toSerialize["disputePspReference"] = o.DisputePspReference - toSerialize["merchantAccountCode"] = o.MerchantAccountCode - return toSerialize, nil -} - -type NullableDownloadDefenseDocumentRequest struct { - value *DownloadDefenseDocumentRequest - isSet bool -} - -func (v NullableDownloadDefenseDocumentRequest) Get() *DownloadDefenseDocumentRequest { - return v.value -} - -func (v *NullableDownloadDefenseDocumentRequest) Set(val *DownloadDefenseDocumentRequest) { - v.value = val - v.isSet = true -} - -func (v NullableDownloadDefenseDocumentRequest) IsSet() bool { - return v.isSet -} - -func (v *NullableDownloadDefenseDocumentRequest) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableDownloadDefenseDocumentRequest(val *DownloadDefenseDocumentRequest) *NullableDownloadDefenseDocumentRequest { - return &NullableDownloadDefenseDocumentRequest{value: val, isSet: true} -} - -func (v NullableDownloadDefenseDocumentRequest) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableDownloadDefenseDocumentRequest) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/src/disputes/model_download_defense_document_response.go b/src/disputes/model_download_defense_document_response.go deleted file mode 100644 index 8079b6021..000000000 --- a/src/disputes/model_download_defense_document_response.go +++ /dev/null @@ -1,189 +0,0 @@ -/* -Disputes API - -API version: 30 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package disputes - -import ( - "encoding/json" - - "github.com/adyen/adyen-go-api-library/v8/src/common" -) - -// checks if the DownloadDefenseDocumentResponse type satisfies the MappedNullable interface at compile time -var _ common.MappedNullable = &DownloadDefenseDocumentResponse{} - -// DownloadDefenseDocumentResponse struct for DownloadDefenseDocumentResponse -type DownloadDefenseDocumentResponse struct { - // The content of the defense document in Base64 binary format. Must be encoded in the format that is specified in the `contentType` field. - Content *string `json:"content,omitempty"` - // The content type of the dispute defense document. Possible values: * **image/jpg** * **image/jpeg** * **image/tiff** * **application/pdf** - ContentType *string `json:"contentType,omitempty"` - DisputeServiceResult DisputeServiceResult `json:"disputeServiceResult"` -} - -// NewDownloadDefenseDocumentResponse instantiates a new DownloadDefenseDocumentResponse object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewDownloadDefenseDocumentResponse(disputeServiceResult DisputeServiceResult) *DownloadDefenseDocumentResponse { - this := DownloadDefenseDocumentResponse{} - this.DisputeServiceResult = disputeServiceResult - return &this -} - -// NewDownloadDefenseDocumentResponseWithDefaults instantiates a new DownloadDefenseDocumentResponse object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewDownloadDefenseDocumentResponseWithDefaults() *DownloadDefenseDocumentResponse { - this := DownloadDefenseDocumentResponse{} - return &this -} - -// GetContent returns the Content field value if set, zero value otherwise. -func (o *DownloadDefenseDocumentResponse) GetContent() string { - if o == nil || common.IsNil(o.Content) { - var ret string - return ret - } - return *o.Content -} - -// GetContentOk returns a tuple with the Content field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DownloadDefenseDocumentResponse) GetContentOk() (*string, bool) { - if o == nil || common.IsNil(o.Content) { - return nil, false - } - return o.Content, true -} - -// HasContent returns a boolean if a field has been set. -func (o *DownloadDefenseDocumentResponse) HasContent() bool { - if o != nil && !common.IsNil(o.Content) { - return true - } - - return false -} - -// SetContent gets a reference to the given string and assigns it to the Content field. -func (o *DownloadDefenseDocumentResponse) SetContent(v string) { - o.Content = &v -} - -// GetContentType returns the ContentType field value if set, zero value otherwise. -func (o *DownloadDefenseDocumentResponse) GetContentType() string { - if o == nil || common.IsNil(o.ContentType) { - var ret string - return ret - } - return *o.ContentType -} - -// GetContentTypeOk returns a tuple with the ContentType field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *DownloadDefenseDocumentResponse) GetContentTypeOk() (*string, bool) { - if o == nil || common.IsNil(o.ContentType) { - return nil, false - } - return o.ContentType, true -} - -// HasContentType returns a boolean if a field has been set. -func (o *DownloadDefenseDocumentResponse) HasContentType() bool { - if o != nil && !common.IsNil(o.ContentType) { - return true - } - - return false -} - -// SetContentType gets a reference to the given string and assigns it to the ContentType field. -func (o *DownloadDefenseDocumentResponse) SetContentType(v string) { - o.ContentType = &v -} - -// GetDisputeServiceResult returns the DisputeServiceResult field value -func (o *DownloadDefenseDocumentResponse) GetDisputeServiceResult() DisputeServiceResult { - if o == nil { - var ret DisputeServiceResult - return ret - } - - return o.DisputeServiceResult -} - -// GetDisputeServiceResultOk returns a tuple with the DisputeServiceResult field value -// and a boolean to check if the value has been set. -func (o *DownloadDefenseDocumentResponse) GetDisputeServiceResultOk() (*DisputeServiceResult, bool) { - if o == nil { - return nil, false - } - return &o.DisputeServiceResult, true -} - -// SetDisputeServiceResult sets field value -func (o *DownloadDefenseDocumentResponse) SetDisputeServiceResult(v DisputeServiceResult) { - o.DisputeServiceResult = v -} - -func (o DownloadDefenseDocumentResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o DownloadDefenseDocumentResponse) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !common.IsNil(o.Content) { - toSerialize["content"] = o.Content - } - if !common.IsNil(o.ContentType) { - toSerialize["contentType"] = o.ContentType - } - toSerialize["disputeServiceResult"] = o.DisputeServiceResult - return toSerialize, nil -} - -type NullableDownloadDefenseDocumentResponse struct { - value *DownloadDefenseDocumentResponse - isSet bool -} - -func (v NullableDownloadDefenseDocumentResponse) Get() *DownloadDefenseDocumentResponse { - return v.value -} - -func (v *NullableDownloadDefenseDocumentResponse) Set(val *DownloadDefenseDocumentResponse) { - v.value = val - v.isSet = true -} - -func (v NullableDownloadDefenseDocumentResponse) IsSet() bool { - return v.isSet -} - -func (v *NullableDownloadDefenseDocumentResponse) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableDownloadDefenseDocumentResponse(val *DownloadDefenseDocumentResponse) *NullableDownloadDefenseDocumentResponse { - return &NullableDownloadDefenseDocumentResponse{value: val, isSet: true} -} - -func (v NullableDownloadDefenseDocumentResponse) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableDownloadDefenseDocumentResponse) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} From f7e2407691f25ff1ed3075c9ae42f81adbc7f5c7 Mon Sep 17 00:00:00 2001 From: michaelpa Date: Mon, 6 Nov 2023 13:31:11 +0100 Subject: [PATCH 2/3] Update disputes_test.go --- tests/disputes_test.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/disputes_test.go b/tests/disputes_test.go index bec385bbd..3262bbf9d 100644 --- a/tests/disputes_test.go +++ b/tests/disputes_test.go @@ -136,16 +136,4 @@ func Test_Disputes(t *testing.T) { assert.NotNil(t, res) assert.Equal(t, "Dispute not found.", res.DisputeServiceResult.GetErrorMessage()) }) - - t.Run("Download dispute defense document", func(t *testing.T) { - req := service.DownloadDisputeDefenseDocumentInput().DownloadDefenseDocumentRequest(disputes.DownloadDefenseDocumentRequest{ - DefenseDocumentType: "DefenseMaterial", - DisputePspReference: pspReference, - MerchantAccountCode: merchantAccount, - }) - _, httpRes, err := service.DownloadDisputeDefenseDocument(context.Background(), req) - - require.NotNil(t, err) - assert.Equal(t, 403, httpRes.StatusCode) - }) } From 6353c89458693cda6e3253eaff8810dfa836b4e6 Mon Sep 17 00:00:00 2001 From: michaelpa Date: Mon, 6 Nov 2023 13:46:46 +0100 Subject: [PATCH 3/3] Update disputes_test.go --- tests/disputes_test.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/disputes_test.go b/tests/disputes_test.go index 3262bbf9d..7abae8147 100644 --- a/tests/disputes_test.go +++ b/tests/disputes_test.go @@ -49,14 +49,6 @@ func Test_Disputes(t *testing.T) { io.WriteString(w, `{"disputeServiceResult":{"errorMessage":"Dispute not found.","success":false}}`) }) - // Error case - mux.HandleFunc("/downloadDisputeDefenseDocument", func(w http.ResponseWriter, r *http.Request) { - require.Equal(t, "POST", r.Method) - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(http.StatusForbidden) - io.WriteString(w, `{"status":403,"errorCode":"010","message":"Not allowed","errorType":"security"}`) - }) - mockServer := httptest.NewServer(mux) defer mockServer.Close()