/*
Adyen Payout API

API version: 68
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package payout

import (
	"context"
	"net/http"
	"net/url"

	"github.com/adyen/adyen-go-api-library/v21/src/common"
)

// ReviewingApi service
type ReviewingApi common.Service

// All parameters accepted by ReviewingApi.ConfirmThirdParty
type ReviewingApiConfirmThirdPartyInput struct {
	modifyRequest *ModifyRequest
}

func (r ReviewingApiConfirmThirdPartyInput) ModifyRequest(modifyRequest ModifyRequest) ReviewingApiConfirmThirdPartyInput {
	r.modifyRequest = &modifyRequest
	return r
}

/*
Prepare a request for ConfirmThirdParty

@return ReviewingApiConfirmThirdPartyInput
*/
func (a *ReviewingApi) ConfirmThirdPartyInput() ReviewingApiConfirmThirdPartyInput {
	return ReviewingApiConfirmThirdPartyInput{}
}

/*
ConfirmThirdParty Confirm a payout

> This endpoint is **deprecated** and no longer supports new integrations. Do one of the following:
>- If you are building a new integration, use the [Transfers API](https://docs.adyen.com/api-explorer/transfers/latest/overview) instead.
> - If you are already using the Payout API, reach out to your Adyen contact to learn how to migrate to the Transfers API.
>
> With the Transfers API, you can:
> - Handle multiple payout use cases with a single API.
> - Use new payout functionalities, such as instant payouts to bank accounts.
> - Receive webhooks with more details and defined transfer states.
>
> For more information about the payout features of the Transfers API, see our [Payouts](https://docs.adyen.com/payouts/payout-service) documentation.

Confirms a previously submitted payout.

To cancel a payout, use the `/declineThirdParty` endpoint.

@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param r ReviewingApiConfirmThirdPartyInput - Request parameters, see ConfirmThirdPartyInput
@return ModifyResponse, *http.Response, error
*/
func (a *ReviewingApi) ConfirmThirdParty(ctx context.Context, r ReviewingApiConfirmThirdPartyInput) (ModifyResponse, *http.Response, error) {
	res := &ModifyResponse{}
	path := "/confirmThirdParty"
	queryParams := url.Values{}
	headerParams := make(map[string]string)
	httpRes, err := common.SendAPIRequest(
		ctx,
		a.Client,
		r.modifyRequest,
		res,
		http.MethodPost,
		a.BasePath()+path,
		queryParams,
		headerParams,
	)

	return *res, httpRes, err
}

// All parameters accepted by ReviewingApi.DeclineThirdParty
type ReviewingApiDeclineThirdPartyInput struct {
	modifyRequest *ModifyRequest
}

func (r ReviewingApiDeclineThirdPartyInput) ModifyRequest(modifyRequest ModifyRequest) ReviewingApiDeclineThirdPartyInput {
	r.modifyRequest = &modifyRequest
	return r
}

/*
Prepare a request for DeclineThirdParty

@return ReviewingApiDeclineThirdPartyInput
*/
func (a *ReviewingApi) DeclineThirdPartyInput() ReviewingApiDeclineThirdPartyInput {
	return ReviewingApiDeclineThirdPartyInput{}
}

/*
DeclineThirdParty Cancel a payout

> This endpoint is **deprecated** and no longer supports new integrations. Do one of the following:
>- If you are building a new integration, use the [Transfers API](https://docs.adyen.com/api-explorer/transfers/latest/overview) instead.
> - If you are already using the Payout API, reach out to your Adyen contact to learn how to migrate to the Transfers API.
>
> With the Transfers API, you can:
> - Handle multiple payout use cases with a single API.
> - Use new payout functionalities, such as instant payouts to bank accounts.
> - Receive webhooks with more details and defined transfer states.
>
> For more information about the payout features of the Transfers API, see our [Payouts](https://docs.adyen.com/payouts/payout-service) documentation.

Cancels a previously submitted payout.

To confirm and send a payout, use the `/confirmThirdParty` endpoint.

@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param r ReviewingApiDeclineThirdPartyInput - Request parameters, see DeclineThirdPartyInput
@return ModifyResponse, *http.Response, error
*/
func (a *ReviewingApi) DeclineThirdParty(ctx context.Context, r ReviewingApiDeclineThirdPartyInput) (ModifyResponse, *http.Response, error) {
	res := &ModifyResponse{}
	path := "/declineThirdParty"
	queryParams := url.Values{}
	headerParams := make(map[string]string)
	httpRes, err := common.SendAPIRequest(
		ctx,
		a.Client,
		r.modifyRequest,
		res,
		http.MethodPost,
		a.BasePath()+path,
		queryParams,
		headerParams,
	)

	return *res, httpRes, err
}
