diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 2f20549c..4fae3e42 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -15,7 +15,7 @@ docs/refund/CreateRefund403Response.md docs/refund/CreateRefund404Response.md docs/refund/CreateRefund409Response.md docs/refund/CreateRefund503Response.md -docs/refund/CreateRefundDefaultResponse.md +docs/refund/GetAllRefundsDefaultResponse.md docs/refund/Refund.md docs/refund/RefundList.md go.mod @@ -27,7 +27,7 @@ refund/model_create_refund_403_response.go refund/model_create_refund_404_response.go refund/model_create_refund_409_response.go refund/model_create_refund_503_response.go -refund/model_create_refund_default_response.go +refund/model_get_all_refunds_default_response.go refund/model_refund.go refund/model_refund_list.go refund/nullable.go diff --git a/README.md b/README.md index d6fb8ce4..e58baa36 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ The official Xendit Go SDK provides a simple and convenient way to call Xendit's REST API in applications written in Go. -* Package version: 3.3.0 +* Package version: 3.4.0 # Getting Started @@ -42,14 +42,14 @@ xnd := xendit.NewClient("API-KEY") Find detailed API information and examples for each of our product's by clicking the links below, -* [Balance](docs/BalanceApi.md) -* [Customer](docs/CustomerApi.md) * [Invoice](docs/InvoiceApi.md) -* [PaymentMethod](docs/PaymentMethodApi.md) * [PaymentRequest](docs/PaymentRequestApi.md) -* [Payout](docs/PayoutApi.md) +* [PaymentMethod](docs/PaymentMethodApi.md) * [Refund](docs/RefundApi.md) +* [Balance](docs/BalanceApi.md) * [Transaction](docs/TransactionApi.md) +* [Customer](docs/CustomerApi.md) +* [Payout](docs/PayoutApi.md) All URIs are relative to *https://api.xendit.co*. For more information about our API, please refer to *https://developers.xendit.co/*. diff --git a/balance_and_transaction/api_transaction.go b/balance_and_transaction/api_transaction.go index 638915cb..09796136 100644 --- a/balance_and_transaction/api_transaction.go +++ b/balance_and_transaction/api_transaction.go @@ -17,20 +17,6 @@ import ( type TransactionApi interface { - /* - GetAllTransactions Get a list of transactions - - Get a list of all transactions based on filter and search parameters. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiGetAllTransactionsRequest - */ - GetAllTransactions(ctx context.Context) ApiGetAllTransactionsRequest - - // GetAllTransactionsExecute executes the request - // @return TransactionsResponse - GetAllTransactionsExecute(r ApiGetAllTransactionsRequest) (*TransactionsResponse, *http.Response, *common.XenditSdkError) - /* GetTransactionByID Get a transaction based on its id @@ -45,6 +31,20 @@ type TransactionApi interface { // GetTransactionByIDExecute executes the request // @return TransactionResponse GetTransactionByIDExecute(r ApiGetTransactionByIDRequest) (*TransactionResponse, *http.Response, *common.XenditSdkError) + + /* + GetAllTransactions Get a list of transactions + + Get a list of all transactions based on filter and search parameters. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetAllTransactionsRequest + */ + GetAllTransactions(ctx context.Context) ApiGetAllTransactionsRequest + + // GetAllTransactionsExecute executes the request + // @return TransactionsResponse + GetAllTransactionsExecute(r ApiGetAllTransactionsRequest) (*TransactionsResponse, *http.Response, *common.XenditSdkError) } // TransactionApiService TransactionApi service @@ -60,6 +60,104 @@ func NewTransactionApi (client common.IClient) TransactionApi { } +type ApiGetTransactionByIDRequest struct { + ctx context.Context + ApiService TransactionApi + id string + forUserId *string +} + +// The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information +func (r ApiGetTransactionByIDRequest) ForUserId(forUserId string) ApiGetTransactionByIDRequest { + r.forUserId = &forUserId + return r +} + +func (r ApiGetTransactionByIDRequest) Execute() (*TransactionResponse, *http.Response, *common.XenditSdkError) { + return r.ApiService.GetTransactionByIDExecute(r) +} + +/* +GetTransactionByID Get a transaction based on its id + +Get single specific transaction by transaction id. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id + @return ApiGetTransactionByIDRequest +*/ +func (a *TransactionApiService) GetTransactionByID(ctx context.Context, id string) ApiGetTransactionByIDRequest { + return ApiGetTransactionByIDRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return TransactionResponse +func (a *TransactionApiService) GetTransactionByIDExecute(r ApiGetTransactionByIDRequest) (*TransactionResponse, *http.Response, *common.XenditSdkError) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []common.FormFile + localVarReturnValue *TransactionResponse + ) + + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "TransactionApiService.GetTransactionByID") + if err != nil { + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: TransactionApiService.GetTransactionByIDExecute") + } + + localVarPath := localBasePath + "/transactions/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(utils.ParameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := utils.SelectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } + req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: TransactionApiService.GetTransactionByIDExecute") + } + + localVarHTTPResponse, err := a.client.CallAPI(req) + + localVarBody, _ := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + + err = a.client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + + if err != nil || localVarHTTPResponse.StatusCode < 200 || localVarHTTPResponse.StatusCode >= 300 { + xenditSdkError := common.NewXenditSdkError(&localVarBody, strconv.Itoa(localVarHTTPResponse.StatusCode), localVarHTTPResponse.Status) + + return localVarReturnValue, localVarHTTPResponse, xenditSdkError + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type ApiGetAllTransactionsRequest struct { ctx context.Context ApiService TransactionApi @@ -304,101 +402,3 @@ func (a *TransactionApiService) GetAllTransactionsExecute(r ApiGetAllTransaction return localVarReturnValue, localVarHTTPResponse, nil } - -type ApiGetTransactionByIDRequest struct { - ctx context.Context - ApiService TransactionApi - id string - forUserId *string -} - -// The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information -func (r ApiGetTransactionByIDRequest) ForUserId(forUserId string) ApiGetTransactionByIDRequest { - r.forUserId = &forUserId - return r -} - -func (r ApiGetTransactionByIDRequest) Execute() (*TransactionResponse, *http.Response, *common.XenditSdkError) { - return r.ApiService.GetTransactionByIDExecute(r) -} - -/* -GetTransactionByID Get a transaction based on its id - -Get single specific transaction by transaction id. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id - @return ApiGetTransactionByIDRequest -*/ -func (a *TransactionApiService) GetTransactionByID(ctx context.Context, id string) ApiGetTransactionByIDRequest { - return ApiGetTransactionByIDRequest{ - ApiService: a, - ctx: ctx, - id: id, - } -} - -// Execute executes the request -// @return TransactionResponse -func (a *TransactionApiService) GetTransactionByIDExecute(r ApiGetTransactionByIDRequest) (*TransactionResponse, *http.Response, *common.XenditSdkError) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []common.FormFile - localVarReturnValue *TransactionResponse - ) - - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "TransactionApiService.GetTransactionByID") - if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: TransactionApiService.GetTransactionByIDExecute") - } - - localVarPath := localBasePath + "/transactions/{id}" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(utils.ParameterValueToString(r.id, "id")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := utils.SelectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - if r.forUserId != nil { - utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") - } - req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: TransactionApiService.GetTransactionByIDExecute") - } - - localVarHTTPResponse, err := a.client.CallAPI(req) - - localVarBody, _ := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - - err = a.client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - - if err != nil || localVarHTTPResponse.StatusCode < 200 || localVarHTTPResponse.StatusCode >= 300 { - xenditSdkError := common.NewXenditSdkError(&localVarBody, strconv.Itoa(localVarHTTPResponse.StatusCode), localVarHTTPResponse.Status) - - return localVarReturnValue, localVarHTTPResponse, xenditSdkError - } - - return localVarReturnValue, localVarHTTPResponse, nil -} diff --git a/balance_and_transaction/model_channels_categories.go b/balance_and_transaction/model_channels_categories.go index 971dda98..a2ca428e 100644 --- a/balance_and_transaction/model_channels_categories.go +++ b/balance_and_transaction/model_channels_categories.go @@ -34,6 +34,7 @@ const ( CHANNELSCATEGORIES_XENPLATFORM ChannelsCategories = "XENPLATFORM" CHANNELSCATEGORIES_DIRECT_BANK_TRANSFER ChannelsCategories = "DIRECT_BANK_TRANSFER" CHANNELSCATEGORIES_OTHER ChannelsCategories = "OTHER" + CHANNELSCATEGORIES_XENDIT_ENUM_DEFAULT_FALLBACK ChannelsCategories = "UNKNOWN_ENUM_VALUE" ) // All allowed values of ChannelsCategories enum @@ -52,6 +53,7 @@ var AllowedChannelsCategoriesEnumValues = []ChannelsCategories{ "XENPLATFORM", "DIRECT_BANK_TRANSFER", "OTHER", + "UNKNOWN_ENUM_VALUE", } func (v *ChannelsCategories) UnmarshalJSON(src []byte) error { @@ -68,7 +70,8 @@ func (v *ChannelsCategories) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid ChannelsCategories", value) + *v = CHANNELSCATEGORIES_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewChannelsCategoriesFromValue returns a pointer to a valid ChannelsCategories diff --git a/balance_and_transaction/model_currency.go b/balance_and_transaction/model_currency.go index d0c2d206..e107077f 100644 --- a/balance_and_transaction/model_currency.go +++ b/balance_and_transaction/model_currency.go @@ -182,6 +182,7 @@ const ( CURRENCY_ZAR Currency = "ZAR" CURRENCY_ZMW Currency = "ZMW" CURRENCY_ZWD Currency = "ZWD" + CURRENCY_XENDIT_ENUM_DEFAULT_FALLBACK Currency = "UNKNOWN_ENUM_VALUE" ) // All allowed values of Currency enum @@ -348,6 +349,7 @@ var AllowedCurrencyEnumValues = []Currency{ "ZAR", "ZMW", "ZWD", + "UNKNOWN_ENUM_VALUE", } func (v *Currency) UnmarshalJSON(src []byte) error { @@ -364,7 +366,8 @@ func (v *Currency) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid Currency", value) + *v = CURRENCY_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewCurrencyFromValue returns a pointer to a valid Currency diff --git a/balance_and_transaction/model_transaction_statuses.go b/balance_and_transaction/model_transaction_statuses.go index 02194b35..7266e2ca 100644 --- a/balance_and_transaction/model_transaction_statuses.go +++ b/balance_and_transaction/model_transaction_statuses.go @@ -25,6 +25,7 @@ const ( TRANSACTIONSTATUSES_FAILED TransactionStatuses = "FAILED" TRANSACTIONSTATUSES_REVERSED TransactionStatuses = "REVERSED" TRANSACTIONSTATUSES_VOIDED TransactionStatuses = "VOIDED" + TRANSACTIONSTATUSES_XENDIT_ENUM_DEFAULT_FALLBACK TransactionStatuses = "UNKNOWN_ENUM_VALUE" ) // All allowed values of TransactionStatuses enum @@ -34,6 +35,7 @@ var AllowedTransactionStatusesEnumValues = []TransactionStatuses{ "FAILED", "REVERSED", "VOIDED", + "UNKNOWN_ENUM_VALUE", } func (v *TransactionStatuses) UnmarshalJSON(src []byte) error { @@ -50,7 +52,8 @@ func (v *TransactionStatuses) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid TransactionStatuses", value) + *v = TRANSACTIONSTATUSES_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewTransactionStatusesFromValue returns a pointer to a valid TransactionStatuses diff --git a/balance_and_transaction/model_transaction_types.go b/balance_and_transaction/model_transaction_types.go index 6ae2c89e..ff669cd9 100644 --- a/balance_and_transaction/model_transaction_types.go +++ b/balance_and_transaction/model_transaction_types.go @@ -33,6 +33,7 @@ const ( TRANSACTIONTYPES_TOPUP TransactionTypes = "TOPUP" TRANSACTIONTYPES_WITHDRAWAL TransactionTypes = "WITHDRAWAL" TRANSACTIONTYPES_OTHER TransactionTypes = "OTHER" + TRANSACTIONTYPES_XENDIT_ENUM_DEFAULT_FALLBACK TransactionTypes = "UNKNOWN_ENUM_VALUE" ) // All allowed values of TransactionTypes enum @@ -50,6 +51,7 @@ var AllowedTransactionTypesEnumValues = []TransactionTypes{ "TOPUP", "WITHDRAWAL", "OTHER", + "UNKNOWN_ENUM_VALUE", } func (v *TransactionTypes) UnmarshalJSON(src []byte) error { @@ -66,7 +68,8 @@ func (v *TransactionTypes) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid TransactionTypes", value) + *v = TRANSACTIONTYPES_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewTransactionTypesFromValue returns a pointer to a valid TransactionTypes diff --git a/client.go b/client.go index 22611b0e..1faf1a16 100644 --- a/client.go +++ b/client.go @@ -22,14 +22,14 @@ import ( common "github.com/xendit/xendit-go/v3/common" - balance "github.com/xendit/xendit-go/v3/balance_and_transaction" - customer "github.com/xendit/xendit-go/v3/customer" invoice "github.com/xendit/xendit-go/v3/invoice" - paymentmethod "github.com/xendit/xendit-go/v3/payment_method" paymentrequest "github.com/xendit/xendit-go/v3/payment_request" - payout "github.com/xendit/xendit-go/v3/payout" + paymentmethod "github.com/xendit/xendit-go/v3/payment_method" refund "github.com/xendit/xendit-go/v3/refund" + balance "github.com/xendit/xendit-go/v3/balance_and_transaction" transaction "github.com/xendit/xendit-go/v3/balance_and_transaction" + customer "github.com/xendit/xendit-go/v3/customer" + payout "github.com/xendit/xendit-go/v3/payout" ) @@ -47,14 +47,14 @@ type APIClient struct { apiKey string // API Services - BalanceApi balance.BalanceApi - CustomerApi customer.CustomerApi InvoiceApi invoice.InvoiceApi - PaymentMethodApi paymentmethod.PaymentMethodApi PaymentRequestApi paymentrequest.PaymentRequestApi - PayoutApi payout.PayoutApi + PaymentMethodApi paymentmethod.PaymentMethodApi RefundApi refund.RefundApi + BalanceApi balance.BalanceApi TransactionApi transaction.TransactionApi + CustomerApi customer.CustomerApi + PayoutApi payout.PayoutApi } type service struct { @@ -74,14 +74,14 @@ func NewClient(apiKey string) *APIClient { c.cfg = cfg c.apiKey = apiKey - c.BalanceApi = balance.NewBalanceApi(c) - c.CustomerApi = customer.NewCustomerApi(c) c.InvoiceApi = invoice.NewInvoiceApi(c) - c.PaymentMethodApi = paymentmethod.NewPaymentMethodApi(c) c.PaymentRequestApi = paymentrequest.NewPaymentRequestApi(c) - c.PayoutApi = payout.NewPayoutApi(c) + c.PaymentMethodApi = paymentmethod.NewPaymentMethodApi(c) c.RefundApi = refund.NewRefundApi(c) + c.BalanceApi = balance.NewBalanceApi(c) c.TransactionApi = transaction.NewTransactionApi(c) + c.CustomerApi = customer.NewCustomerApi(c) + c.PayoutApi = payout.NewPayoutApi(c) return c } @@ -154,7 +154,7 @@ func (c *APIClient) PrepareRequest( headerParams["xendit-lib"] = "go" // TODO: overwrite this line from buddy pipeline - headerParams["xendit-lib-ver"] = "3.3.0" + headerParams["xendit-lib-ver"] = "3.4.0" var body *bytes.Buffer diff --git a/configuration.go b/configuration.go index aaacb01a..773d7555 100644 --- a/configuration.go +++ b/configuration.go @@ -78,7 +78,7 @@ var Default Configuration = *NewConfiguration() func NewConfiguration() *Configuration { cfg := &Configuration{ DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/3.3.0/go", + UserAgent: "OpenAPI-Generator/3.4.0/go", Debug: false, Servers: ServerConfigurations{ { diff --git a/customer/api_customer.go b/customer/api_customer.go index 46f28065..9a4e5e8e 100644 --- a/customer/api_customer.go +++ b/customer/api_customer.go @@ -91,14 +91,14 @@ func NewCustomerApi (client common.IClient) CustomerApi { type ApiCreateCustomerRequest struct { ctx context.Context ApiService CustomerApi - iDEMPOTENCYKEY *string + idempotencyKey *string forUserId *string customerRequest *CustomerRequest } // A unique key to prevent processing duplicate requests. -func (r ApiCreateCustomerRequest) IDEMPOTENCYKEY(iDEMPOTENCYKEY string) ApiCreateCustomerRequest { - r.iDEMPOTENCYKEY = &iDEMPOTENCYKEY +func (r ApiCreateCustomerRequest) IdempotencyKey(idempotencyKey string) ApiCreateCustomerRequest { + r.idempotencyKey = &idempotencyKey return r } @@ -171,8 +171,8 @@ func (a *CustomerApiService) CreateCustomerExecute(r ApiCreateCustomerRequest) ( if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if r.iDEMPOTENCYKEY != nil { - utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "IDEMPOTENCY-KEY", r.iDEMPOTENCYKEY, "") + if r.idempotencyKey != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "idempotency-key", r.idempotencyKey, "") } if r.forUserId != nil { utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") diff --git a/customer/model_address_status.go b/customer/model_address_status.go index ebc18c21..849a84ca 100644 --- a/customer/model_address_status.go +++ b/customer/model_address_status.go @@ -22,12 +22,14 @@ type AddressStatus string const ( ADDRESSSTATUS_ACTIVE AddressStatus = "ACTIVE" ADDRESSSTATUS_DELETED AddressStatus = "DELETED" + ADDRESSSTATUS_XENDIT_ENUM_DEFAULT_FALLBACK AddressStatus = "UNKNOWN_ENUM_VALUE" ) // All allowed values of AddressStatus enum var AllowedAddressStatusEnumValues = []AddressStatus{ "ACTIVE", "DELETED", + "UNKNOWN_ENUM_VALUE", } func (v *AddressStatus) UnmarshalJSON(src []byte) error { @@ -44,7 +46,8 @@ func (v *AddressStatus) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid AddressStatus", value) + *v = ADDRESSSTATUS_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewAddressStatusFromValue returns a pointer to a valid AddressStatus diff --git a/customer/model_end_customer_status.go b/customer/model_end_customer_status.go index 6ed1ba1f..287ae52f 100644 --- a/customer/model_end_customer_status.go +++ b/customer/model_end_customer_status.go @@ -25,6 +25,7 @@ const ( ENDCUSTOMERSTATUS_PENDING EndCustomerStatus = "PENDING" ENDCUSTOMERSTATUS_BLOCKED EndCustomerStatus = "BLOCKED" ENDCUSTOMERSTATUS_DELETED EndCustomerStatus = "DELETED" + ENDCUSTOMERSTATUS_XENDIT_ENUM_DEFAULT_FALLBACK EndCustomerStatus = "UNKNOWN_ENUM_VALUE" ) // All allowed values of EndCustomerStatus enum @@ -34,6 +35,7 @@ var AllowedEndCustomerStatusEnumValues = []EndCustomerStatus{ "PENDING", "BLOCKED", "DELETED", + "UNKNOWN_ENUM_VALUE", } func (v *EndCustomerStatus) UnmarshalJSON(src []byte) error { @@ -50,7 +52,8 @@ func (v *EndCustomerStatus) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid EndCustomerStatus", value) + *v = ENDCUSTOMERSTATUS_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewEndCustomerStatusFromValue returns a pointer to a valid EndCustomerStatus diff --git a/customer/model_identity_account_type.go b/customer/model_identity_account_type.go index e67412be..64fe061c 100644 --- a/customer/model_identity_account_type.go +++ b/customer/model_identity_account_type.go @@ -26,6 +26,7 @@ const ( IDENTITYACCOUNTTYPE_PAY_LATER IdentityAccountType = "PAY_LATER" IDENTITYACCOUNTTYPE_OTC IdentityAccountType = "OTC" IDENTITYACCOUNTTYPE_QR_CODE IdentityAccountType = "QR_CODE" + IDENTITYACCOUNTTYPE_XENDIT_ENUM_DEFAULT_FALLBACK IdentityAccountType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of IdentityAccountType enum @@ -36,6 +37,7 @@ var AllowedIdentityAccountTypeEnumValues = []IdentityAccountType{ "PAY_LATER", "OTC", "QR_CODE", + "UNKNOWN_ENUM_VALUE", } func (v *IdentityAccountType) UnmarshalJSON(src []byte) error { @@ -52,7 +54,8 @@ func (v *IdentityAccountType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid IdentityAccountType", value) + *v = IDENTITYACCOUNTTYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewIdentityAccountTypeFromValue returns a pointer to a valid IdentityAccountType diff --git a/customer/model_kyc_document_sub_type.go b/customer/model_kyc_document_sub_type.go index 494b2d38..94766cad 100644 --- a/customer/model_kyc_document_sub_type.go +++ b/customer/model_kyc_document_sub_type.go @@ -30,6 +30,7 @@ const ( KYCDOCUMENTSUBTYPE_MILITARY_ID KYCDocumentSubType = "MILITARY_ID" KYCDOCUMENTSUBTYPE_MEDICAL_ID KYCDocumentSubType = "MEDICAL_ID" KYCDOCUMENTSUBTYPE_OTHERS KYCDocumentSubType = "OTHERS" + KYCDOCUMENTSUBTYPE_XENDIT_ENUM_DEFAULT_FALLBACK KYCDocumentSubType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of KYCDocumentSubType enum @@ -44,6 +45,7 @@ var AllowedKYCDocumentSubTypeEnumValues = []KYCDocumentSubType{ "MILITARY_ID", "MEDICAL_ID", "OTHERS", + "UNKNOWN_ENUM_VALUE", } func (v *KYCDocumentSubType) UnmarshalJSON(src []byte) error { @@ -60,7 +62,8 @@ func (v *KYCDocumentSubType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid KYCDocumentSubType", value) + *v = KYCDOCUMENTSUBTYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewKYCDocumentSubTypeFromValue returns a pointer to a valid KYCDocumentSubType diff --git a/customer/model_kyc_document_type.go b/customer/model_kyc_document_type.go index 4715111f..539b408d 100644 --- a/customer/model_kyc_document_type.go +++ b/customer/model_kyc_document_type.go @@ -28,6 +28,7 @@ const ( KYCDOCUMENTTYPE_VISA KYCDocumentType = "VISA" KYCDOCUMENTTYPE_BUSINESS_REGISTRATION KYCDocumentType = "BUSINESS_REGISTRATION" KYCDOCUMENTTYPE_BUSINESS_LICENSE KYCDocumentType = "BUSINESS_LICENSE" + KYCDOCUMENTTYPE_XENDIT_ENUM_DEFAULT_FALLBACK KYCDocumentType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of KYCDocumentType enum @@ -40,6 +41,7 @@ var AllowedKYCDocumentTypeEnumValues = []KYCDocumentType{ "VISA", "BUSINESS_REGISTRATION", "BUSINESS_LICENSE", + "UNKNOWN_ENUM_VALUE", } func (v *KYCDocumentType) UnmarshalJSON(src []byte) error { @@ -56,7 +58,8 @@ func (v *KYCDocumentType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid KYCDocumentType", value) + *v = KYCDOCUMENTTYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewKYCDocumentTypeFromValue returns a pointer to a valid KYCDocumentType diff --git a/docs/CustomerApi.md b/docs/CustomerApi.md index 9ae9c544..6575eb4c 100644 --- a/docs/CustomerApi.md +++ b/docs/CustomerApi.md @@ -33,7 +33,7 @@ import ( func main() { // A unique key to prevent processing duplicate requests. - iDEMPOTENCYKEY := "idempotency-123" // [OPTIONAL] | string + idempotencyKey := "idempotency-123" // [OPTIONAL] | string // The sub-account user-id that you want to make this transaction for. forUserId := "user-1" // [OPTIONAL] | string @@ -44,7 +44,7 @@ func main() { xenditClient := xendit.NewClient("API-KEY") resp, r, err := xenditClient.CustomerApi.CreateCustomer(context.Background()). - IDEMPOTENCYKEY(iDEMPOTENCYKEY). + IdempotencyKey(idempotencyKey). ForUserId(forUserId). CustomerRequest(customerRequest). // [OPTIONAL] Execute() @@ -73,7 +73,7 @@ Other parameters are passed through a pointer to a apiCreateCustomerRequest stru | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **iDEMPOTENCYKEY** |**string**| A unique key to prevent processing duplicate requests. | | +| **idempotencyKey** |**string**| A unique key to prevent processing duplicate requests. | | | **forUserId** |**string**| The sub-account user-id that you want to make this transaction for. | | | **customerRequest** |[**CustomerRequest**](customer/CustomerRequest.md)| Request object for end customer object | | diff --git a/docs/InvoiceApi.md b/docs/InvoiceApi.md index 1f42f308..4bcddf3b 100644 --- a/docs/InvoiceApi.md +++ b/docs/InvoiceApi.md @@ -5,9 +5,9 @@ All URIs are relative to *https://api.xendit.co* | Method | HTTP request | Description | | ------------- | ------------- | ------------- | | [**CreateInvoice**](InvoiceApi.md#CreateInvoice) | **Post** /v2/invoices/ | Create an invoice | -| [**ExpireInvoice**](InvoiceApi.md#ExpireInvoice) | **Post** /invoices/{invoice_id}/expire! | Manually expire an invoice | | [**GetInvoiceById**](InvoiceApi.md#GetInvoiceById) | **Get** /v2/invoices/{invoice_id} | Get invoice by invoice id | | [**GetInvoices**](InvoiceApi.md#GetInvoices) | **Get** /v2/invoices | Get all Invoices | +| [**ExpireInvoice**](InvoiceApi.md#ExpireInvoice) | **Post** /invoices/{invoice_id}/expire! | Manually expire an invoice | @@ -32,10 +32,14 @@ func main() { createInvoiceRequest := *invoice.NewCreateInvoiceRequest("ExternalId_example", float32(123)) // [REQUIRED] | CreateInvoiceRequest + // Business ID of the sub-account merchant (XP feature) + forUserId := "62efe4c33e45694d63f585f8" // [OPTIONAL] | string + xenditClient := xendit.NewClient("API-KEY") resp, r, err := xenditClient.InvoiceApi.CreateInvoice(context.Background()). - CreateInvoiceRequest(createInvoiceRequest). // [OPTIONAL] + CreateInvoiceRequest(createInvoiceRequest). + ForUserId(forUserId). // [OPTIONAL] Execute() if err != nil { @@ -63,6 +67,7 @@ Other parameters are passed through a pointer to a apiCreateInvoiceRequest struc | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | **createInvoiceRequest** |[**CreateInvoiceRequest**](invoice/CreateInvoiceRequest.md)| | | +| **forUserId** |**string**| Business ID of the sub-account merchant (XP feature) | | ### Return type @@ -77,76 +82,6 @@ Other parameters are passed through a pointer to a apiCreateInvoiceRequest struc [[Back to README]](../README.md) -## ExpireInvoice - -Manually expire an invoice - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - xendit "github.com/xendit/xendit-go/v3" - invoice "github.com/xendit/xendit-go/v3/invoice" -) - -func main() { - - // Invoice ID to be expired - invoiceId := "5f4708b7bd394b0400b96276" // [REQUIRED] | string - - xenditClient := xendit.NewClient("API-KEY") - - resp, r, err := xenditClient.InvoiceApi.ExpireInvoice(context.Background(), invoiceId). // [OPTIONAL] - Execute() - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `InvoiceApi.ExpireInvoice``: %v\n", err.Error()) - - b, _ := json.Marshal(err.FullError()) - fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) - - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ExpireInvoice`: Invoice - fmt.Fprintf(os.Stdout, "Response from `InvoiceApi.ExpireInvoice`: %v\n", resp) -} -``` - -### Path Parameters - - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | -------------| -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | -| **invoiceId** | **string** | Invoice ID to be expired | | - -### Other Parameters - -Other parameters are passed through a pointer to a apiExpireInvoiceRequest struct via the builder pattern - - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| - -### Return type - -[**Invoice**](invoice/Invoice.md) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) -[[Back to README]](../README.md) - - ## GetInvoiceById Get invoice by invoice id @@ -169,9 +104,13 @@ func main() { // Invoice ID invoiceId := "62efe4c33e45294d63f585f2" // [REQUIRED] | string + // Business ID of the sub-account merchant (XP feature) + forUserId := "62efe4c33e45694d63f585f8" // [OPTIONAL] | string + xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.InvoiceApi.GetInvoiceById(context.Background(), invoiceId). // [OPTIONAL] + resp, r, err := xenditClient.InvoiceApi.GetInvoiceById(context.Background(), invoiceId). + ForUserId(forUserId). // [OPTIONAL] Execute() if err != nil { @@ -203,6 +142,7 @@ Other parameters are passed through a pointer to a apiGetInvoiceByIdRequest stru | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | +| **forUserId** |**string**| Business ID of the sub-account merchant (XP feature) | | ### Return type @@ -237,6 +177,9 @@ import ( func main() { + // Business ID of the sub-account merchant (XP feature) + forUserId := "62efe4c33e45694d63f585f8" // [OPTIONAL] | string + externalId := "test-external" // [OPTIONAL] | string statuses := []invoice.InvoiceStatus{invoice.InvoiceStatus("PENDING")} // [OPTIONAL] | []InvoiceStatus @@ -268,6 +211,7 @@ func main() { xenditClient := xendit.NewClient("API-KEY") resp, r, err := xenditClient.InvoiceApi.GetInvoices(context.Background()). + ForUserId(forUserId). ExternalId(externalId). Statuses(statuses). Limit(limit). @@ -308,6 +252,7 @@ Other parameters are passed through a pointer to a apiGetInvoicesRequest struct | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | +| **forUserId** |**string**| Business ID of the sub-account merchant (XP feature) | | | **externalId** |**string**| | | | **statuses** |[**InvoiceStatus[]**](invoice/InvoiceStatus.md)| | | | **limit** |**float32**| | | @@ -335,3 +280,78 @@ Other parameters are passed through a pointer to a apiGetInvoicesRequest struct [[Back to top]](#) [[Back to README]](../README.md) + +## ExpireInvoice + +Manually expire an invoice + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + xendit "github.com/xendit/xendit-go/v3" + invoice "github.com/xendit/xendit-go/v3/invoice" +) + +func main() { + + // Invoice ID to be expired + invoiceId := "5f4708b7bd394b0400b96276" // [REQUIRED] | string + + // Business ID of the sub-account merchant (XP feature) + forUserId := "62efe4c33e45694d63f585f8" // [OPTIONAL] | string + + xenditClient := xendit.NewClient("API-KEY") + + resp, r, err := xenditClient.InvoiceApi.ExpireInvoice(context.Background(), invoiceId). + ForUserId(forUserId). // [OPTIONAL] + Execute() + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `InvoiceApi.ExpireInvoice``: %v\n", err.Error()) + + b, _ := json.Marshal(err.FullError()) + fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) + + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ExpireInvoice`: Invoice + fmt.Fprintf(os.Stdout, "Response from `InvoiceApi.ExpireInvoice`: %v\n", resp) +} +``` + +### Path Parameters + + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | -------------| +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | +| **invoiceId** | **string** | Invoice ID to be expired | | + +### Other Parameters + +Other parameters are passed through a pointer to a apiExpireInvoiceRequest struct via the builder pattern + + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| +| **forUserId** |**string**| Business ID of the sub-account merchant (XP feature) | | + +### Return type + +[**Invoice**](invoice/Invoice.md) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) +[[Back to README]](../README.md) + diff --git a/docs/PaymentMethodApi.md b/docs/PaymentMethodApi.md index c9bd8c3b..7d903dcf 100644 --- a/docs/PaymentMethodApi.md +++ b/docs/PaymentMethodApi.md @@ -4,20 +4,20 @@ All URIs are relative to *https://api.xendit.co* | Method | HTTP request | Description | | ------------- | ------------- | ------------- | -| [**AuthPaymentMethod**](PaymentMethodApi.md#AuthPaymentMethod) | **Post** /v2/payment_methods/{paymentMethodId}/auth | Validate a payment method's linking OTP | | [**CreatePaymentMethod**](PaymentMethodApi.md#CreatePaymentMethod) | **Post** /v2/payment_methods | Creates payment method | -| [**ExpirePaymentMethod**](PaymentMethodApi.md#ExpirePaymentMethod) | **Post** /v2/payment_methods/{paymentMethodId}/expire | Expires a payment method | -| [**GetAllPaymentMethods**](PaymentMethodApi.md#GetAllPaymentMethods) | **Get** /v2/payment_methods | Get all payment methods by filters | | [**GetPaymentMethodByID**](PaymentMethodApi.md#GetPaymentMethodByID) | **Get** /v2/payment_methods/{paymentMethodId} | Get payment method by ID | | [**GetPaymentsByPaymentMethodId**](PaymentMethodApi.md#GetPaymentsByPaymentMethodId) | **Get** /v2/payment_methods/{paymentMethodId}/payments | Returns payments with matching PaymentMethodID. | | [**PatchPaymentMethod**](PaymentMethodApi.md#PatchPaymentMethod) | **Patch** /v2/payment_methods/{paymentMethodId} | Patch payment methods | +| [**GetAllPaymentMethods**](PaymentMethodApi.md#GetAllPaymentMethods) | **Get** /v2/payment_methods | Get all payment methods by filters | +| [**ExpirePaymentMethod**](PaymentMethodApi.md#ExpirePaymentMethod) | **Post** /v2/payment_methods/{paymentMethodId}/expire | Expires a payment method | +| [**AuthPaymentMethod**](PaymentMethodApi.md#AuthPaymentMethod) | **Post** /v2/payment_methods/{paymentMethodId}/auth | Validate a payment method's linking OTP | | [**SimulatePayment**](PaymentMethodApi.md#SimulatePayment) | **Post** /v2/payment_methods/{paymentMethodId}/payments/simulate | Makes payment with matching PaymentMethodID. | -## AuthPaymentMethod +## CreatePaymentMethod -Validate a payment method's linking OTP +Creates payment method @@ -36,46 +36,43 @@ import ( func main() { - paymentMethodId := "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string - paymentMethodAuthParameters := *payment_method.NewPaymentMethodAuthParameters("AuthCode_example") // [OPTIONAL] | PaymentMethodAuthParameters + paymentMethodParameters := *payment_method.NewPaymentMethodParameters(payment_method.PaymentMethodType("CARD"), payment_method.PaymentMethodReusability("MULTIPLE_USE")) // [OPTIONAL] | PaymentMethodParameters xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentMethodApi.AuthPaymentMethod(context.Background(), paymentMethodId). - PaymentMethodAuthParameters(paymentMethodAuthParameters). // [OPTIONAL] + resp, r, err := xenditClient.PaymentMethodApi.CreatePaymentMethod(context.Background()). + ForUserId(forUserId). + PaymentMethodParameters(paymentMethodParameters). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.AuthPaymentMethod``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.CreatePaymentMethod``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `AuthPaymentMethod`: PaymentMethod - fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.AuthPaymentMethod`: %v\n", resp) + // response from `CreatePaymentMethod`: PaymentMethod + fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.CreatePaymentMethod`: %v\n", resp) } ``` ### Path Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | -------------| -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | -| **paymentMethodId** | **string** | | | ### Other Parameters -Other parameters are passed through a pointer to a apiAuthPaymentMethodRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiCreatePaymentMethodRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| -| **paymentMethodAuthParameters** |[**PaymentMethodAuthParameters**](payment_method/PaymentMethodAuthParameters.md)| | | +| **forUserId** |**string**| | | +| **paymentMethodParameters** |[**PaymentMethodParameters**](payment_method/PaymentMethodParameters.md)| | | ### Return type @@ -90,9 +87,9 @@ Other parameters are passed through a pointer to a apiAuthPaymentMethodRequest s [[Back to README]](../README.md) -## CreatePaymentMethod +## GetPaymentMethodByID -Creates payment method +Get payment method by ID @@ -111,39 +108,46 @@ import ( func main() { - paymentMethodParameters := *payment_method.NewPaymentMethodParameters(payment_method.PaymentMethodType("CARD"), payment_method.PaymentMethodReusability("MULTIPLE_USE")) // [OPTIONAL] | PaymentMethodParameters + paymentMethodId := "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string + + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentMethodApi.CreatePaymentMethod(context.Background()). - PaymentMethodParameters(paymentMethodParameters). // [OPTIONAL] + resp, r, err := xenditClient.PaymentMethodApi.GetPaymentMethodByID(context.Background(), paymentMethodId). + ForUserId(forUserId). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.CreatePaymentMethod``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.GetPaymentMethodByID``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `CreatePaymentMethod`: PaymentMethod - fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.CreatePaymentMethod`: %v\n", resp) + // response from `GetPaymentMethodByID`: PaymentMethod + fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.GetPaymentMethodByID`: %v\n", resp) } ``` ### Path Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | -------------| +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | +| **paymentMethodId** | **string** | | | ### Other Parameters -Other parameters are passed through a pointer to a apiCreatePaymentMethodRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiGetPaymentMethodByIDRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **paymentMethodParameters** |[**PaymentMethodParameters**](payment_method/PaymentMethodParameters.md)| | | +| +| **forUserId** |**string**| | | ### Return type @@ -151,16 +155,16 @@ Other parameters are passed through a pointer to a apiCreatePaymentMethodRequest ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to README]](../README.md) -## ExpirePaymentMethod +## GetPaymentsByPaymentMethodId -Expires a payment method +Returns payments with matching PaymentMethodID. @@ -173,6 +177,7 @@ import ( "context" "fmt" "os" + "time" xendit "github.com/xendit/xendit-go/v3" payment_method "github.com/xendit/xendit-go/v3/payment_method" ) @@ -181,24 +186,60 @@ func main() { paymentMethodId := "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string - paymentMethodExpireParameters := *payment_method.NewPaymentMethodExpireParameters() // [OPTIONAL] | PaymentMethodExpireParameters + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + + paymentRequestId := []string{"Inner_example"} // [OPTIONAL] | []string + + paymentMethodId2 := []string{"Inner_example"} // [OPTIONAL] | []string + + referenceId := []string{"Inner_example"} // [OPTIONAL] | []string + + paymentMethodType := []payment_method.PaymentMethodType{payment_method.PaymentMethodType("CARD")} // [OPTIONAL] | []PaymentMethodType + + channelCode := []string{"Inner_example"} // [OPTIONAL] | []string + + status := []string{"Inner_example"} // [OPTIONAL] | []string + + currency := []string{"Inner_example"} // [OPTIONAL] | []string + + createdGte := time.Now() // [OPTIONAL] | time.Time + + createdLte := time.Now() // [OPTIONAL] | time.Time + + updatedGte := time.Now() // [OPTIONAL] | time.Time + + updatedLte := time.Now() // [OPTIONAL] | time.Time + + limit := int32(56) // [OPTIONAL] | int32 xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentMethodApi.ExpirePaymentMethod(context.Background(), paymentMethodId). - PaymentMethodExpireParameters(paymentMethodExpireParameters). // [OPTIONAL] + resp, r, err := xenditClient.PaymentMethodApi.GetPaymentsByPaymentMethodId(context.Background(), paymentMethodId). + ForUserId(forUserId). + PaymentRequestId(paymentRequestId). + PaymentMethodId2(paymentMethodId2). + ReferenceId(referenceId). + PaymentMethodType(paymentMethodType). + ChannelCode(channelCode). + Status(status). + Currency(currency). + CreatedGte(createdGte). + CreatedLte(createdLte). + UpdatedGte(updatedGte). + UpdatedLte(updatedLte). + Limit(limit). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.ExpirePaymentMethod``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.GetPaymentsByPaymentMethodId``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `ExpirePaymentMethod`: PaymentMethod - fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.ExpirePaymentMethod`: %v\n", resp) + // response from `GetPaymentsByPaymentMethodId`: map[string]interface{} + fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.GetPaymentsByPaymentMethodId`: %v\n", resp) } ``` @@ -212,30 +253,42 @@ func main() { ### Other Parameters -Other parameters are passed through a pointer to a apiExpirePaymentMethodRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiGetPaymentsByPaymentMethodIdRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | -| **paymentMethodExpireParameters** |[**PaymentMethodExpireParameters**](payment_method/PaymentMethodExpireParameters.md)| | | +| **forUserId** |**string**| | | +| **paymentRequestId** |**string[]**| | | +| **paymentMethodId2** |**string[]**| | | +| **referenceId** |**string[]**| | | +| **paymentMethodType** |[**PaymentMethodType[]**](payment_method/PaymentMethodType.md)| | | +| **channelCode** |**string[]**| | | +| **status** |**string[]**| | | +| **currency** |**string[]**| | | +| **createdGte** |**time.Time**| | | +| **createdLte** |**time.Time**| | | +| **updatedGte** |**time.Time**| | | +| **updatedLte** |**time.Time**| | | +| **limit** |**int32**| | | ### Return type -[**PaymentMethod**](payment_method/PaymentMethod.md) +**map[string]interface{}** ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to README]](../README.md) -## GetAllPaymentMethods +## PatchPaymentMethod -Get all payment methods by filters +Patch payment methods @@ -254,88 +307,67 @@ import ( func main() { - id := []string{"Inner_example"} // [OPTIONAL] | []string - - type_ := []string{"Inner_example"} // [OPTIONAL] | []string - - status := []payment_method.PaymentMethodStatus{payment_method.PaymentMethodStatus("ACTIVE")} // [OPTIONAL] | []PaymentMethodStatus - - reusability := payment_method.PaymentMethodReusability("MULTIPLE_USE") // [OPTIONAL] | PaymentMethodReusability - - customerId := "customerId_example" // [OPTIONAL] | string - - referenceId := "referenceId_example" // [OPTIONAL] | string + paymentMethodId := "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string - afterId := "afterId_example" // [OPTIONAL] | string + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string - beforeId := "beforeId_example" // [OPTIONAL] | string - - limit := int32(56) // [OPTIONAL] | int32 + paymentMethodUpdateParameters := *payment_method.NewPaymentMethodUpdateParameters() // [OPTIONAL] | PaymentMethodUpdateParameters xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentMethodApi.GetAllPaymentMethods(context.Background()). - Id(id). - Type_(type_). - Status(status). - Reusability(reusability). - CustomerId(customerId). - ReferenceId(referenceId). - AfterId(afterId). - BeforeId(beforeId). - Limit(limit). // [OPTIONAL] + resp, r, err := xenditClient.PaymentMethodApi.PatchPaymentMethod(context.Background(), paymentMethodId). + ForUserId(forUserId). + PaymentMethodUpdateParameters(paymentMethodUpdateParameters). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.GetAllPaymentMethods``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.PatchPaymentMethod``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetAllPaymentMethods`: PaymentMethodList - fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.GetAllPaymentMethods`: %v\n", resp) + // response from `PatchPaymentMethod`: PaymentMethod + fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.PatchPaymentMethod`: %v\n", resp) } ``` ### Path Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | -------------| +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | +| **paymentMethodId** | **string** | | | ### Other Parameters -Other parameters are passed through a pointer to a apiGetAllPaymentMethodsRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiPatchPaymentMethodRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **id** |**string[]**| | | -| **type_** |**string[]**| | | -| **status** |[**PaymentMethodStatus[]**](payment_method/PaymentMethodStatus.md)| | | -| **reusability** |[**PaymentMethodReusability**](payment_method/PaymentMethodReusabilitypayment_method/.md)| | | -| **customerId** |**string**| | | -| **referenceId** |**string**| | | -| **afterId** |**string**| | | -| **beforeId** |**string**| | | -| **limit** |**int32**| | | +| +| **forUserId** |**string**| | | +| **paymentMethodUpdateParameters** |[**PaymentMethodUpdateParameters**](payment_method/PaymentMethodUpdateParameters.md)| | | ### Return type -[**PaymentMethodList**](payment_method/PaymentMethodList.md) +[**PaymentMethod**](payment_method/PaymentMethod.md) ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to README]](../README.md) -## GetPaymentMethodByID +## GetAllPaymentMethods -Get payment method by ID +Get all payment methods by filters @@ -354,46 +386,79 @@ import ( func main() { - paymentMethodId := "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + + id := []string{"Inner_example"} // [OPTIONAL] | []string + + type_ := []string{"Inner_example"} // [OPTIONAL] | []string + + status := []payment_method.PaymentMethodStatus{payment_method.PaymentMethodStatus("ACTIVE")} // [OPTIONAL] | []PaymentMethodStatus + + reusability := payment_method.PaymentMethodReusability("MULTIPLE_USE") // [OPTIONAL] | PaymentMethodReusability + + customerId := "customerId_example" // [OPTIONAL] | string + + referenceId := "referenceId_example" // [OPTIONAL] | string + + afterId := "afterId_example" // [OPTIONAL] | string + + beforeId := "beforeId_example" // [OPTIONAL] | string + + limit := int32(56) // [OPTIONAL] | int32 xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentMethodApi.GetPaymentMethodByID(context.Background(), paymentMethodId). // [OPTIONAL] + resp, r, err := xenditClient.PaymentMethodApi.GetAllPaymentMethods(context.Background()). + ForUserId(forUserId). + Id(id). + Type_(type_). + Status(status). + Reusability(reusability). + CustomerId(customerId). + ReferenceId(referenceId). + AfterId(afterId). + BeforeId(beforeId). + Limit(limit). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.GetPaymentMethodByID``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.GetAllPaymentMethods``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetPaymentMethodByID`: PaymentMethod - fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.GetPaymentMethodByID`: %v\n", resp) + // response from `GetAllPaymentMethods`: PaymentMethodList + fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.GetAllPaymentMethods`: %v\n", resp) } ``` ### Path Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | -------------| -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | -| **paymentMethodId** | **string** | | | ### Other Parameters -Other parameters are passed through a pointer to a apiGetPaymentMethodByIDRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiGetAllPaymentMethodsRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| +| **forUserId** |**string**| | | +| **id** |**string[]**| | | +| **type_** |**string[]**| | | +| **status** |[**PaymentMethodStatus[]**](payment_method/PaymentMethodStatus.md)| | | +| **reusability** |[**PaymentMethodReusability**](payment_method/PaymentMethodReusabilitypayment_method/.md)| | | +| **customerId** |**string**| | | +| **referenceId** |**string**| | | +| **afterId** |**string**| | | +| **beforeId** |**string**| | | +| **limit** |**int32**| | | ### Return type -[**PaymentMethod**](payment_method/PaymentMethod.md) +[**PaymentMethodList**](payment_method/PaymentMethodList.md) ### HTTP request headers @@ -404,9 +469,9 @@ Other parameters are passed through a pointer to a apiGetPaymentMethodByIDReques [[Back to README]](../README.md) -## GetPaymentsByPaymentMethodId +## ExpirePaymentMethod -Returns payments with matching PaymentMethodID. +Expires a payment method @@ -419,7 +484,6 @@ import ( "context" "fmt" "os" - "time" xendit "github.com/xendit/xendit-go/v3" payment_method "github.com/xendit/xendit-go/v3/payment_method" ) @@ -428,57 +492,27 @@ func main() { paymentMethodId := "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string - paymentRequestId := []string{"Inner_example"} // [OPTIONAL] | []string - - paymentMethodId2 := []string{"Inner_example"} // [OPTIONAL] | []string - - referenceId := []string{"Inner_example"} // [OPTIONAL] | []string - - paymentMethodType := []payment_method.PaymentMethodType{payment_method.PaymentMethodType("CARD")} // [OPTIONAL] | []PaymentMethodType + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string - channelCode := []string{"Inner_example"} // [OPTIONAL] | []string - - status := []string{"Inner_example"} // [OPTIONAL] | []string - - currency := []string{"Inner_example"} // [OPTIONAL] | []string - - createdGte := time.Now() // [OPTIONAL] | time.Time - - createdLte := time.Now() // [OPTIONAL] | time.Time - - updatedGte := time.Now() // [OPTIONAL] | time.Time - - updatedLte := time.Now() // [OPTIONAL] | time.Time - - limit := int32(56) // [OPTIONAL] | int32 + paymentMethodExpireParameters := *payment_method.NewPaymentMethodExpireParameters() // [OPTIONAL] | PaymentMethodExpireParameters xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentMethodApi.GetPaymentsByPaymentMethodId(context.Background(), paymentMethodId). - PaymentRequestId(paymentRequestId). - PaymentMethodId2(paymentMethodId2). - ReferenceId(referenceId). - PaymentMethodType(paymentMethodType). - ChannelCode(channelCode). - Status(status). - Currency(currency). - CreatedGte(createdGte). - CreatedLte(createdLte). - UpdatedGte(updatedGte). - UpdatedLte(updatedLte). - Limit(limit). // [OPTIONAL] + resp, r, err := xenditClient.PaymentMethodApi.ExpirePaymentMethod(context.Background(), paymentMethodId). + ForUserId(forUserId). + PaymentMethodExpireParameters(paymentMethodExpireParameters). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.GetPaymentsByPaymentMethodId``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.ExpirePaymentMethod``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetPaymentsByPaymentMethodId`: map[string]interface{} - fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.GetPaymentsByPaymentMethodId`: %v\n", resp) + // response from `ExpirePaymentMethod`: PaymentMethod + fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.ExpirePaymentMethod`: %v\n", resp) } ``` @@ -492,41 +526,31 @@ func main() { ### Other Parameters -Other parameters are passed through a pointer to a apiGetPaymentsByPaymentMethodIdRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiExpirePaymentMethodRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | -| **paymentRequestId** |**string[]**| | | -| **paymentMethodId2** |**string[]**| | | -| **referenceId** |**string[]**| | | -| **paymentMethodType** |[**PaymentMethodType[]**](payment_method/PaymentMethodType.md)| | | -| **channelCode** |**string[]**| | | -| **status** |**string[]**| | | -| **currency** |**string[]**| | | -| **createdGte** |**time.Time**| | | -| **createdLte** |**time.Time**| | | -| **updatedGte** |**time.Time**| | | -| **updatedLte** |**time.Time**| | | -| **limit** |**int32**| | | +| **forUserId** |**string**| | | +| **paymentMethodExpireParameters** |[**PaymentMethodExpireParameters**](payment_method/PaymentMethodExpireParameters.md)| | | ### Return type -**map[string]interface{}** +[**PaymentMethod**](payment_method/PaymentMethod.md) ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to README]](../README.md) -## PatchPaymentMethod +## AuthPaymentMethod -Patch payment methods +Validate a payment method's linking OTP @@ -547,24 +571,27 @@ func main() { paymentMethodId := "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string - paymentMethodUpdateParameters := *payment_method.NewPaymentMethodUpdateParameters() // [OPTIONAL] | PaymentMethodUpdateParameters + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + + paymentMethodAuthParameters := *payment_method.NewPaymentMethodAuthParameters("AuthCode_example") // [OPTIONAL] | PaymentMethodAuthParameters xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentMethodApi.PatchPaymentMethod(context.Background(), paymentMethodId). - PaymentMethodUpdateParameters(paymentMethodUpdateParameters). // [OPTIONAL] + resp, r, err := xenditClient.PaymentMethodApi.AuthPaymentMethod(context.Background(), paymentMethodId). + ForUserId(forUserId). + PaymentMethodAuthParameters(paymentMethodAuthParameters). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.PatchPaymentMethod``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `PaymentMethodApi.AuthPaymentMethod``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `PatchPaymentMethod`: PaymentMethod - fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.PatchPaymentMethod`: %v\n", resp) + // response from `AuthPaymentMethod`: PaymentMethod + fmt.Fprintf(os.Stdout, "Response from `PaymentMethodApi.AuthPaymentMethod`: %v\n", resp) } ``` @@ -578,13 +605,14 @@ func main() { ### Other Parameters -Other parameters are passed through a pointer to a apiPatchPaymentMethodRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiAuthPaymentMethodRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | -| **paymentMethodUpdateParameters** |[**PaymentMethodUpdateParameters**](payment_method/PaymentMethodUpdateParameters.md)| | | +| **forUserId** |**string**| | | +| **paymentMethodAuthParameters** |[**PaymentMethodAuthParameters**](payment_method/PaymentMethodAuthParameters.md)| | | ### Return type diff --git a/docs/PaymentRequestApi.md b/docs/PaymentRequestApi.md index e53e62a8..8b64f977 100644 --- a/docs/PaymentRequestApi.md +++ b/docs/PaymentRequestApi.md @@ -4,19 +4,19 @@ All URIs are relative to *https://api.xendit.co* | Method | HTTP request | Description | | ------------- | ------------- | ------------- | -| [**AuthorizePaymentRequest**](PaymentRequestApi.md#AuthorizePaymentRequest) | **Post** /payment_requests/{paymentRequestId}/auth | Payment Request Authorize | -| [**CapturePaymentRequest**](PaymentRequestApi.md#CapturePaymentRequest) | **Post** /payment_requests/{paymentRequestId}/captures | Payment Request Capture | | [**CreatePaymentRequest**](PaymentRequestApi.md#CreatePaymentRequest) | **Post** /payment_requests | Create Payment Request | -| [**GetAllPaymentRequests**](PaymentRequestApi.md#GetAllPaymentRequests) | **Get** /payment_requests | Get all payment requests by filter | | [**GetPaymentRequestByID**](PaymentRequestApi.md#GetPaymentRequestByID) | **Get** /payment_requests/{paymentRequestId} | Get payment request by ID | | [**GetPaymentRequestCaptures**](PaymentRequestApi.md#GetPaymentRequestCaptures) | **Get** /payment_requests/{paymentRequestId}/captures | Get Payment Request Capture | +| [**GetAllPaymentRequests**](PaymentRequestApi.md#GetAllPaymentRequests) | **Get** /payment_requests | Get all payment requests by filter | +| [**CapturePaymentRequest**](PaymentRequestApi.md#CapturePaymentRequest) | **Post** /payment_requests/{paymentRequestId}/captures | Payment Request Capture | +| [**AuthorizePaymentRequest**](PaymentRequestApi.md#AuthorizePaymentRequest) | **Post** /payment_requests/{paymentRequestId}/auth | Payment Request Authorize | | [**ResendPaymentRequestAuth**](PaymentRequestApi.md#ResendPaymentRequestAuth) | **Post** /payment_requests/{paymentRequestId}/auth/resend | Payment Request Resend Auth | -## AuthorizePaymentRequest +## CreatePaymentRequest -Payment Request Authorize +Create Payment Request @@ -35,46 +35,47 @@ import ( func main() { - paymentRequestId := "pr-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string + idempotencyKey := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string - paymentRequestAuthParameters := *payment_request.NewPaymentRequestAuthParameters("AuthCode_example") // [OPTIONAL] | PaymentRequestAuthParameters + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + + paymentRequestParameters := *payment_request.NewPaymentRequestParameters(payment_request.PaymentRequestCurrency("IDR")) // [OPTIONAL] | PaymentRequestParameters xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentRequestApi.AuthorizePaymentRequest(context.Background(), paymentRequestId). - PaymentRequestAuthParameters(paymentRequestAuthParameters). // [OPTIONAL] + resp, r, err := xenditClient.PaymentRequestApi.CreatePaymentRequest(context.Background()). + IdempotencyKey(idempotencyKey). + ForUserId(forUserId). + PaymentRequestParameters(paymentRequestParameters). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PaymentRequestApi.AuthorizePaymentRequest``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `PaymentRequestApi.CreatePaymentRequest``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `AuthorizePaymentRequest`: PaymentRequest - fmt.Fprintf(os.Stdout, "Response from `PaymentRequestApi.AuthorizePaymentRequest`: %v\n", resp) + // response from `CreatePaymentRequest`: PaymentRequest + fmt.Fprintf(os.Stdout, "Response from `PaymentRequestApi.CreatePaymentRequest`: %v\n", resp) } ``` ### Path Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | -------------| -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | -| **paymentRequestId** | **string** | | | ### Other Parameters -Other parameters are passed through a pointer to a apiAuthorizePaymentRequestRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiCreatePaymentRequestRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| -| **paymentRequestAuthParameters** |[**PaymentRequestAuthParameters**](payment_request/PaymentRequestAuthParameters.md)| | | +| **idempotencyKey** |**string**| | | +| **forUserId** |**string**| | | +| **paymentRequestParameters** |[**PaymentRequestParameters**](payment_request/PaymentRequestParameters.md)| | | ### Return type @@ -89,9 +90,9 @@ Other parameters are passed through a pointer to a apiAuthorizePaymentRequestReq [[Back to README]](../README.md) -## CapturePaymentRequest +## GetPaymentRequestByID -Payment Request Capture +Get payment request by ID @@ -112,24 +113,24 @@ func main() { paymentRequestId := "pr-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string - captureParameters := *payment_request.NewCaptureParameters(float64(123)) // [OPTIONAL] | CaptureParameters + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentRequestApi.CapturePaymentRequest(context.Background(), paymentRequestId). - CaptureParameters(captureParameters). // [OPTIONAL] + resp, r, err := xenditClient.PaymentRequestApi.GetPaymentRequestByID(context.Background(), paymentRequestId). + ForUserId(forUserId). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PaymentRequestApi.CapturePaymentRequest``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `PaymentRequestApi.GetPaymentRequestByID``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `CapturePaymentRequest`: Capture - fmt.Fprintf(os.Stdout, "Response from `PaymentRequestApi.CapturePaymentRequest`: %v\n", resp) + // response from `GetPaymentRequestByID`: PaymentRequest + fmt.Fprintf(os.Stdout, "Response from `PaymentRequestApi.GetPaymentRequestByID`: %v\n", resp) } ``` @@ -143,30 +144,30 @@ func main() { ### Other Parameters -Other parameters are passed through a pointer to a apiCapturePaymentRequestRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiGetPaymentRequestByIDRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | -| **captureParameters** |[**CaptureParameters**](payment_request/CaptureParameters.md)| | | +| **forUserId** |**string**| | | ### Return type -[**Capture**](payment_request/Capture.md) +[**PaymentRequest**](payment_request/PaymentRequest.md) ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to README]](../README.md) -## CreatePaymentRequest +## GetPaymentRequestCaptures -Create Payment Request +Get Payment Request Capture @@ -185,51 +186,58 @@ import ( func main() { - idempotencyKey := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + paymentRequestId := "pr-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string - paymentRequestParameters := *payment_request.NewPaymentRequestParameters(payment_request.PaymentRequestCurrency("IDR")) // [OPTIONAL] | PaymentRequestParameters + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + + limit := int32(56) // [OPTIONAL] | int32 xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentRequestApi.CreatePaymentRequest(context.Background()). - IdempotencyKey(idempotencyKey). - PaymentRequestParameters(paymentRequestParameters). // [OPTIONAL] + resp, r, err := xenditClient.PaymentRequestApi.GetPaymentRequestCaptures(context.Background(), paymentRequestId). + ForUserId(forUserId). + Limit(limit). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PaymentRequestApi.CreatePaymentRequest``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `PaymentRequestApi.GetPaymentRequestCaptures``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `CreatePaymentRequest`: PaymentRequest - fmt.Fprintf(os.Stdout, "Response from `PaymentRequestApi.CreatePaymentRequest`: %v\n", resp) + // response from `GetPaymentRequestCaptures`: CaptureListResponse + fmt.Fprintf(os.Stdout, "Response from `PaymentRequestApi.GetPaymentRequestCaptures`: %v\n", resp) } ``` ### Path Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | -------------| +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | +| **paymentRequestId** | **string** | | | ### Other Parameters -Other parameters are passed through a pointer to a apiCreatePaymentRequestRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiGetPaymentRequestCapturesRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **idempotencyKey** |**string**| | | -| **paymentRequestParameters** |[**PaymentRequestParameters**](payment_request/PaymentRequestParameters.md)| | | +| +| **forUserId** |**string**| | | +| **limit** |**int32**| | | ### Return type -[**PaymentRequest**](payment_request/PaymentRequest.md) +[**CaptureListResponse**](payment_request/CaptureListResponse.md) ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) @@ -257,6 +265,8 @@ import ( func main() { + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + referenceId := []string{"Inner_example"} // [OPTIONAL] | []string id := []string{"Inner_example"} // [OPTIONAL] | []string @@ -272,6 +282,7 @@ func main() { xenditClient := xendit.NewClient("API-KEY") resp, r, err := xenditClient.PaymentRequestApi.GetAllPaymentRequests(context.Background()). + ForUserId(forUserId). ReferenceId(referenceId). Id(id). CustomerId(customerId). @@ -304,6 +315,7 @@ Other parameters are passed through a pointer to a apiGetAllPaymentRequestsReque | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | +| **forUserId** |**string**| | | | **referenceId** |**string[]**| | | | **id** |**string[]**| | | | **customerId** |**string[]**| | | @@ -324,9 +336,9 @@ Other parameters are passed through a pointer to a apiGetAllPaymentRequestsReque [[Back to README]](../README.md) -## GetPaymentRequestByID +## CapturePaymentRequest -Get payment request by ID +Payment Request Capture @@ -347,21 +359,27 @@ func main() { paymentRequestId := "pr-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + + captureParameters := *payment_request.NewCaptureParameters(float64(123)) // [OPTIONAL] | CaptureParameters + xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentRequestApi.GetPaymentRequestByID(context.Background(), paymentRequestId). // [OPTIONAL] + resp, r, err := xenditClient.PaymentRequestApi.CapturePaymentRequest(context.Background(), paymentRequestId). + ForUserId(forUserId). + CaptureParameters(captureParameters). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PaymentRequestApi.GetPaymentRequestByID``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `PaymentRequestApi.CapturePaymentRequest``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetPaymentRequestByID`: PaymentRequest - fmt.Fprintf(os.Stdout, "Response from `PaymentRequestApi.GetPaymentRequestByID`: %v\n", resp) + // response from `CapturePaymentRequest`: Capture + fmt.Fprintf(os.Stdout, "Response from `PaymentRequestApi.CapturePaymentRequest`: %v\n", resp) } ``` @@ -375,29 +393,31 @@ func main() { ### Other Parameters -Other parameters are passed through a pointer to a apiGetPaymentRequestByIDRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiCapturePaymentRequestRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | +| **forUserId** |**string**| | | +| **captureParameters** |[**CaptureParameters**](payment_request/CaptureParameters.md)| | | ### Return type -[**PaymentRequest**](payment_request/PaymentRequest.md) +[**Capture**](payment_request/Capture.md) ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to README]](../README.md) -## GetPaymentRequestCaptures +## AuthorizePaymentRequest -Get Payment Request Capture +Payment Request Authorize @@ -418,24 +438,27 @@ func main() { paymentRequestId := "pr-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string - limit := int32(56) // [OPTIONAL] | int32 + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + + paymentRequestAuthParameters := *payment_request.NewPaymentRequestAuthParameters("AuthCode_example") // [OPTIONAL] | PaymentRequestAuthParameters xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentRequestApi.GetPaymentRequestCaptures(context.Background(), paymentRequestId). - Limit(limit). // [OPTIONAL] + resp, r, err := xenditClient.PaymentRequestApi.AuthorizePaymentRequest(context.Background(), paymentRequestId). + ForUserId(forUserId). + PaymentRequestAuthParameters(paymentRequestAuthParameters). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PaymentRequestApi.GetPaymentRequestCaptures``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `PaymentRequestApi.AuthorizePaymentRequest``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetPaymentRequestCaptures`: CaptureListResponse - fmt.Fprintf(os.Stdout, "Response from `PaymentRequestApi.GetPaymentRequestCaptures`: %v\n", resp) + // response from `AuthorizePaymentRequest`: PaymentRequest + fmt.Fprintf(os.Stdout, "Response from `PaymentRequestApi.AuthorizePaymentRequest`: %v\n", resp) } ``` @@ -449,21 +472,22 @@ func main() { ### Other Parameters -Other parameters are passed through a pointer to a apiGetPaymentRequestCapturesRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiAuthorizePaymentRequestRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | -| **limit** |**int32**| | | +| **forUserId** |**string**| | | +| **paymentRequestAuthParameters** |[**PaymentRequestAuthParameters**](payment_request/PaymentRequestAuthParameters.md)| | | ### Return type -[**CaptureListResponse**](payment_request/CaptureListResponse.md) +[**PaymentRequest**](payment_request/PaymentRequest.md) ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) @@ -493,9 +517,12 @@ func main() { paymentRequestId := "pr-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PaymentRequestApi.ResendPaymentRequestAuth(context.Background(), paymentRequestId). // [OPTIONAL] + resp, r, err := xenditClient.PaymentRequestApi.ResendPaymentRequestAuth(context.Background(), paymentRequestId). + ForUserId(forUserId). // [OPTIONAL] Execute() if err != nil { @@ -527,6 +554,7 @@ Other parameters are passed through a pointer to a apiResendPaymentRequestAuthRe | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | +| **forUserId** |**string**| | | ### Return type diff --git a/docs/PayoutApi.md b/docs/PayoutApi.md index 15fd6173..4ce2fd59 100644 --- a/docs/PayoutApi.md +++ b/docs/PayoutApi.md @@ -4,84 +4,14 @@ All URIs are relative to *https://api.xendit.co* | Method | HTTP request | Description | | ------------- | ------------- | ------------- | -| [**CancelPayout**](PayoutApi.md#CancelPayout) | **Post** /v2/payouts/{id}/cancel | API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. | | [**CreatePayout**](PayoutApi.md#CreatePayout) | **Post** /v2/payouts | API to send money at scale to bank accounts & eWallets | | [**GetPayoutById**](PayoutApi.md#GetPayoutById) | **Get** /v2/payouts/{id} | API to fetch the current status, or details of the payout | | [**GetPayoutChannels**](PayoutApi.md#GetPayoutChannels) | **Get** /payouts_channels | API providing the current list of banks and e-wallets we support for payouts for both regions | | [**GetPayouts**](PayoutApi.md#GetPayouts) | **Get** /v2/payouts | API to retrieve all matching payouts with reference ID | +| [**CancelPayout**](PayoutApi.md#CancelPayout) | **Post** /v2/payouts/{id}/cancel | API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. | -## CancelPayout - -API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - xendit "github.com/xendit/xendit-go/v3" - payout "github.com/xendit/xendit-go/v3/payout" -) - -func main() { - - // Payout id returned from the response of /v2/payouts - id := "disb-7baa7335-a0b2-4678-bb8c-318c0167f332" // [REQUIRED] | string - - xenditClient := xendit.NewClient("API-KEY") - - resp, r, err := xenditClient.PayoutApi.CancelPayout(context.Background(), id). // [OPTIONAL] - Execute() - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `PayoutApi.CancelPayout``: %v\n", err.Error()) - - b, _ := json.Marshal(err.FullError()) - fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) - - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `CancelPayout`: GetPayouts200ResponseDataInner - fmt.Fprintf(os.Stdout, "Response from `PayoutApi.CancelPayout`: %v\n", resp) -} -``` - -### Path Parameters - - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | -------------| -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | -| **id** | **string** | Payout id returned from the response of /v2/payouts | | - -### Other Parameters - -Other parameters are passed through a pointer to a apiCancelPayoutRequest struct via the builder pattern - - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| - -### Return type - -[**GetPayouts200ResponseDataInner**](payout/GetPayouts200ResponseDataInner.md) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) -[[Back to README]](../README.md) - - ## CreatePayout API to send money at scale to bank accounts & eWallets @@ -108,7 +38,7 @@ func main() { // The sub-account user-id that you want to make this transaction for. This header // is only used if you have access to xenPlatform. See xenPlatform for more // information. - forUserId := "5dbf20d7c8eb0c0896f811b6" // [OPTIONAL] | string + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string createPayoutRequest := *payout.NewCreatePayoutRequest("DISB-001", "PH_BDO", *payout.NewDigitalPayoutChannelProperties("9999999999"), float32(15000.05), "PHP") // [OPTIONAL] | CreatePayoutRequest @@ -183,9 +113,15 @@ func main() { // Payout id returned from the response of /v2/payouts id := "disb-7baa7335-a0b2-4678-bb8c-318c0167f332" // [REQUIRED] | string + // The sub-account user-id that you want to make this transaction for. This header + // is only used if you have access to xenPlatform. See xenPlatform for more + // information. + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.PayoutApi.GetPayoutById(context.Background(), id). // [OPTIONAL] + resp, r, err := xenditClient.PayoutApi.GetPayoutById(context.Background(), id). + ForUserId(forUserId). // [OPTIONAL] Execute() if err != nil { @@ -217,6 +153,7 @@ Other parameters are passed through a pointer to a apiGetPayoutByIdRequest struc | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | +| **forUserId** |**string**| The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. | | ### Return type @@ -259,12 +196,18 @@ func main() { // Filter channels by channel code, prefixed by ISO-3166 country code channelCode := "ID_MANDIRI, PH_GCASH" // [OPTIONAL] | string + // The sub-account user-id that you want to make this transaction for. This header + // is only used if you have access to xenPlatform. See xenPlatform for more + // information. + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + xenditClient := xendit.NewClient("API-KEY") resp, r, err := xenditClient.PayoutApi.GetPayoutChannels(context.Background()). Currency(currency). ChannelCategory(channelCategory). - ChannelCode(channelCode). // [OPTIONAL] + ChannelCode(channelCode). + ForUserId(forUserId). // [OPTIONAL] Execute() if err != nil { @@ -294,6 +237,7 @@ Other parameters are passed through a pointer to a apiGetPayoutChannelsRequest s | **currency** |**string**| Filter channels by currency from ISO-4217 values | | | **channelCategory** |[**ChannelCategory[]**](payout/ChannelCategory.md)| Filter channels by category | | | **channelCode** |**string**| Filter channels by channel code, prefixed by ISO-3166 country code | | +| **forUserId** |**string**| The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. | | ### Return type @@ -339,13 +283,19 @@ func main() { // Used to fetch record before this payout unique id beforeId := "disb-7baa7335-a0b2-4678-bb8c-318c0167f332" // [OPTIONAL] | string + // The sub-account user-id that you want to make this transaction for. This header + // is only used if you have access to xenPlatform. See xenPlatform for more + // information. + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + xenditClient := xendit.NewClient("API-KEY") resp, r, err := xenditClient.PayoutApi.GetPayouts(context.Background()). ReferenceId(referenceId). Limit(limit). AfterId(afterId). - BeforeId(beforeId). // [OPTIONAL] + BeforeId(beforeId). + ForUserId(forUserId). // [OPTIONAL] Execute() if err != nil { @@ -376,6 +326,7 @@ Other parameters are passed through a pointer to a apiGetPayoutsRequest struct v | **limit** |**float32**| Number of records to fetch per API call | | | **afterId** |**string**| Used to fetch record after this payout unique id | | | **beforeId** |**string**| Used to fetch record before this payout unique id | | +| **forUserId** |**string**| The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. | | ### Return type @@ -389,3 +340,80 @@ Other parameters are passed through a pointer to a apiGetPayoutsRequest struct v [[Back to top]](#) [[Back to README]](../README.md) + +## CancelPayout + +API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + xendit "github.com/xendit/xendit-go/v3" + payout "github.com/xendit/xendit-go/v3/payout" +) + +func main() { + + // Payout id returned from the response of /v2/payouts + id := "disb-7baa7335-a0b2-4678-bb8c-318c0167f332" // [REQUIRED] | string + + // The sub-account user-id that you want to make this transaction for. This header + // is only used if you have access to xenPlatform. See xenPlatform for more + // information. + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + + xenditClient := xendit.NewClient("API-KEY") + + resp, r, err := xenditClient.PayoutApi.CancelPayout(context.Background(), id). + ForUserId(forUserId). // [OPTIONAL] + Execute() + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PayoutApi.CancelPayout``: %v\n", err.Error()) + + b, _ := json.Marshal(err.FullError()) + fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) + + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CancelPayout`: GetPayouts200ResponseDataInner + fmt.Fprintf(os.Stdout, "Response from `PayoutApi.CancelPayout`: %v\n", resp) +} +``` + +### Path Parameters + + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | -------------| +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | +| **id** | **string** | Payout id returned from the response of /v2/payouts | | + +### Other Parameters + +Other parameters are passed through a pointer to a apiCancelPayoutRequest struct via the builder pattern + + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| +| **forUserId** |**string**| The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. | | + +### Return type + +[**GetPayouts200ResponseDataInner**](payout/GetPayouts200ResponseDataInner.md) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) +[[Back to README]](../README.md) + diff --git a/docs/RefundApi.md b/docs/RefundApi.md index c0226c2a..2e0d591c 100644 --- a/docs/RefundApi.md +++ b/docs/RefundApi.md @@ -4,14 +4,14 @@ All URIs are relative to *https://api.xendit.co* | Method | HTTP request | Description | | ------------- | ------------- | ------------- | -| [**CancelRefund**](RefundApi.md#CancelRefund) | **Post** /refunds/{refundID}/cancel | | | [**CreateRefund**](RefundApi.md#CreateRefund) | **Post** /refunds | | -| [**GetAllRefunds**](RefundApi.md#GetAllRefunds) | **Get** /refunds/ | | | [**GetRefund**](RefundApi.md#GetRefund) | **Get** /refunds/{refundID} | | +| [**GetAllRefunds**](RefundApi.md#GetAllRefunds) | **Get** /refunds | | +| [**CancelRefund**](RefundApi.md#CancelRefund) | **Post** /refunds/{refundID}/cancel | | -## CancelRefund +## CreateRefund @@ -30,46 +30,47 @@ import ( func main() { - refundID := "rfd-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string - idempotencyKey := "9797b5a6-54ad-4511-80a4-ec451346808b" // [OPTIONAL] | string + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + + createRefund := *refund.NewCreateRefund() // [OPTIONAL] | CreateRefund + xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.RefundApi.CancelRefund(context.Background(), refundID). - IdempotencyKey(idempotencyKey). // [OPTIONAL] + resp, r, err := xenditClient.RefundApi.CreateRefund(context.Background()). + IdempotencyKey(idempotencyKey). + ForUserId(forUserId). + CreateRefund(createRefund). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `RefundApi.CancelRefund``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `RefundApi.CreateRefund``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `CancelRefund`: Refund - fmt.Fprintf(os.Stdout, "Response from `RefundApi.CancelRefund`: %v\n", resp) + // response from `CreateRefund`: Refund + fmt.Fprintf(os.Stdout, "Response from `RefundApi.CreateRefund`: %v\n", resp) } ``` ### Path Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | -------------| -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | -| **refundID** | **string** | | | ### Other Parameters -Other parameters are passed through a pointer to a apiCancelRefundRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiCreateRefundRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| | **idempotencyKey** |**string**| | | +| **forUserId** |**string**| | | +| **createRefund** |[**CreateRefund**](refund/CreateRefund.md)| | | ### Return type @@ -77,14 +78,14 @@ Other parameters are passed through a pointer to a apiCancelRefundRequest struct ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json [[Back to top]](#) [[Back to README]](../README.md) -## CreateRefund +## GetRefund @@ -103,43 +104,50 @@ import ( func main() { + refundID := "rfd-1fdaf346-dd2e-4b6c-b938-124c7167a822" // [REQUIRED] | string + idempotencyKey := "9797b5a6-54ad-4511-80a4-ec451346808b" // [OPTIONAL] | string - createRefund := *refund.NewCreateRefund() // [OPTIONAL] | CreateRefund + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.RefundApi.CreateRefund(context.Background()). + resp, r, err := xenditClient.RefundApi.GetRefund(context.Background(), refundID). IdempotencyKey(idempotencyKey). - CreateRefund(createRefund). // [OPTIONAL] + ForUserId(forUserId). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `RefundApi.CreateRefund``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `RefundApi.GetRefund``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `CreateRefund`: Refund - fmt.Fprintf(os.Stdout, "Response from `RefundApi.CreateRefund`: %v\n", resp) + // response from `GetRefund`: Refund + fmt.Fprintf(os.Stdout, "Response from `RefundApi.GetRefund`: %v\n", resp) } ``` ### Path Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | -------------| +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | +| **refundID** | **string** | | | ### Other Parameters -Other parameters are passed through a pointer to a apiCreateRefundRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiGetRefundRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | +| | **idempotencyKey** |**string**| | | -| **createRefund** |[**CreateRefund**](refund/CreateRefund.md)| | | +| **forUserId** |**string**| | | ### Return type @@ -147,7 +155,7 @@ Other parameters are passed through a pointer to a apiCreateRefundRequest struct ### HTTP request headers -- **Content-Type**: application/json +- **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) @@ -173,9 +181,33 @@ import ( func main() { + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + + paymentRequestId := "paymentRequestId_example" // [OPTIONAL] | string + + invoiceId := "invoiceId_example" // [OPTIONAL] | string + + paymentMethodType := "paymentMethodType_example" // [OPTIONAL] | string + + channelCode := "channelCode_example" // [OPTIONAL] | string + + limit := float32(8.14) // [OPTIONAL] | float32 + + afterId := "afterId_example" // [OPTIONAL] | string + + beforeId := "beforeId_example" // [OPTIONAL] | string + xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.RefundApi.GetAllRefunds(context.Background()). // [OPTIONAL] + resp, r, err := xenditClient.RefundApi.GetAllRefunds(context.Background()). + ForUserId(forUserId). + PaymentRequestId(paymentRequestId). + InvoiceId(invoiceId). + PaymentMethodType(paymentMethodType). + ChannelCode(channelCode). + Limit(limit). + AfterId(afterId). + BeforeId(beforeId). // [OPTIONAL] Execute() if err != nil { @@ -193,13 +225,24 @@ func main() { ### Path Parameters -This endpoint does not need any parameter. + ### Other Parameters Other parameters are passed through a pointer to a apiGetAllRefundsRequest struct via the builder pattern +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **forUserId** |**string**| | | +| **paymentRequestId** |**string**| | | +| **invoiceId** |**string**| | | +| **paymentMethodType** |**string**| | | +| **channelCode** |**string**| | | +| **limit** |**float32**| | | +| **afterId** |**string**| | | +| **beforeId** |**string**| | | + ### Return type [**RefundList**](refund/RefundList.md) @@ -213,7 +256,7 @@ Other parameters are passed through a pointer to a apiGetAllRefundsRequest struc [[Back to README]](../README.md) -## GetRefund +## CancelRefund @@ -236,22 +279,25 @@ func main() { idempotencyKey := "9797b5a6-54ad-4511-80a4-ec451346808b" // [OPTIONAL] | string + forUserId := "5f9a3fbd571a1c4068aa40ce" // [OPTIONAL] | string + xenditClient := xendit.NewClient("API-KEY") - resp, r, err := xenditClient.RefundApi.GetRefund(context.Background(), refundID). - IdempotencyKey(idempotencyKey). // [OPTIONAL] + resp, r, err := xenditClient.RefundApi.CancelRefund(context.Background(), refundID). + IdempotencyKey(idempotencyKey). + ForUserId(forUserId). // [OPTIONAL] Execute() if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `RefundApi.GetRefund``: %v\n", err.Error()) + fmt.Fprintf(os.Stderr, "Error when calling `RefundApi.CancelRefund``: %v\n", err.Error()) b, _ := json.Marshal(err.FullError()) fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetRefund`: Refund - fmt.Fprintf(os.Stdout, "Response from `RefundApi.GetRefund`: %v\n", resp) + // response from `CancelRefund`: Refund + fmt.Fprintf(os.Stdout, "Response from `RefundApi.CancelRefund`: %v\n", resp) } ``` @@ -265,13 +311,14 @@ func main() { ### Other Parameters -Other parameters are passed through a pointer to a apiGetRefundRequest struct via the builder pattern +Other parameters are passed through a pointer to a apiCancelRefundRequest struct via the builder pattern | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | | | **idempotencyKey** |**string**| | | +| **forUserId** |**string**| | | ### Return type diff --git a/docs/TransactionApi.md b/docs/TransactionApi.md index d3ab29c7..a137caef 100644 --- a/docs/TransactionApi.md +++ b/docs/TransactionApi.md @@ -4,9 +4,87 @@ All URIs are relative to *https://api.xendit.co* | Method | HTTP request | Description | | ------------- | ------------- | ------------- | -| [**GetAllTransactions**](TransactionApi.md#GetAllTransactions) | **Get** /transactions | Get a list of transactions | | [**GetTransactionByID**](TransactionApi.md#GetTransactionByID) | **Get** /transactions/{id} | Get a transaction based on its id | +| [**GetAllTransactions**](TransactionApi.md#GetAllTransactions) | **Get** /transactions | Get a list of transactions | + + + +## GetTransactionByID + +Get a transaction based on its id + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + xendit "github.com/xendit/xendit-go/v3" + balance_and_transaction "github.com/xendit/xendit-go/v3/balance_and_transaction" +) + +func main() { + + id := "id_example" // [REQUIRED] | string + + // The sub-account user-id that you want to make this transaction for. This header + // is only used if you have access to xenPlatform. See xenPlatform for more + // information + forUserId := "5dbf20d7c8eb0c0896f811b6" // [OPTIONAL] | string + + xenditClient := xendit.NewClient("API-KEY") + + resp, r, err := xenditClient.TransactionApi.GetTransactionByID(context.Background(), id). + ForUserId(forUserId). // [OPTIONAL] + Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TransactionApi.GetTransactionByID``: %v\n", err.Error()) + + b, _ := json.Marshal(err.FullError()) + fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) + + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetTransactionByID`: TransactionResponse + fmt.Fprintf(os.Stdout, "Response from `TransactionApi.GetTransactionByID`: %v\n", resp) +} +``` + +### Path Parameters + + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | -------------| +| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | +| **id** | **string** | | | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetTransactionByIDRequest struct via the builder pattern + + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| +| **forUserId** |**string**| The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information | | + +### Return type + +[**TransactionResponse**](balance_and_transaction/TransactionResponse.md) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) +[[Back to README]](../README.md) ## GetAllTransactions @@ -148,81 +226,3 @@ Other parameters are passed through a pointer to a apiGetAllTransactionsRequest [[Back to top]](#) [[Back to README]](../README.md) - -## GetTransactionByID - -Get a transaction based on its id - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - xendit "github.com/xendit/xendit-go/v3" - balance_and_transaction "github.com/xendit/xendit-go/v3/balance_and_transaction" -) - -func main() { - - id := "id_example" // [REQUIRED] | string - - // The sub-account user-id that you want to make this transaction for. This header - // is only used if you have access to xenPlatform. See xenPlatform for more - // information - forUserId := "5dbf20d7c8eb0c0896f811b6" // [OPTIONAL] | string - - xenditClient := xendit.NewClient("API-KEY") - - resp, r, err := xenditClient.TransactionApi.GetTransactionByID(context.Background(), id). - ForUserId(forUserId). // [OPTIONAL] - Execute() - - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `TransactionApi.GetTransactionByID``: %v\n", err.Error()) - - b, _ := json.Marshal(err.FullError()) - fmt.Fprintf(os.Stderr, "Full Error Struct: %v\n", string(b)) - - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GetTransactionByID`: TransactionResponse - fmt.Fprintf(os.Stdout, "Response from `TransactionApi.GetTransactionByID`: %v\n", resp) -} -``` - -### Path Parameters - - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | -------------| -| **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.| | -| **id** | **string** | | | - -### Other Parameters - -Other parameters are passed through a pointer to a apiGetTransactionByIDRequest struct via the builder pattern - - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| -| **forUserId** |**string**| The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information | | - -### Return type - -[**TransactionResponse**](balance_and_transaction/TransactionResponse.md) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) -[[Back to README]](../README.md) - diff --git a/docs/balance_and_transaction/ChannelsCategories.md b/docs/balance_and_transaction/ChannelsCategories.md index 99935add..08611dc0 100644 --- a/docs/balance_and_transaction/ChannelsCategories.md +++ b/docs/balance_and_transaction/ChannelsCategories.md @@ -31,6 +31,9 @@ * `OTHER` (value: `"OTHER"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/balance_and_transaction/Currency.md b/docs/balance_and_transaction/Currency.md index 0e0e1f29..dc183e1d 100644 --- a/docs/balance_and_transaction/Currency.md +++ b/docs/balance_and_transaction/Currency.md @@ -327,6 +327,9 @@ * `ZWD` (value: `"ZWD"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/balance_and_transaction/TransactionStatuses.md b/docs/balance_and_transaction/TransactionStatuses.md index bf6c50a1..713c58a6 100644 --- a/docs/balance_and_transaction/TransactionStatuses.md +++ b/docs/balance_and_transaction/TransactionStatuses.md @@ -13,6 +13,9 @@ * `VOIDED` (value: `"VOIDED"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/balance_and_transaction/TransactionTypes.md b/docs/balance_and_transaction/TransactionTypes.md index f97825b3..d3de1694 100644 --- a/docs/balance_and_transaction/TransactionTypes.md +++ b/docs/balance_and_transaction/TransactionTypes.md @@ -29,6 +29,9 @@ * `OTHER` (value: `"OTHER"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/customer.yaml b/docs/customer.yaml index b4703f39..6b450872 100644 --- a/docs/customer.yaml +++ b/docs/customer.yaml @@ -69,7 +69,7 @@ paths: - description: A unique key to prevent processing duplicate requests. explode: false in: header - name: IDEMPOTENCY-KEY + name: idempotency-key required: false schema: example: idempotency-123 diff --git a/docs/customer/AddressStatus.md b/docs/customer/AddressStatus.md index 93e890d0..f28c3499 100644 --- a/docs/customer/AddressStatus.md +++ b/docs/customer/AddressStatus.md @@ -7,6 +7,9 @@ * `DELETED` (value: `"DELETED"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/customer/EndCustomerStatus.md b/docs/customer/EndCustomerStatus.md index 7bd18956..1aa3f84b 100644 --- a/docs/customer/EndCustomerStatus.md +++ b/docs/customer/EndCustomerStatus.md @@ -13,6 +13,9 @@ * `DELETED` (value: `"DELETED"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/customer/IdentityAccountType.md b/docs/customer/IdentityAccountType.md index 48e83eed..a5b27d94 100644 --- a/docs/customer/IdentityAccountType.md +++ b/docs/customer/IdentityAccountType.md @@ -15,6 +15,9 @@ * `QR_CODE` (value: `"QR_CODE"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/customer/KYCDocumentSubType.md b/docs/customer/KYCDocumentSubType.md index 2ae5b2df..698365f3 100644 --- a/docs/customer/KYCDocumentSubType.md +++ b/docs/customer/KYCDocumentSubType.md @@ -23,6 +23,9 @@ * `OTHERS` (value: `"OTHERS"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/customer/KYCDocumentType.md b/docs/customer/KYCDocumentType.md index 9722f993..241aba09 100644 --- a/docs/customer/KYCDocumentType.md +++ b/docs/customer/KYCDocumentType.md @@ -19,6 +19,9 @@ * `BUSINESS_LICENSE` (value: `"BUSINESS_LICENSE"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/invoice.yaml b/docs/invoice.yaml index 4e497fb8..264e4b27 100644 --- a/docs/invoice.yaml +++ b/docs/invoice.yaml @@ -10,6 +10,16 @@ paths: /v2/invoices/: post: operationId: createInvoice + parameters: + - description: Business ID of the sub-account merchant (XP feature) + explode: false + in: header + name: for-user-id + required: false + schema: + example: 62efe4c33e45694d63f585f8 + type: string + style: simple requestBody: content: application/json: @@ -130,6 +140,15 @@ paths: get: operationId: getInvoiceById parameters: + - description: Business ID of the sub-account merchant (XP feature) + explode: false + in: header + name: for-user-id + required: false + schema: + example: 62efe4c33e45694d63f585f8 + type: string + style: simple - description: Invoice ID explode: false in: path @@ -185,6 +204,15 @@ paths: get: operationId: getInvoices parameters: + - description: Business ID of the sub-account merchant (XP feature) + explode: false + in: header + name: for-user-id + required: false + schema: + example: 62efe4c33e45694d63f585f8 + type: string + style: simple - explode: true in: query name: external_id @@ -343,6 +371,15 @@ paths: post: operationId: expireInvoice parameters: + - description: Business ID of the sub-account merchant (XP feature) + explode: false + in: header + name: for-user-id + required: false + schema: + example: 62efe4c33e45694d63f585f8 + type: string + style: simple - description: Invoice ID to be expired explode: false in: path @@ -510,6 +547,17 @@ components: value: error_code: INTERNAL_SERVER_ERROR message: Something unxpected happened. + parameters: + ForUserId: + description: Business ID of the sub-account merchant (XP feature) + explode: false + in: header + name: for-user-id + required: false + schema: + example: 62efe4c33e45694d63f585f8 + type: string + style: simple schemas: UnauthorizedError: description: An error object used to indicate unauthorized access to an invoice-related diff --git a/docs/invoice/BankCode.md b/docs/invoice/BankCode.md index 20e2039d..b94e7247 100644 --- a/docs/invoice/BankCode.md +++ b/docs/invoice/BankCode.md @@ -23,6 +23,9 @@ * `BNC` (value: `"BNC"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/invoice/DirectDebitType.md b/docs/invoice/DirectDebitType.md index 42bdfb0f..0d68c20d 100644 --- a/docs/invoice/DirectDebitType.md +++ b/docs/invoice/DirectDebitType.md @@ -41,6 +41,9 @@ * `DC_CHINABANK` (value: `"DC_CHINABANK"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/invoice/EwalletType.md b/docs/invoice/EwalletType.md index 6468f27a..363e0e38 100644 --- a/docs/invoice/EwalletType.md +++ b/docs/invoice/EwalletType.md @@ -23,6 +23,9 @@ * `JENIUSPAY` (value: `"JENIUSPAY"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/invoice/InvoiceClientType.md b/docs/invoice/InvoiceClientType.md index 7aea8262..694517a1 100644 --- a/docs/invoice/InvoiceClientType.md +++ b/docs/invoice/InvoiceClientType.md @@ -15,6 +15,9 @@ * `MOBILE` (value: `"MOBILE"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/invoice/InvoiceCurrency.md b/docs/invoice/InvoiceCurrency.md index bc13b949..0955bd6c 100644 --- a/docs/invoice/InvoiceCurrency.md +++ b/docs/invoice/InvoiceCurrency.md @@ -13,6 +13,9 @@ * `PHP` (value: `"PHP"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/invoice/InvoicePaymentMethod.md b/docs/invoice/InvoicePaymentMethod.md index 559f8647..0589b8cf 100644 --- a/docs/invoice/InvoicePaymentMethod.md +++ b/docs/invoice/InvoicePaymentMethod.md @@ -23,6 +23,9 @@ * `PAYLATER` (value: `"PAYLATER"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/invoice/InvoiceStatus.md b/docs/invoice/InvoiceStatus.md index 7c7605b6..2d672c00 100644 --- a/docs/invoice/InvoiceStatus.md +++ b/docs/invoice/InvoiceStatus.md @@ -11,6 +11,9 @@ * `EXPIRED` (value: `"EXPIRED"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/invoice/NotificationChannel.md b/docs/invoice/NotificationChannel.md index 0f3a2456..024a2e7e 100644 --- a/docs/invoice/NotificationChannel.md +++ b/docs/invoice/NotificationChannel.md @@ -11,6 +11,9 @@ * `VIBER` (value: `"viber"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/invoice/PaylaterType.md b/docs/invoice/PaylaterType.md index f9fbcf9e..bc7ca05c 100644 --- a/docs/invoice/PaylaterType.md +++ b/docs/invoice/PaylaterType.md @@ -15,6 +15,9 @@ * `ATOME` (value: `"ATOME"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/invoice/QrCodeType.md b/docs/invoice/QrCodeType.md index 753f75a8..8e3ef846 100644 --- a/docs/invoice/QrCodeType.md +++ b/docs/invoice/QrCodeType.md @@ -7,6 +7,9 @@ * `PROMPTPAY` (value: `"PROMPTPAY"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/invoice/RetailOutletName.md b/docs/invoice/RetailOutletName.md index 85e166a5..35214c65 100644 --- a/docs/invoice/RetailOutletName.md +++ b/docs/invoice/RetailOutletName.md @@ -21,6 +21,9 @@ * `LBC` (value: `"LBC"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_method.yaml b/docs/payment_method.yaml index 9488fd9a..a0f6c106 100644 --- a/docs/payment_method.yaml +++ b/docs/payment_method.yaml @@ -2,7 +2,7 @@ openapi: 3.0.0 info: description: This API is used for Payment Method Service v2 title: Payment Method Service v2 - version: 2.89.1 + version: 2.89.2 servers: - description: Xendit API Server url: https://api.xendit.co @@ -12,6 +12,14 @@ paths: description: Get all payment methods by filters operationId: getAllPaymentMethods parameters: + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple - explode: true in: query name: id @@ -119,6 +127,15 @@ paths: post: description: This endpoint initiates creation of payment method operationId: createPaymentMethod + parameters: + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple requestBody: content: application/json: @@ -219,6 +236,14 @@ paths: example: pm-1fdaf346-dd2e-4b6c-b938-124c7167a822 type: string style: simple + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple responses: "200": content: @@ -255,8 +280,8 @@ paths: - payment_method patch: description: This endpoint is used to toggle the ```status``` of an e-Wallet - or a Direct Debit payment method to ```ACTIVE``` or ```INACTIVE```. This - is also used to update the details of an Over-the-Counter or a Virtual Account + or a Direct Debit payment method to ```ACTIVE``` or ```INACTIVE```. This is + also used to update the details of an Over-the-Counter or a Virtual Account payment method. operationId: patchPaymentMethod parameters: @@ -268,6 +293,14 @@ paths: example: pm-1fdaf346-dd2e-4b6c-b938-124c7167a822 type: string style: simple + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple requestBody: content: application/json: @@ -321,6 +354,14 @@ paths: example: pm-1fdaf346-dd2e-4b6c-b938-124c7167a822 type: string style: simple + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple requestBody: content: application/json: @@ -379,6 +420,14 @@ paths: example: pm-1fdaf346-dd2e-4b6c-b938-124c7167a822 type: string style: simple + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple requestBody: content: application/json: @@ -443,6 +492,14 @@ paths: example: pm-1fdaf346-dd2e-4b6c-b938-124c7167a822 type: string style: simple + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple - explode: true in: query name: payment_request_id @@ -637,6 +694,15 @@ paths: - payment_method components: parameters: + ForUserId: + explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple PaymentMethodID: explode: false in: path diff --git a/docs/payment_method/DirectDebitChannelCode.md b/docs/payment_method/DirectDebitChannelCode.md index 098db8e1..259da477 100644 --- a/docs/payment_method/DirectDebitChannelCode.md +++ b/docs/payment_method/DirectDebitChannelCode.md @@ -129,6 +129,9 @@ * `UOB_FPX_BUSINESS` (value: `"UOB_FPX_BUSINESS"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_method/DirectDebitType.md b/docs/payment_method/DirectDebitType.md index e307caa2..71b174c0 100644 --- a/docs/payment_method/DirectDebitType.md +++ b/docs/payment_method/DirectDebitType.md @@ -9,6 +9,9 @@ * `BANK_REDIRECT` (value: `"BANK_REDIRECT"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_method/EWalletChannelCode.md b/docs/payment_method/EWalletChannelCode.md index f5f921e6..6ef2d22f 100644 --- a/docs/payment_method/EWalletChannelCode.md +++ b/docs/payment_method/EWalletChannelCode.md @@ -43,6 +43,9 @@ * `ALIPAY` (value: `"ALIPAY"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_method/OverTheCounterChannelCode.md b/docs/payment_method/OverTheCounterChannelCode.md index 340f17cc..d581279d 100644 --- a/docs/payment_method/OverTheCounterChannelCode.md +++ b/docs/payment_method/OverTheCounterChannelCode.md @@ -35,6 +35,9 @@ * `INDOMARET` (value: `"INDOMARET"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_method/PaymentMethodCountry.md b/docs/payment_method/PaymentMethodCountry.md index 385d02a8..f6890d35 100644 --- a/docs/payment_method/PaymentMethodCountry.md +++ b/docs/payment_method/PaymentMethodCountry.md @@ -13,6 +13,9 @@ * `MY` (value: `"MY"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_method/PaymentMethodReusability.md b/docs/payment_method/PaymentMethodReusability.md index b1184bbf..22157bdb 100644 --- a/docs/payment_method/PaymentMethodReusability.md +++ b/docs/payment_method/PaymentMethodReusability.md @@ -7,6 +7,9 @@ * `ONE_TIME_USE` (value: `"ONE_TIME_USE"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_method/PaymentMethodStatus.md b/docs/payment_method/PaymentMethodStatus.md index 3ecec1b0..419179f3 100644 --- a/docs/payment_method/PaymentMethodStatus.md +++ b/docs/payment_method/PaymentMethodStatus.md @@ -15,6 +15,9 @@ * `FAILED` (value: `"FAILED"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_method/PaymentMethodType.md b/docs/payment_method/PaymentMethodType.md index 0b5c0f48..eb1e28de 100644 --- a/docs/payment_method/PaymentMethodType.md +++ b/docs/payment_method/PaymentMethodType.md @@ -19,6 +19,9 @@ * `VIRTUAL_ACCOUNT` (value: `"VIRTUAL_ACCOUNT"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_method/QRCodeChannelCode.md b/docs/payment_method/QRCodeChannelCode.md index 3db29275..908693d3 100644 --- a/docs/payment_method/QRCodeChannelCode.md +++ b/docs/payment_method/QRCodeChannelCode.md @@ -13,6 +13,9 @@ * `LINKAJA` (value: `"LINKAJA"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_method/VirtualAccountChannelCode.md b/docs/payment_method/VirtualAccountChannelCode.md index 5fabe29e..2a89dc13 100644 --- a/docs/payment_method/VirtualAccountChannelCode.md +++ b/docs/payment_method/VirtualAccountChannelCode.md @@ -33,6 +33,9 @@ * `STANDARD_CHARTERED` (value: `"STANDARD_CHARTERED"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request.yaml b/docs/payment_request.yaml index e117701e..f247ce2b 100644 --- a/docs/payment_request.yaml +++ b/docs/payment_request.yaml @@ -12,6 +12,14 @@ paths: description: Get all payment requests by filter operationId: getAllPaymentRequests parameters: + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple - explode: true in: query name: reference_id @@ -100,6 +108,14 @@ paths: example: 5f9a3fbd571a1c4068aa40ce type: string style: simple + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple requestBody: content: application/json: @@ -203,6 +219,14 @@ paths: description: Get payment request by ID operationId: getPaymentRequestByID parameters: + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple - explode: false in: path name: paymentRequestId @@ -244,6 +268,14 @@ paths: description: Payment Request Authorize operationId: authorizePaymentRequest parameters: + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple - explode: false in: path name: paymentRequestId @@ -290,6 +322,14 @@ paths: description: Payment Request Resend Auth operationId: resendPaymentRequestAuth parameters: + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple - explode: false in: path name: paymentRequestId @@ -331,6 +371,14 @@ paths: description: Get Payment Request Capture operationId: getPaymentRequestCaptures parameters: + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple - explode: false in: path name: paymentRequestId @@ -378,6 +426,14 @@ paths: description: Payment Request Capture operationId: capturePaymentRequest parameters: + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple - explode: false in: path name: paymentRequestId @@ -421,6 +477,15 @@ paths: - payment_request components: parameters: + ForUserId: + explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple IdempotencyKey: explode: false in: header diff --git a/docs/payment_request/DirectDebitChannelCode.md b/docs/payment_request/DirectDebitChannelCode.md index 8dc0f88d..9477a335 100644 --- a/docs/payment_request/DirectDebitChannelCode.md +++ b/docs/payment_request/DirectDebitChannelCode.md @@ -129,6 +129,9 @@ * `UOB_FPX_BUSINESS` (value: `"UOB_FPX_BUSINESS"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/DirectDebitType.md b/docs/payment_request/DirectDebitType.md index e307caa2..71b174c0 100644 --- a/docs/payment_request/DirectDebitType.md +++ b/docs/payment_request/DirectDebitType.md @@ -9,6 +9,9 @@ * `BANK_REDIRECT` (value: `"BANK_REDIRECT"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/EWalletChannelCode.md b/docs/payment_request/EWalletChannelCode.md index e0ac2e3f..c6f67fd6 100644 --- a/docs/payment_request/EWalletChannelCode.md +++ b/docs/payment_request/EWalletChannelCode.md @@ -41,6 +41,9 @@ * `ALIPAY` (value: `"ALIPAY"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/OverTheCounterChannelCode.md b/docs/payment_request/OverTheCounterChannelCode.md index 340f17cc..d581279d 100644 --- a/docs/payment_request/OverTheCounterChannelCode.md +++ b/docs/payment_request/OverTheCounterChannelCode.md @@ -35,6 +35,9 @@ * `INDOMARET` (value: `"INDOMARET"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/PaymentMethodReusability.md b/docs/payment_request/PaymentMethodReusability.md index b1184bbf..22157bdb 100644 --- a/docs/payment_request/PaymentMethodReusability.md +++ b/docs/payment_request/PaymentMethodReusability.md @@ -7,6 +7,9 @@ * `ONE_TIME_USE` (value: `"ONE_TIME_USE"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/PaymentMethodStatus.md b/docs/payment_request/PaymentMethodStatus.md index 07c0b3b9..0c5f91a4 100644 --- a/docs/payment_request/PaymentMethodStatus.md +++ b/docs/payment_request/PaymentMethodStatus.md @@ -13,6 +13,9 @@ * `FAILED` (value: `"FAILED"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/PaymentMethodType.md b/docs/payment_request/PaymentMethodType.md index a439adca..cd5b779d 100644 --- a/docs/payment_request/PaymentMethodType.md +++ b/docs/payment_request/PaymentMethodType.md @@ -15,6 +15,9 @@ * `VIRTUAL_ACCOUNT` (value: `"VIRTUAL_ACCOUNT"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/PaymentRequestCaptureMethod.md b/docs/payment_request/PaymentRequestCaptureMethod.md index adf3fede..1c28b0d3 100644 --- a/docs/payment_request/PaymentRequestCaptureMethod.md +++ b/docs/payment_request/PaymentRequestCaptureMethod.md @@ -7,6 +7,9 @@ * `MANUAL` (value: `"MANUAL"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/PaymentRequestCountry.md b/docs/payment_request/PaymentRequestCountry.md index 505c216e..16748792 100644 --- a/docs/payment_request/PaymentRequestCountry.md +++ b/docs/payment_request/PaymentRequestCountry.md @@ -13,6 +13,9 @@ * `MY` (value: `"MY"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/PaymentRequestCurrency.md b/docs/payment_request/PaymentRequestCurrency.md index 046b84c7..5b7f146d 100644 --- a/docs/payment_request/PaymentRequestCurrency.md +++ b/docs/payment_request/PaymentRequestCurrency.md @@ -13,6 +13,9 @@ * `MYR` (value: `"MYR"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/PaymentRequestInitiator.md b/docs/payment_request/PaymentRequestInitiator.md index 1210b6f1..9aea5e47 100644 --- a/docs/payment_request/PaymentRequestInitiator.md +++ b/docs/payment_request/PaymentRequestInitiator.md @@ -7,6 +7,9 @@ * `MERCHANT` (value: `"MERCHANT"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/PaymentRequestStatus.md b/docs/payment_request/PaymentRequestStatus.md index f5d966e2..d19501f7 100644 --- a/docs/payment_request/PaymentRequestStatus.md +++ b/docs/payment_request/PaymentRequestStatus.md @@ -19,6 +19,9 @@ * `AWAITING_CAPTURE` (value: `"AWAITING_CAPTURE"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/QRCodeChannelCode.md b/docs/payment_request/QRCodeChannelCode.md index decded15..750efa77 100644 --- a/docs/payment_request/QRCodeChannelCode.md +++ b/docs/payment_request/QRCodeChannelCode.md @@ -11,6 +11,9 @@ * `PROMPTPAY` (value: `"PROMPTPAY"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payment_request/VirtualAccountChannelCode.md b/docs/payment_request/VirtualAccountChannelCode.md index 5fabe29e..2a89dc13 100644 --- a/docs/payment_request/VirtualAccountChannelCode.md +++ b/docs/payment_request/VirtualAccountChannelCode.md @@ -33,6 +33,9 @@ * `STANDARD_CHARTERED` (value: `"STANDARD_CHARTERED"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payout.yaml b/docs/payout.yaml index 4a9ae100..1263c1b8 100644 --- a/docs/payout.yaml +++ b/docs/payout.yaml @@ -57,6 +57,17 @@ paths: example: disb-7baa7335-a0b2-4678-bb8c-318c0167f332 type: string style: form + - description: The sub-account user-id that you want to make this transaction + for. This header is only used if you have access to xenPlatform. See xenPlatform + for more information. + explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple responses: "200": content: @@ -137,7 +148,7 @@ paths: name: for-user-id required: false schema: - example: 5dbf20d7c8eb0c0896f811b6 + example: 5f9a3fbd571a1c4068aa40ce type: string style: simple requestBody: @@ -280,6 +291,17 @@ paths: example: disb-7baa7335-a0b2-4678-bb8c-318c0167f332 type: string style: simple + - description: The sub-account user-id that you want to make this transaction + for. This header is only used if you have access to xenPlatform. See xenPlatform + for more information. + explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple responses: "200": content: @@ -388,6 +410,17 @@ paths: example: "ID_MANDIRI, PH_GCASH" type: string style: form + - description: The sub-account user-id that you want to make this transaction + for. This header is only used if you have access to xenPlatform. See xenPlatform + for more information. + explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple responses: "200": content: @@ -438,6 +471,17 @@ paths: example: disb-7baa7335-a0b2-4678-bb8c-318c0167f332 type: string style: simple + - description: The sub-account user-id that you want to make this transaction + for. This header is only used if you have access to xenPlatform. See xenPlatform + for more information. + explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple responses: "200": content: @@ -505,6 +549,19 @@ paths: tags: - payout components: + parameters: + ForUserIdHeader: + description: The sub-account user-id that you want to make this transaction + for. This header is only used if you have access to xenPlatform. See xenPlatform + for more information. + explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple schemas: ReceiptNotification: description: Additional notification for completed payout diff --git a/docs/payout/ChannelAccountType.md b/docs/payout/ChannelAccountType.md index b02e75f3..bdb53cea 100644 --- a/docs/payout/ChannelAccountType.md +++ b/docs/payout/ChannelAccountType.md @@ -13,6 +13,9 @@ * `BANK_ACCOUNT` (value: `"BANK_ACCOUNT"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/payout/ChannelCategory.md b/docs/payout/ChannelCategory.md index 2c851158..0110aab1 100644 --- a/docs/payout/ChannelCategory.md +++ b/docs/payout/ChannelCategory.md @@ -9,6 +9,9 @@ * `OTC` (value: `"OTC"`) +* `XENDIT_ENUM_DEFAULT_FALLBACK` (value: `UNKNOWN_ENUM_VALUE`) + +If you encounter `UNKNOWN_ENUM_VALUE`, it means that this ENUM is unavailable in your current SDK version. Please upgrade to get the newest ENUM. [[Back to README]](../../README.md) diff --git a/docs/refund.yaml b/docs/refund.yaml index 93d8e420..cb698a39 100644 --- a/docs/refund.yaml +++ b/docs/refund.yaml @@ -2,12 +2,87 @@ openapi: 3.0.0 info: description: This API is used for the unified refund service title: Refund Service - version: 1.2.3 + version: 1.3.3 servers: - description: Xendit API Server url: https://api.xendit.co paths: /refunds: + get: + operationId: getAllRefunds + parameters: + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple + - explode: true + in: query + name: payment_request_id + required: false + schema: + type: string + style: form + - explode: true + in: query + name: invoice_id + required: false + schema: + type: string + style: form + - explode: true + in: query + name: payment_method_type + required: false + schema: + type: string + style: form + - explode: true + in: query + name: channel_code + required: false + schema: + type: string + style: form + - explode: true + in: query + name: limit + required: false + schema: + type: number + style: form + - explode: true + in: query + name: after_id + required: false + schema: + type: string + style: form + - explode: true + in: query + name: before_id + required: false + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/RefundList' + description: OK + default: + content: + application/json: + schema: + $ref: '#/components/schemas/getAllRefunds_default_response' + description: Internal server error + tags: + - refund post: operationId: createRefund parameters: @@ -19,6 +94,14 @@ paths: example: 9797b5a6-54ad-4511-80a4-ec451346808b type: string style: simple + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple requestBody: content: application/json: @@ -65,7 +148,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/createRefund_default_response' + $ref: '#/components/schemas/getAllRefunds_default_response' description: Internal server error tags: - refund @@ -89,6 +172,14 @@ paths: example: 9797b5a6-54ad-4511-80a4-ec451346808b type: string style: simple + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple responses: "200": content: @@ -100,7 +191,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/createRefund_default_response' + $ref: '#/components/schemas/getAllRefunds_default_response' description: Internal server error tags: - refund @@ -124,6 +215,14 @@ paths: example: 9797b5a6-54ad-4511-80a4-ec451346808b type: string style: simple + - explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple responses: "200": content: @@ -153,25 +252,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/createRefund_default_response' - description: Internal server error - tags: - - refund - /refunds/: - get: - operationId: getAllRefunds - responses: - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/RefundList' - description: OK - default: - content: - application/json: - schema: - $ref: '#/components/schemas/createRefund_default_response' + $ref: '#/components/schemas/getAllRefunds_default_response' description: Internal server error tags: - refund @@ -195,12 +276,21 @@ components: example: 9797b5a6-54ad-4511-80a4-ec451346808b type: string style: simple + ForUserId: + explode: false + in: header + name: for-user-id + required: false + schema: + example: 5f9a3fbd571a1c4068aa40ce + type: string + style: simple responses: InternalServerError: content: application/json: schema: - $ref: '#/components/schemas/createRefund_default_response' + $ref: '#/components/schemas/getAllRefunds_default_response' description: Internal server error StatusBadRequest: content: @@ -399,6 +489,19 @@ components: nullable: true type: object type: object + getAllRefunds_default_response: + example: + error_code: SERVER_ERROR + message: An unexpected error occured. Our team has been notified and will + troubleshoot the issue. + properties: + error_code: + type: string + message: + example: An unexpected error occured. Our team has been notified and will + troubleshoot the issue. + type: string + type: object createRefund_400_response: properties: error_code: @@ -464,16 +567,3 @@ components: issues. type: string type: object - createRefund_default_response: - example: - error_code: SERVER_ERROR - message: An unexpected error occured. Our team has been notified and will - troubleshoot the issue. - properties: - error_code: - type: string - message: - example: An unexpected error occured. Our team has been notified and will - troubleshoot the issue. - type: string - type: object diff --git a/docs/refund/CreateRefundDefaultResponse.md b/docs/refund/GetAllRefundsDefaultResponse.md similarity index 59% rename from docs/refund/CreateRefundDefaultResponse.md rename to docs/refund/GetAllRefundsDefaultResponse.md index da1d923a..31f32bc6 100644 --- a/docs/refund/CreateRefundDefaultResponse.md +++ b/docs/refund/GetAllRefundsDefaultResponse.md @@ -1,4 +1,4 @@ -# CreateRefundDefaultResponse +# GetAllRefundsDefaultResponse ## Properties @@ -9,70 +9,70 @@ ## Methods -### NewCreateRefundDefaultResponse +### NewGetAllRefundsDefaultResponse -`func NewCreateRefundDefaultResponse() *CreateRefundDefaultResponse` +`func NewGetAllRefundsDefaultResponse() *GetAllRefundsDefaultResponse` -NewCreateRefundDefaultResponse instantiates a new CreateRefundDefaultResponse object +NewGetAllRefundsDefaultResponse instantiates a new GetAllRefundsDefaultResponse 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 -### NewCreateRefundDefaultResponseWithDefaults +### NewGetAllRefundsDefaultResponseWithDefaults -`func NewCreateRefundDefaultResponseWithDefaults() *CreateRefundDefaultResponse` +`func NewGetAllRefundsDefaultResponseWithDefaults() *GetAllRefundsDefaultResponse` -NewCreateRefundDefaultResponseWithDefaults instantiates a new CreateRefundDefaultResponse object +NewGetAllRefundsDefaultResponseWithDefaults instantiates a new GetAllRefundsDefaultResponse 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 ### GetErrorCode -`func (o *CreateRefundDefaultResponse) GetErrorCode() string` +`func (o *GetAllRefundsDefaultResponse) GetErrorCode() string` GetErrorCode returns the ErrorCode field if non-nil, zero value otherwise. ### GetErrorCodeOk -`func (o *CreateRefundDefaultResponse) GetErrorCodeOk() (*string, bool)` +`func (o *GetAllRefundsDefaultResponse) GetErrorCodeOk() (*string, bool)` GetErrorCodeOk returns a tuple with the ErrorCode field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetErrorCode -`func (o *CreateRefundDefaultResponse) SetErrorCode(v string)` +`func (o *GetAllRefundsDefaultResponse) SetErrorCode(v string)` SetErrorCode sets ErrorCode field to given value. ### HasErrorCode -`func (o *CreateRefundDefaultResponse) HasErrorCode() bool` +`func (o *GetAllRefundsDefaultResponse) HasErrorCode() bool` HasErrorCode returns a boolean if a field has been set. ### GetMessage -`func (o *CreateRefundDefaultResponse) GetMessage() string` +`func (o *GetAllRefundsDefaultResponse) GetMessage() string` GetMessage returns the Message field if non-nil, zero value otherwise. ### GetMessageOk -`func (o *CreateRefundDefaultResponse) GetMessageOk() (*string, bool)` +`func (o *GetAllRefundsDefaultResponse) GetMessageOk() (*string, bool)` GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetMessage -`func (o *CreateRefundDefaultResponse) SetMessage(v string)` +`func (o *GetAllRefundsDefaultResponse) SetMessage(v string)` SetMessage sets Message field to given value. ### HasMessage -`func (o *CreateRefundDefaultResponse) HasMessage() bool` +`func (o *GetAllRefundsDefaultResponse) HasMessage() bool` HasMessage returns a boolean if a field has been set. diff --git a/invoice/api_invoice.go b/invoice/api_invoice.go index e08cdd24..e12d3c5b 100644 --- a/invoice/api_invoice.go +++ b/invoice/api_invoice.go @@ -30,19 +30,6 @@ type InvoiceApi interface { // @return Invoice CreateInvoiceExecute(r ApiCreateInvoiceRequest) (*Invoice, *http.Response, *common.XenditSdkError) - /* - ExpireInvoice Manually expire an invoice - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param invoiceId Invoice ID to be expired - @return ApiExpireInvoiceRequest - */ - ExpireInvoice(ctx context.Context, invoiceId string) ApiExpireInvoiceRequest - - // ExpireInvoiceExecute executes the request - // @return Invoice - ExpireInvoiceExecute(r ApiExpireInvoiceRequest) (*Invoice, *http.Response, *common.XenditSdkError) - /* GetInvoiceById Get invoice by invoice id @@ -67,6 +54,19 @@ type InvoiceApi interface { // GetInvoicesExecute executes the request // @return []Invoice GetInvoicesExecute(r ApiGetInvoicesRequest) ([]Invoice, *http.Response, *common.XenditSdkError) + + /* + ExpireInvoice Manually expire an invoice + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param invoiceId Invoice ID to be expired + @return ApiExpireInvoiceRequest + */ + ExpireInvoice(ctx context.Context, invoiceId string) ApiExpireInvoiceRequest + + // ExpireInvoiceExecute executes the request + // @return Invoice + ExpireInvoiceExecute(r ApiExpireInvoiceRequest) (*Invoice, *http.Response, *common.XenditSdkError) } // InvoiceApiService InvoiceApi service @@ -86,6 +86,7 @@ type ApiCreateInvoiceRequest struct { ctx context.Context ApiService InvoiceApi createInvoiceRequest *CreateInvoiceRequest + forUserId *string } func (r ApiCreateInvoiceRequest) CreateInvoiceRequest(createInvoiceRequest CreateInvoiceRequest) ApiCreateInvoiceRequest { @@ -93,6 +94,12 @@ func (r ApiCreateInvoiceRequest) CreateInvoiceRequest(createInvoiceRequest Creat return r } +// Business ID of the sub-account merchant (XP feature) +func (r ApiCreateInvoiceRequest) ForUserId(forUserId string) ApiCreateInvoiceRequest { + r.forUserId = &forUserId + return r +} + func (r ApiCreateInvoiceRequest) Execute() (*Invoice, *http.Response, *common.XenditSdkError) { return r.ApiService.CreateInvoiceExecute(r) } @@ -151,6 +158,9 @@ func (a *InvoiceApiService) CreateInvoiceExecute(r ApiCreateInvoiceRequest) (*In if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } // body params localVarPostBody = r.createInvoiceRequest req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) @@ -175,96 +185,17 @@ func (a *InvoiceApiService) CreateInvoiceExecute(r ApiCreateInvoiceRequest) (*In return localVarReturnValue, localVarHTTPResponse, nil } -type ApiExpireInvoiceRequest struct { +type ApiGetInvoiceByIdRequest struct { ctx context.Context ApiService InvoiceApi invoiceId string + forUserId *string } -func (r ApiExpireInvoiceRequest) Execute() (*Invoice, *http.Response, *common.XenditSdkError) { - return r.ApiService.ExpireInvoiceExecute(r) -} - -/* -ExpireInvoice Manually expire an invoice - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param invoiceId Invoice ID to be expired - @return ApiExpireInvoiceRequest -*/ -func (a *InvoiceApiService) ExpireInvoice(ctx context.Context, invoiceId string) ApiExpireInvoiceRequest { - return ApiExpireInvoiceRequest{ - ApiService: a, - ctx: ctx, - invoiceId: invoiceId, - } -} - -// Execute executes the request -// @return Invoice -func (a *InvoiceApiService) ExpireInvoiceExecute(r ApiExpireInvoiceRequest) (*Invoice, *http.Response, *common.XenditSdkError) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []common.FormFile - localVarReturnValue *Invoice - ) - - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "InvoiceApiService.ExpireInvoice") - if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: InvoiceApiService.ExpireInvoiceExecute") - } - - localVarPath := localBasePath + "/invoices/{invoice_id}/expire!" - localVarPath = strings.Replace(localVarPath, "{"+"invoice_id"+"}", url.PathEscape(utils.ParameterValueToString(r.invoiceId, "invoiceId")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := utils.SelectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: InvoiceApiService.ExpireInvoiceExecute") - } - - localVarHTTPResponse, err := a.client.CallAPI(req) - - localVarBody, _ := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - - err = a.client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - - if err != nil || localVarHTTPResponse.StatusCode < 200 || localVarHTTPResponse.StatusCode >= 300 { - xenditSdkError := common.NewXenditSdkError(&localVarBody, strconv.Itoa(localVarHTTPResponse.StatusCode), localVarHTTPResponse.Status) - - return localVarReturnValue, localVarHTTPResponse, xenditSdkError - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiGetInvoiceByIdRequest struct { - ctx context.Context - ApiService InvoiceApi - invoiceId string +// Business ID of the sub-account merchant (XP feature) +func (r ApiGetInvoiceByIdRequest) ForUserId(forUserId string) ApiGetInvoiceByIdRequest { + r.forUserId = &forUserId + return r } func (r ApiGetInvoiceByIdRequest) Execute() (*Invoice, *http.Response, *common.XenditSdkError) { @@ -325,6 +256,9 @@ func (a *InvoiceApiService) GetInvoiceByIdExecute(r ApiGetInvoiceByIdRequest) (* if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: InvoiceApiService.GetInvoiceByIdExecute") @@ -350,6 +284,7 @@ func (a *InvoiceApiService) GetInvoiceByIdExecute(r ApiGetInvoiceByIdRequest) (* type ApiGetInvoicesRequest struct { ctx context.Context ApiService InvoiceApi + forUserId *string externalId *string statuses *[]InvoiceStatus limit *float32 @@ -366,6 +301,12 @@ type ApiGetInvoicesRequest struct { recurringPaymentId *string } +// Business ID of the sub-account merchant (XP feature) +func (r ApiGetInvoicesRequest) ForUserId(forUserId string) ApiGetInvoicesRequest { + r.forUserId = &forUserId + return r +} + func (r ApiGetInvoicesRequest) ExternalId(externalId string) ApiGetInvoicesRequest { r.externalId = &externalId return r @@ -557,6 +498,9 @@ func (a *InvoiceApiService) GetInvoicesExecute(r ApiGetInvoicesRequest) ([]Invoi if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: InvoiceApiService.GetInvoicesExecute") @@ -578,3 +522,99 @@ func (a *InvoiceApiService) GetInvoicesExecute(r ApiGetInvoicesRequest) ([]Invoi return localVarReturnValue, localVarHTTPResponse, nil } + +type ApiExpireInvoiceRequest struct { + ctx context.Context + ApiService InvoiceApi + invoiceId string + forUserId *string +} + +// Business ID of the sub-account merchant (XP feature) +func (r ApiExpireInvoiceRequest) ForUserId(forUserId string) ApiExpireInvoiceRequest { + r.forUserId = &forUserId + return r +} + +func (r ApiExpireInvoiceRequest) Execute() (*Invoice, *http.Response, *common.XenditSdkError) { + return r.ApiService.ExpireInvoiceExecute(r) +} + +/* +ExpireInvoice Manually expire an invoice + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param invoiceId Invoice ID to be expired + @return ApiExpireInvoiceRequest +*/ +func (a *InvoiceApiService) ExpireInvoice(ctx context.Context, invoiceId string) ApiExpireInvoiceRequest { + return ApiExpireInvoiceRequest{ + ApiService: a, + ctx: ctx, + invoiceId: invoiceId, + } +} + +// Execute executes the request +// @return Invoice +func (a *InvoiceApiService) ExpireInvoiceExecute(r ApiExpireInvoiceRequest) (*Invoice, *http.Response, *common.XenditSdkError) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []common.FormFile + localVarReturnValue *Invoice + ) + + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "InvoiceApiService.ExpireInvoice") + if err != nil { + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: InvoiceApiService.ExpireInvoiceExecute") + } + + localVarPath := localBasePath + "/invoices/{invoice_id}/expire!" + localVarPath = strings.Replace(localVarPath, "{"+"invoice_id"+"}", url.PathEscape(utils.ParameterValueToString(r.invoiceId, "invoiceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := utils.SelectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } + req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: InvoiceApiService.ExpireInvoiceExecute") + } + + localVarHTTPResponse, err := a.client.CallAPI(req) + + localVarBody, _ := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + + err = a.client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + + if err != nil || localVarHTTPResponse.StatusCode < 200 || localVarHTTPResponse.StatusCode >= 300 { + xenditSdkError := common.NewXenditSdkError(&localVarBody, strconv.Itoa(localVarHTTPResponse.StatusCode), localVarHTTPResponse.Status) + + return localVarReturnValue, localVarHTTPResponse, xenditSdkError + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/invoice/model_bank_code.go b/invoice/model_bank_code.go index 952618d2..decab1f2 100644 --- a/invoice/model_bank_code.go +++ b/invoice/model_bank_code.go @@ -30,6 +30,7 @@ const ( BANKCODE_SAHABAT_SAMPOERNA BankCode = "SAHABAT_SAMPOERNA" BANKCODE_CIMB BankCode = "CIMB" BANKCODE_BNC BankCode = "BNC" + BANKCODE_XENDIT_ENUM_DEFAULT_FALLBACK BankCode = "UNKNOWN_ENUM_VALUE" ) // All allowed values of BankCode enum @@ -44,6 +45,7 @@ var AllowedBankCodeEnumValues = []BankCode{ "SAHABAT_SAMPOERNA", "CIMB", "BNC", + "UNKNOWN_ENUM_VALUE", } func (v *BankCode) UnmarshalJSON(src []byte) error { @@ -60,7 +62,8 @@ func (v *BankCode) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid BankCode", value) + *v = BANKCODE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewBankCodeFromValue returns a pointer to a valid BankCode diff --git a/invoice/model_direct_debit_type.go b/invoice/model_direct_debit_type.go index acf4d724..fb73d8d9 100644 --- a/invoice/model_direct_debit_type.go +++ b/invoice/model_direct_debit_type.go @@ -39,6 +39,7 @@ const ( DIRECTDEBITTYPE_DD_CHINABANK DirectDebitType = "DD_CHINABANK" DIRECTDEBITTYPE_BA_CHINABANK DirectDebitType = "BA_CHINABANK" DIRECTDEBITTYPE_DC_CHINABANK DirectDebitType = "DC_CHINABANK" + DIRECTDEBITTYPE_XENDIT_ENUM_DEFAULT_FALLBACK DirectDebitType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of DirectDebitType enum @@ -62,6 +63,7 @@ var AllowedDirectDebitTypeEnumValues = []DirectDebitType{ "DD_CHINABANK", "BA_CHINABANK", "DC_CHINABANK", + "UNKNOWN_ENUM_VALUE", } func (v *DirectDebitType) UnmarshalJSON(src []byte) error { @@ -78,7 +80,8 @@ func (v *DirectDebitType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid DirectDebitType", value) + *v = DIRECTDEBITTYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewDirectDebitTypeFromValue returns a pointer to a valid DirectDebitType diff --git a/invoice/model_ewallet_type.go b/invoice/model_ewallet_type.go index 1aa58cb6..1068e6f9 100644 --- a/invoice/model_ewallet_type.go +++ b/invoice/model_ewallet_type.go @@ -30,6 +30,7 @@ const ( EWALLETTYPE_ASTRAPAY EwalletType = "ASTRAPAY" EWALLETTYPE_NEXCASH EwalletType = "NEXCASH" EWALLETTYPE_JENIUSPAY EwalletType = "JENIUSPAY" + EWALLETTYPE_XENDIT_ENUM_DEFAULT_FALLBACK EwalletType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of EwalletType enum @@ -44,6 +45,7 @@ var AllowedEwalletTypeEnumValues = []EwalletType{ "ASTRAPAY", "NEXCASH", "JENIUSPAY", + "UNKNOWN_ENUM_VALUE", } func (v *EwalletType) UnmarshalJSON(src []byte) error { @@ -60,7 +62,8 @@ func (v *EwalletType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid EwalletType", value) + *v = EWALLETTYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewEwalletTypeFromValue returns a pointer to a valid EwalletType diff --git a/invoice/model_invoice_client_type.go b/invoice/model_invoice_client_type.go index bebb3c7b..ae4745ee 100644 --- a/invoice/model_invoice_client_type.go +++ b/invoice/model_invoice_client_type.go @@ -26,6 +26,7 @@ const ( INVOICECLIENTTYPE_ON_DEMAND InvoiceClientType = "ON_DEMAND" INVOICECLIENTTYPE_RECURRING InvoiceClientType = "RECURRING" INVOICECLIENTTYPE_MOBILE InvoiceClientType = "MOBILE" + INVOICECLIENTTYPE_XENDIT_ENUM_DEFAULT_FALLBACK InvoiceClientType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of InvoiceClientType enum @@ -36,6 +37,7 @@ var AllowedInvoiceClientTypeEnumValues = []InvoiceClientType{ "ON_DEMAND", "RECURRING", "MOBILE", + "UNKNOWN_ENUM_VALUE", } func (v *InvoiceClientType) UnmarshalJSON(src []byte) error { @@ -52,7 +54,8 @@ func (v *InvoiceClientType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid InvoiceClientType", value) + *v = INVOICECLIENTTYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewInvoiceClientTypeFromValue returns a pointer to a valid InvoiceClientType diff --git a/invoice/model_invoice_currency.go b/invoice/model_invoice_currency.go index fbbbeca0..9a9b4439 100644 --- a/invoice/model_invoice_currency.go +++ b/invoice/model_invoice_currency.go @@ -25,6 +25,7 @@ const ( INVOICECURRENCY_THB InvoiceCurrency = "THB" INVOICECURRENCY_VND InvoiceCurrency = "VND" INVOICECURRENCY_PHP InvoiceCurrency = "PHP" + INVOICECURRENCY_XENDIT_ENUM_DEFAULT_FALLBACK InvoiceCurrency = "UNKNOWN_ENUM_VALUE" ) // All allowed values of InvoiceCurrency enum @@ -34,6 +35,7 @@ var AllowedInvoiceCurrencyEnumValues = []InvoiceCurrency{ "THB", "VND", "PHP", + "UNKNOWN_ENUM_VALUE", } func (v *InvoiceCurrency) UnmarshalJSON(src []byte) error { @@ -50,7 +52,8 @@ func (v *InvoiceCurrency) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid InvoiceCurrency", value) + *v = INVOICECURRENCY_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewInvoiceCurrencyFromValue returns a pointer to a valid InvoiceCurrency diff --git a/invoice/model_invoice_payment_method.go b/invoice/model_invoice_payment_method.go index fd942287..2c6fcc22 100644 --- a/invoice/model_invoice_payment_method.go +++ b/invoice/model_invoice_payment_method.go @@ -30,6 +30,7 @@ const ( INVOICEPAYMENTMETHOD_DIRECT_DEBIT InvoicePaymentMethod = "DIRECT_DEBIT" INVOICEPAYMENTMETHOD_BANK_TRANSFER InvoicePaymentMethod = "BANK_TRANSFER" INVOICEPAYMENTMETHOD_PAYLATER InvoicePaymentMethod = "PAYLATER" + INVOICEPAYMENTMETHOD_XENDIT_ENUM_DEFAULT_FALLBACK InvoicePaymentMethod = "UNKNOWN_ENUM_VALUE" ) // All allowed values of InvoicePaymentMethod enum @@ -44,6 +45,7 @@ var AllowedInvoicePaymentMethodEnumValues = []InvoicePaymentMethod{ "DIRECT_DEBIT", "BANK_TRANSFER", "PAYLATER", + "UNKNOWN_ENUM_VALUE", } func (v *InvoicePaymentMethod) UnmarshalJSON(src []byte) error { @@ -60,7 +62,8 @@ func (v *InvoicePaymentMethod) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid InvoicePaymentMethod", value) + *v = INVOICEPAYMENTMETHOD_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewInvoicePaymentMethodFromValue returns a pointer to a valid InvoicePaymentMethod diff --git a/invoice/model_invoice_status.go b/invoice/model_invoice_status.go index ba45ca08..93e9da9e 100644 --- a/invoice/model_invoice_status.go +++ b/invoice/model_invoice_status.go @@ -24,6 +24,7 @@ const ( INVOICESTATUS_PAID InvoiceStatus = "PAID" INVOICESTATUS_SETTLED InvoiceStatus = "SETTLED" INVOICESTATUS_EXPIRED InvoiceStatus = "EXPIRED" + INVOICESTATUS_XENDIT_ENUM_DEFAULT_FALLBACK InvoiceStatus = "UNKNOWN_ENUM_VALUE" ) // All allowed values of InvoiceStatus enum @@ -32,6 +33,7 @@ var AllowedInvoiceStatusEnumValues = []InvoiceStatus{ "PAID", "SETTLED", "EXPIRED", + "UNKNOWN_ENUM_VALUE", } func (v *InvoiceStatus) UnmarshalJSON(src []byte) error { @@ -48,7 +50,8 @@ func (v *InvoiceStatus) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid InvoiceStatus", value) + *v = INVOICESTATUS_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewInvoiceStatusFromValue returns a pointer to a valid InvoiceStatus diff --git a/invoice/model_notification_channel.go b/invoice/model_notification_channel.go index f3ef1bb5..ba5c6488 100644 --- a/invoice/model_notification_channel.go +++ b/invoice/model_notification_channel.go @@ -24,6 +24,7 @@ const ( NOTIFICATIONCHANNEL_SMS NotificationChannel = "sms" NOTIFICATIONCHANNEL_WHATSAPP NotificationChannel = "whatsapp" NOTIFICATIONCHANNEL_VIBER NotificationChannel = "viber" + NOTIFICATIONCHANNEL_XENDIT_ENUM_DEFAULT_FALLBACK NotificationChannel = "UNKNOWN_ENUM_VALUE" ) // All allowed values of NotificationChannel enum @@ -32,6 +33,7 @@ var AllowedNotificationChannelEnumValues = []NotificationChannel{ "sms", "whatsapp", "viber", + "UNKNOWN_ENUM_VALUE", } func (v *NotificationChannel) UnmarshalJSON(src []byte) error { @@ -48,7 +50,8 @@ func (v *NotificationChannel) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid NotificationChannel", value) + *v = NOTIFICATIONCHANNEL_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewNotificationChannelFromValue returns a pointer to a valid NotificationChannel diff --git a/invoice/model_paylater_type.go b/invoice/model_paylater_type.go index 0f930258..a66482ce 100644 --- a/invoice/model_paylater_type.go +++ b/invoice/model_paylater_type.go @@ -26,6 +26,7 @@ const ( PAYLATERTYPE_BILLEASE PaylaterType = "BILLEASE" PAYLATERTYPE_CASHALO PaylaterType = "CASHALO" PAYLATERTYPE_ATOME PaylaterType = "ATOME" + PAYLATERTYPE_XENDIT_ENUM_DEFAULT_FALLBACK PaylaterType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaylaterType enum @@ -36,6 +37,7 @@ var AllowedPaylaterTypeEnumValues = []PaylaterType{ "BILLEASE", "CASHALO", "ATOME", + "UNKNOWN_ENUM_VALUE", } func (v *PaylaterType) UnmarshalJSON(src []byte) error { @@ -52,7 +54,8 @@ func (v *PaylaterType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaylaterType", value) + *v = PAYLATERTYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaylaterTypeFromValue returns a pointer to a valid PaylaterType diff --git a/invoice/model_qr_code_type.go b/invoice/model_qr_code_type.go index 1c337cda..9452849f 100644 --- a/invoice/model_qr_code_type.go +++ b/invoice/model_qr_code_type.go @@ -22,12 +22,14 @@ type QrCodeType string const ( QRCODETYPE_QRIS QrCodeType = "QRIS" QRCODETYPE_PROMPTPAY QrCodeType = "PROMPTPAY" + QRCODETYPE_XENDIT_ENUM_DEFAULT_FALLBACK QrCodeType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of QrCodeType enum var AllowedQrCodeTypeEnumValues = []QrCodeType{ "QRIS", "PROMPTPAY", + "UNKNOWN_ENUM_VALUE", } func (v *QrCodeType) UnmarshalJSON(src []byte) error { @@ -44,7 +46,8 @@ func (v *QrCodeType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid QrCodeType", value) + *v = QRCODETYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewQrCodeTypeFromValue returns a pointer to a valid QrCodeType diff --git a/invoice/model_retail_outlet_name.go b/invoice/model_retail_outlet_name.go index 500a44f3..8d1c4a13 100644 --- a/invoice/model_retail_outlet_name.go +++ b/invoice/model_retail_outlet_name.go @@ -29,6 +29,7 @@ const ( RETAILOUTLETNAME_DP_PALAWAN RetailOutletName = "DP_PALAWAN" RETAILOUTLETNAME_DP_ECPAY_SCHOOL RetailOutletName = "DP_ECPAY_SCHOOL" RETAILOUTLETNAME_LBC RetailOutletName = "LBC" + RETAILOUTLETNAME_XENDIT_ENUM_DEFAULT_FALLBACK RetailOutletName = "UNKNOWN_ENUM_VALUE" ) // All allowed values of RetailOutletName enum @@ -42,6 +43,7 @@ var AllowedRetailOutletNameEnumValues = []RetailOutletName{ "DP_PALAWAN", "DP_ECPAY_SCHOOL", "LBC", + "UNKNOWN_ENUM_VALUE", } func (v *RetailOutletName) UnmarshalJSON(src []byte) error { @@ -58,7 +60,8 @@ func (v *RetailOutletName) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid RetailOutletName", value) + *v = RETAILOUTLETNAME_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewRetailOutletNameFromValue returns a pointer to a valid RetailOutletName diff --git a/payment_method/api_payment_method.go b/payment_method/api_payment_method.go index 5bdd7c47..5ec45c6d 100644 --- a/payment_method/api_payment_method.go +++ b/payment_method/api_payment_method.go @@ -18,21 +18,6 @@ import ( type PaymentMethodApi interface { - /* - AuthPaymentMethod Validate a payment method's linking OTP - - This endpoint validates a payment method linking OTP - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param paymentMethodId - @return ApiAuthPaymentMethodRequest - */ - AuthPaymentMethod(ctx context.Context, paymentMethodId string) ApiAuthPaymentMethodRequest - - // AuthPaymentMethodExecute executes the request - // @return PaymentMethod - AuthPaymentMethodExecute(r ApiAuthPaymentMethodRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) - /* CreatePaymentMethod Creates payment method @@ -47,35 +32,6 @@ type PaymentMethodApi interface { // @return PaymentMethod CreatePaymentMethodExecute(r ApiCreatePaymentMethodRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) - /* - ExpirePaymentMethod Expires a payment method - - This endpoint expires a payment method and performs unlinking if necessary - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param paymentMethodId - @return ApiExpirePaymentMethodRequest - */ - ExpirePaymentMethod(ctx context.Context, paymentMethodId string) ApiExpirePaymentMethodRequest - - // ExpirePaymentMethodExecute executes the request - // @return PaymentMethod - ExpirePaymentMethodExecute(r ApiExpirePaymentMethodRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) - - /* - GetAllPaymentMethods Get all payment methods by filters - - Get all payment methods by filters - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiGetAllPaymentMethodsRequest - */ - GetAllPaymentMethods(ctx context.Context) ApiGetAllPaymentMethodsRequest - - // GetAllPaymentMethodsExecute executes the request - // @return PaymentMethodList - GetAllPaymentMethodsExecute(r ApiGetAllPaymentMethodsRequest) (*PaymentMethodList, *http.Response, *common.XenditSdkError) - /* GetPaymentMethodByID Get payment method by ID @@ -109,7 +65,7 @@ type PaymentMethodApi interface { /* PatchPaymentMethod Patch payment methods - This endpoint is used to toggle the ```status``` of an e-Wallet or a Direct Debit payment method to ```ACTIVE``` or ```INACTIVE```. This is also used to update the details of an Over-the-Counter or a Virtual Account payment method. + This endpoint is used to toggle the ```status``` of an e-Wallet or a Direct Debit payment method to ```ACTIVE``` or ```INACTIVE```. This is also used to update the details of an Over-the-Counter or a Virtual Account payment method. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param paymentMethodId @@ -121,6 +77,50 @@ type PaymentMethodApi interface { // @return PaymentMethod PatchPaymentMethodExecute(r ApiPatchPaymentMethodRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) + /* + GetAllPaymentMethods Get all payment methods by filters + + Get all payment methods by filters + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetAllPaymentMethodsRequest + */ + GetAllPaymentMethods(ctx context.Context) ApiGetAllPaymentMethodsRequest + + // GetAllPaymentMethodsExecute executes the request + // @return PaymentMethodList + GetAllPaymentMethodsExecute(r ApiGetAllPaymentMethodsRequest) (*PaymentMethodList, *http.Response, *common.XenditSdkError) + + /* + ExpirePaymentMethod Expires a payment method + + This endpoint expires a payment method and performs unlinking if necessary + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param paymentMethodId + @return ApiExpirePaymentMethodRequest + */ + ExpirePaymentMethod(ctx context.Context, paymentMethodId string) ApiExpirePaymentMethodRequest + + // ExpirePaymentMethodExecute executes the request + // @return PaymentMethod + ExpirePaymentMethodExecute(r ApiExpirePaymentMethodRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) + + /* + AuthPaymentMethod Validate a payment method's linking OTP + + This endpoint validates a payment method linking OTP + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param paymentMethodId + @return ApiAuthPaymentMethodRequest + */ + AuthPaymentMethod(ctx context.Context, paymentMethodId string) ApiAuthPaymentMethodRequest + + // AuthPaymentMethodExecute executes the request + // @return PaymentMethod + AuthPaymentMethodExecute(r ApiAuthPaymentMethodRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) + /* SimulatePayment Makes payment with matching PaymentMethodID. @@ -149,108 +149,18 @@ func NewPaymentMethodApi (client common.IClient) PaymentMethodApi { } -type ApiAuthPaymentMethodRequest struct { +type ApiCreatePaymentMethodRequest struct { ctx context.Context ApiService PaymentMethodApi - paymentMethodId string - paymentMethodAuthParameters *PaymentMethodAuthParameters + forUserId *string + paymentMethodParameters *PaymentMethodParameters } -func (r ApiAuthPaymentMethodRequest) PaymentMethodAuthParameters(paymentMethodAuthParameters PaymentMethodAuthParameters) ApiAuthPaymentMethodRequest { - r.paymentMethodAuthParameters = &paymentMethodAuthParameters +func (r ApiCreatePaymentMethodRequest) ForUserId(forUserId string) ApiCreatePaymentMethodRequest { + r.forUserId = &forUserId return r } -func (r ApiAuthPaymentMethodRequest) Execute() (*PaymentMethod, *http.Response, *common.XenditSdkError) { - return r.ApiService.AuthPaymentMethodExecute(r) -} - -/* -AuthPaymentMethod Validate a payment method's linking OTP - -This endpoint validates a payment method linking OTP - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param paymentMethodId - @return ApiAuthPaymentMethodRequest -*/ -func (a *PaymentMethodApiService) AuthPaymentMethod(ctx context.Context, paymentMethodId string) ApiAuthPaymentMethodRequest { - return ApiAuthPaymentMethodRequest{ - ApiService: a, - ctx: ctx, - paymentMethodId: paymentMethodId, - } -} - -// Execute executes the request -// @return PaymentMethod -func (a *PaymentMethodApiService) AuthPaymentMethodExecute(r ApiAuthPaymentMethodRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []common.FormFile - localVarReturnValue *PaymentMethod - ) - - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentMethodApiService.AuthPaymentMethod") - if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.AuthPaymentMethodExecute") - } - - localVarPath := localBasePath + "/v2/payment_methods/{paymentMethodId}/auth" - localVarPath = strings.Replace(localVarPath, "{"+"paymentMethodId"+"}", url.PathEscape(utils.ParameterValueToString(r.paymentMethodId, "paymentMethodId")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := utils.SelectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.paymentMethodAuthParameters - req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.AuthPaymentMethodExecute") - } - - localVarHTTPResponse, err := a.client.CallAPI(req) - - localVarBody, _ := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - - err = a.client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - - if err != nil || localVarHTTPResponse.StatusCode < 200 || localVarHTTPResponse.StatusCode >= 300 { - xenditSdkError := common.NewXenditSdkError(&localVarBody, strconv.Itoa(localVarHTTPResponse.StatusCode), localVarHTTPResponse.Status) - - return localVarReturnValue, localVarHTTPResponse, xenditSdkError - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - -type ApiCreatePaymentMethodRequest struct { - ctx context.Context - ApiService PaymentMethodApi - paymentMethodParameters *PaymentMethodParameters -} - func (r ApiCreatePaymentMethodRequest) PaymentMethodParameters(paymentMethodParameters PaymentMethodParameters) ApiCreatePaymentMethodRequest { r.paymentMethodParameters = &paymentMethodParameters return r @@ -313,6 +223,9 @@ func (a *PaymentMethodApiService) CreatePaymentMethodExecute(r ApiCreatePaymentM if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } // body params localVarPostBody = r.paymentMethodParameters req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) @@ -337,33 +250,33 @@ func (a *PaymentMethodApiService) CreatePaymentMethodExecute(r ApiCreatePaymentM return localVarReturnValue, localVarHTTPResponse, nil } -type ApiExpirePaymentMethodRequest struct { +type ApiGetPaymentMethodByIDRequest struct { ctx context.Context ApiService PaymentMethodApi paymentMethodId string - paymentMethodExpireParameters *PaymentMethodExpireParameters + forUserId *string } -func (r ApiExpirePaymentMethodRequest) PaymentMethodExpireParameters(paymentMethodExpireParameters PaymentMethodExpireParameters) ApiExpirePaymentMethodRequest { - r.paymentMethodExpireParameters = &paymentMethodExpireParameters +func (r ApiGetPaymentMethodByIDRequest) ForUserId(forUserId string) ApiGetPaymentMethodByIDRequest { + r.forUserId = &forUserId return r } -func (r ApiExpirePaymentMethodRequest) Execute() (*PaymentMethod, *http.Response, *common.XenditSdkError) { - return r.ApiService.ExpirePaymentMethodExecute(r) +func (r ApiGetPaymentMethodByIDRequest) Execute() (*PaymentMethod, *http.Response, *common.XenditSdkError) { + return r.ApiService.GetPaymentMethodByIDExecute(r) } /* -ExpirePaymentMethod Expires a payment method +GetPaymentMethodByID Get payment method by ID -This endpoint expires a payment method and performs unlinking if necessary +Get payment method by ID @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param paymentMethodId - @return ApiExpirePaymentMethodRequest + @return ApiGetPaymentMethodByIDRequest */ -func (a *PaymentMethodApiService) ExpirePaymentMethod(ctx context.Context, paymentMethodId string) ApiExpirePaymentMethodRequest { - return ApiExpirePaymentMethodRequest{ +func (a *PaymentMethodApiService) GetPaymentMethodByID(ctx context.Context, paymentMethodId string) ApiGetPaymentMethodByIDRequest { + return ApiGetPaymentMethodByIDRequest{ ApiService: a, ctx: ctx, paymentMethodId: paymentMethodId, @@ -372,20 +285,20 @@ func (a *PaymentMethodApiService) ExpirePaymentMethod(ctx context.Context, payme // Execute executes the request // @return PaymentMethod -func (a *PaymentMethodApiService) ExpirePaymentMethodExecute(r ApiExpirePaymentMethodRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) { +func (a *PaymentMethodApiService) GetPaymentMethodByIDExecute(r ApiGetPaymentMethodByIDRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []common.FormFile localVarReturnValue *PaymentMethod ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentMethodApiService.ExpirePaymentMethod") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentMethodApiService.GetPaymentMethodByID") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.ExpirePaymentMethodExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.GetPaymentMethodByIDExecute") } - localVarPath := localBasePath + "/v2/payment_methods/{paymentMethodId}/expire" + localVarPath := localBasePath + "/v2/payment_methods/{paymentMethodId}" localVarPath = strings.Replace(localVarPath, "{"+"paymentMethodId"+"}", url.PathEscape(utils.ParameterValueToString(r.paymentMethodId, "paymentMethodId")), -1) localVarHeaderParams := make(map[string]string) @@ -393,7 +306,7 @@ func (a *PaymentMethodApiService) ExpirePaymentMethodExecute(r ApiExpirePaymentM localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) @@ -409,11 +322,12 @@ func (a *PaymentMethodApiService) ExpirePaymentMethodExecute(r ApiExpirePaymentM if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.paymentMethodExpireParameters + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.ExpirePaymentMethodExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.GetPaymentMethodByIDExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) @@ -433,125 +347,186 @@ func (a *PaymentMethodApiService) ExpirePaymentMethodExecute(r ApiExpirePaymentM return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetAllPaymentMethodsRequest struct { +type ApiGetPaymentsByPaymentMethodIdRequest struct { ctx context.Context ApiService PaymentMethodApi - id *[]string - type_ *[]string - status *[]PaymentMethodStatus - reusability *PaymentMethodReusability - customerId *string - referenceId *string - afterId *string - beforeId *string + paymentMethodId string + forUserId *string + paymentRequestId *[]string + paymentMethodId2 *[]string + referenceId *[]string + paymentMethodType *[]PaymentMethodType + channelCode *[]string + status *[]string + currency *[]string + createdGte *time.Time + createdLte *time.Time + updatedGte *time.Time + updatedLte *time.Time limit *int32 } -func (r ApiGetAllPaymentMethodsRequest) Id(id []string) ApiGetAllPaymentMethodsRequest { - r.id = &id +func (r ApiGetPaymentsByPaymentMethodIdRequest) ForUserId(forUserId string) ApiGetPaymentsByPaymentMethodIdRequest { + r.forUserId = &forUserId return r } -func (r ApiGetAllPaymentMethodsRequest) Type_(type_ []string) ApiGetAllPaymentMethodsRequest { - r.type_ = &type_ +func (r ApiGetPaymentsByPaymentMethodIdRequest) PaymentRequestId(paymentRequestId []string) ApiGetPaymentsByPaymentMethodIdRequest { + r.paymentRequestId = &paymentRequestId return r } -func (r ApiGetAllPaymentMethodsRequest) Status(status []PaymentMethodStatus) ApiGetAllPaymentMethodsRequest { - r.status = &status +func (r ApiGetPaymentsByPaymentMethodIdRequest) PaymentMethodId2(paymentMethodId2 []string) ApiGetPaymentsByPaymentMethodIdRequest { + r.paymentMethodId2 = &paymentMethodId2 return r } -func (r ApiGetAllPaymentMethodsRequest) Reusability(reusability PaymentMethodReusability) ApiGetAllPaymentMethodsRequest { - r.reusability = &reusability +func (r ApiGetPaymentsByPaymentMethodIdRequest) ReferenceId(referenceId []string) ApiGetPaymentsByPaymentMethodIdRequest { + r.referenceId = &referenceId return r } -func (r ApiGetAllPaymentMethodsRequest) CustomerId(customerId string) ApiGetAllPaymentMethodsRequest { - r.customerId = &customerId +func (r ApiGetPaymentsByPaymentMethodIdRequest) PaymentMethodType(paymentMethodType []PaymentMethodType) ApiGetPaymentsByPaymentMethodIdRequest { + r.paymentMethodType = &paymentMethodType return r } -func (r ApiGetAllPaymentMethodsRequest) ReferenceId(referenceId string) ApiGetAllPaymentMethodsRequest { - r.referenceId = &referenceId +func (r ApiGetPaymentsByPaymentMethodIdRequest) ChannelCode(channelCode []string) ApiGetPaymentsByPaymentMethodIdRequest { + r.channelCode = &channelCode return r } -func (r ApiGetAllPaymentMethodsRequest) AfterId(afterId string) ApiGetAllPaymentMethodsRequest { - r.afterId = &afterId +func (r ApiGetPaymentsByPaymentMethodIdRequest) Status(status []string) ApiGetPaymentsByPaymentMethodIdRequest { + r.status = &status return r } -func (r ApiGetAllPaymentMethodsRequest) BeforeId(beforeId string) ApiGetAllPaymentMethodsRequest { - r.beforeId = &beforeId +func (r ApiGetPaymentsByPaymentMethodIdRequest) Currency(currency []string) ApiGetPaymentsByPaymentMethodIdRequest { + r.currency = ¤cy return r } -func (r ApiGetAllPaymentMethodsRequest) Limit(limit int32) ApiGetAllPaymentMethodsRequest { +func (r ApiGetPaymentsByPaymentMethodIdRequest) CreatedGte(createdGte time.Time) ApiGetPaymentsByPaymentMethodIdRequest { + r.createdGte = &createdGte + return r +} + +func (r ApiGetPaymentsByPaymentMethodIdRequest) CreatedLte(createdLte time.Time) ApiGetPaymentsByPaymentMethodIdRequest { + r.createdLte = &createdLte + return r +} + +func (r ApiGetPaymentsByPaymentMethodIdRequest) UpdatedGte(updatedGte time.Time) ApiGetPaymentsByPaymentMethodIdRequest { + r.updatedGte = &updatedGte + return r +} + +func (r ApiGetPaymentsByPaymentMethodIdRequest) UpdatedLte(updatedLte time.Time) ApiGetPaymentsByPaymentMethodIdRequest { + r.updatedLte = &updatedLte + return r +} + +func (r ApiGetPaymentsByPaymentMethodIdRequest) Limit(limit int32) ApiGetPaymentsByPaymentMethodIdRequest { r.limit = &limit return r } -func (r ApiGetAllPaymentMethodsRequest) Execute() (*PaymentMethodList, *http.Response, *common.XenditSdkError) { - return r.ApiService.GetAllPaymentMethodsExecute(r) +func (r ApiGetPaymentsByPaymentMethodIdRequest) Execute() (map[string]interface{}, *http.Response, *common.XenditSdkError) { + return r.ApiService.GetPaymentsByPaymentMethodIdExecute(r) } /* -GetAllPaymentMethods Get all payment methods by filters +GetPaymentsByPaymentMethodId Returns payments with matching PaymentMethodID. -Get all payment methods by filters +Returns payments with matching PaymentMethodID. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiGetAllPaymentMethodsRequest + @param paymentMethodId + @return ApiGetPaymentsByPaymentMethodIdRequest */ -func (a *PaymentMethodApiService) GetAllPaymentMethods(ctx context.Context) ApiGetAllPaymentMethodsRequest { - return ApiGetAllPaymentMethodsRequest{ +func (a *PaymentMethodApiService) GetPaymentsByPaymentMethodId(ctx context.Context, paymentMethodId string) ApiGetPaymentsByPaymentMethodIdRequest { + return ApiGetPaymentsByPaymentMethodIdRequest{ ApiService: a, ctx: ctx, + paymentMethodId: paymentMethodId, } } // Execute executes the request -// @return PaymentMethodList -func (a *PaymentMethodApiService) GetAllPaymentMethodsExecute(r ApiGetAllPaymentMethodsRequest) (*PaymentMethodList, *http.Response, *common.XenditSdkError) { +// @return map[string]interface{} +func (a *PaymentMethodApiService) GetPaymentsByPaymentMethodIdExecute(r ApiGetPaymentsByPaymentMethodIdRequest) (map[string]interface{}, *http.Response, *common.XenditSdkError) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []common.FormFile - localVarReturnValue *PaymentMethodList + localVarReturnValue map[string]interface{} ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentMethodApiService.GetAllPaymentMethods") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentMethodApiService.GetPaymentsByPaymentMethodId") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.GetAllPaymentMethodsExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.GetPaymentsByPaymentMethodIdExecute") } - localVarPath := localBasePath + "/v2/payment_methods" + localVarPath := localBasePath + "/v2/payment_methods/{paymentMethodId}/payments" + localVarPath = strings.Replace(localVarPath, "{"+"paymentMethodId"+"}", url.PathEscape(utils.ParameterValueToString(r.paymentMethodId, "paymentMethodId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.id != nil { - t := *r.id + if r.paymentRequestId != nil { + t := *r.paymentRequestId if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "id", s.Index(i), "multi") + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_request_id", s.Index(i), "multi") } } else { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "id", t, "multi") + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_request_id", t, "multi") } } - if r.type_ != nil { - t := *r.type_ + if r.paymentMethodId2 != nil { + t := *r.paymentMethodId2 if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "type", s.Index(i), "multi") + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_method_id", s.Index(i), "multi") } } else { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "type", t, "multi") + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_method_id", t, "multi") + } + } + if r.referenceId != nil { + t := *r.referenceId + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "reference_id", s.Index(i), "multi") + } + } else { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "reference_id", t, "multi") + } + } + if r.paymentMethodType != nil { + t := *r.paymentMethodType + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_method_type", s.Index(i), "multi") + } + } else { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_method_type", t, "multi") + } + } + if r.channelCode != nil { + t := *r.channelCode + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "channel_code", s.Index(i), "multi") + } + } else { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "channel_code", t, "multi") } } if r.status != nil { @@ -565,20 +540,28 @@ func (a *PaymentMethodApiService) GetAllPaymentMethodsExecute(r ApiGetAllPayment utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "status", t, "multi") } } - if r.reusability != nil { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "reusability", r.reusability, "") + if r.currency != nil { + t := *r.currency + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "currency", s.Index(i), "multi") + } + } else { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "currency", t, "multi") + } } - if r.customerId != nil { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "customer_id", r.customerId, "") + if r.createdGte != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "created[gte]", r.createdGte, "") } - if r.referenceId != nil { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "reference_id", r.referenceId, "") + if r.createdLte != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "created[lte]", r.createdLte, "") } - if r.afterId != nil { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "after_id", r.afterId, "") + if r.updatedGte != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "updated[gte]", r.updatedGte, "") } - if r.beforeId != nil { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "before_id", r.beforeId, "") + if r.updatedLte != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "updated[lte]", r.updatedLte, "") } if r.limit != nil { utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") @@ -600,9 +583,12 @@ func (a *PaymentMethodApiService) GetAllPaymentMethodsExecute(r ApiGetAllPayment if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.GetAllPaymentMethodsExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.GetPaymentsByPaymentMethodIdExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) @@ -622,27 +608,39 @@ func (a *PaymentMethodApiService) GetAllPaymentMethodsExecute(r ApiGetAllPayment return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetPaymentMethodByIDRequest struct { +type ApiPatchPaymentMethodRequest struct { ctx context.Context ApiService PaymentMethodApi paymentMethodId string + forUserId *string + paymentMethodUpdateParameters *PaymentMethodUpdateParameters } -func (r ApiGetPaymentMethodByIDRequest) Execute() (*PaymentMethod, *http.Response, *common.XenditSdkError) { - return r.ApiService.GetPaymentMethodByIDExecute(r) +func (r ApiPatchPaymentMethodRequest) ForUserId(forUserId string) ApiPatchPaymentMethodRequest { + r.forUserId = &forUserId + return r +} + +func (r ApiPatchPaymentMethodRequest) PaymentMethodUpdateParameters(paymentMethodUpdateParameters PaymentMethodUpdateParameters) ApiPatchPaymentMethodRequest { + r.paymentMethodUpdateParameters = &paymentMethodUpdateParameters + return r +} + +func (r ApiPatchPaymentMethodRequest) Execute() (*PaymentMethod, *http.Response, *common.XenditSdkError) { + return r.ApiService.PatchPaymentMethodExecute(r) } /* -GetPaymentMethodByID Get payment method by ID +PatchPaymentMethod Patch payment methods -Get payment method by ID +This endpoint is used to toggle the ```status``` of an e-Wallet or a Direct Debit payment method to ```ACTIVE``` or ```INACTIVE```. This is also used to update the details of an Over-the-Counter or a Virtual Account payment method. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param paymentMethodId - @return ApiGetPaymentMethodByIDRequest + @return ApiPatchPaymentMethodRequest */ -func (a *PaymentMethodApiService) GetPaymentMethodByID(ctx context.Context, paymentMethodId string) ApiGetPaymentMethodByIDRequest { - return ApiGetPaymentMethodByIDRequest{ +func (a *PaymentMethodApiService) PatchPaymentMethod(ctx context.Context, paymentMethodId string) ApiPatchPaymentMethodRequest { + return ApiPatchPaymentMethodRequest{ ApiService: a, ctx: ctx, paymentMethodId: paymentMethodId, @@ -651,17 +649,17 @@ func (a *PaymentMethodApiService) GetPaymentMethodByID(ctx context.Context, paym // Execute executes the request // @return PaymentMethod -func (a *PaymentMethodApiService) GetPaymentMethodByIDExecute(r ApiGetPaymentMethodByIDRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) { +func (a *PaymentMethodApiService) PatchPaymentMethodExecute(r ApiPatchPaymentMethodRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPatch localVarPostBody interface{} formFiles []common.FormFile localVarReturnValue *PaymentMethod ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentMethodApiService.GetPaymentMethodByID") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentMethodApiService.PatchPaymentMethod") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.GetPaymentMethodByIDExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.PatchPaymentMethodExecute") } localVarPath := localBasePath + "/v2/payment_methods/{paymentMethodId}" @@ -672,7 +670,7 @@ func (a *PaymentMethodApiService) GetPaymentMethodByIDExecute(r ApiGetPaymentMet localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) @@ -688,9 +686,14 @@ func (a *PaymentMethodApiService) GetPaymentMethodByIDExecute(r ApiGetPaymentMet if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } + // body params + localVarPostBody = r.paymentMethodUpdateParameters req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.GetPaymentMethodByIDExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.PatchPaymentMethodExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) @@ -710,180 +713,131 @@ func (a *PaymentMethodApiService) GetPaymentMethodByIDExecute(r ApiGetPaymentMet return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetPaymentsByPaymentMethodIdRequest struct { +type ApiGetAllPaymentMethodsRequest struct { ctx context.Context ApiService PaymentMethodApi - paymentMethodId string - paymentRequestId *[]string - paymentMethodId2 *[]string - referenceId *[]string - paymentMethodType *[]PaymentMethodType - channelCode *[]string - status *[]string - currency *[]string - createdGte *time.Time - createdLte *time.Time - updatedGte *time.Time - updatedLte *time.Time + forUserId *string + id *[]string + type_ *[]string + status *[]PaymentMethodStatus + reusability *PaymentMethodReusability + customerId *string + referenceId *string + afterId *string + beforeId *string limit *int32 } -func (r ApiGetPaymentsByPaymentMethodIdRequest) PaymentRequestId(paymentRequestId []string) ApiGetPaymentsByPaymentMethodIdRequest { - r.paymentRequestId = &paymentRequestId - return r -} - -func (r ApiGetPaymentsByPaymentMethodIdRequest) PaymentMethodId2(paymentMethodId2 []string) ApiGetPaymentsByPaymentMethodIdRequest { - r.paymentMethodId2 = &paymentMethodId2 - return r -} - -func (r ApiGetPaymentsByPaymentMethodIdRequest) ReferenceId(referenceId []string) ApiGetPaymentsByPaymentMethodIdRequest { - r.referenceId = &referenceId +func (r ApiGetAllPaymentMethodsRequest) ForUserId(forUserId string) ApiGetAllPaymentMethodsRequest { + r.forUserId = &forUserId return r } -func (r ApiGetPaymentsByPaymentMethodIdRequest) PaymentMethodType(paymentMethodType []PaymentMethodType) ApiGetPaymentsByPaymentMethodIdRequest { - r.paymentMethodType = &paymentMethodType +func (r ApiGetAllPaymentMethodsRequest) Id(id []string) ApiGetAllPaymentMethodsRequest { + r.id = &id return r } -func (r ApiGetPaymentsByPaymentMethodIdRequest) ChannelCode(channelCode []string) ApiGetPaymentsByPaymentMethodIdRequest { - r.channelCode = &channelCode +func (r ApiGetAllPaymentMethodsRequest) Type_(type_ []string) ApiGetAllPaymentMethodsRequest { + r.type_ = &type_ return r } -func (r ApiGetPaymentsByPaymentMethodIdRequest) Status(status []string) ApiGetPaymentsByPaymentMethodIdRequest { +func (r ApiGetAllPaymentMethodsRequest) Status(status []PaymentMethodStatus) ApiGetAllPaymentMethodsRequest { r.status = &status return r } -func (r ApiGetPaymentsByPaymentMethodIdRequest) Currency(currency []string) ApiGetPaymentsByPaymentMethodIdRequest { - r.currency = ¤cy +func (r ApiGetAllPaymentMethodsRequest) Reusability(reusability PaymentMethodReusability) ApiGetAllPaymentMethodsRequest { + r.reusability = &reusability return r } -func (r ApiGetPaymentsByPaymentMethodIdRequest) CreatedGte(createdGte time.Time) ApiGetPaymentsByPaymentMethodIdRequest { - r.createdGte = &createdGte +func (r ApiGetAllPaymentMethodsRequest) CustomerId(customerId string) ApiGetAllPaymentMethodsRequest { + r.customerId = &customerId return r } -func (r ApiGetPaymentsByPaymentMethodIdRequest) CreatedLte(createdLte time.Time) ApiGetPaymentsByPaymentMethodIdRequest { - r.createdLte = &createdLte +func (r ApiGetAllPaymentMethodsRequest) ReferenceId(referenceId string) ApiGetAllPaymentMethodsRequest { + r.referenceId = &referenceId return r } -func (r ApiGetPaymentsByPaymentMethodIdRequest) UpdatedGte(updatedGte time.Time) ApiGetPaymentsByPaymentMethodIdRequest { - r.updatedGte = &updatedGte +func (r ApiGetAllPaymentMethodsRequest) AfterId(afterId string) ApiGetAllPaymentMethodsRequest { + r.afterId = &afterId return r } -func (r ApiGetPaymentsByPaymentMethodIdRequest) UpdatedLte(updatedLte time.Time) ApiGetPaymentsByPaymentMethodIdRequest { - r.updatedLte = &updatedLte +func (r ApiGetAllPaymentMethodsRequest) BeforeId(beforeId string) ApiGetAllPaymentMethodsRequest { + r.beforeId = &beforeId return r } -func (r ApiGetPaymentsByPaymentMethodIdRequest) Limit(limit int32) ApiGetPaymentsByPaymentMethodIdRequest { +func (r ApiGetAllPaymentMethodsRequest) Limit(limit int32) ApiGetAllPaymentMethodsRequest { r.limit = &limit return r } -func (r ApiGetPaymentsByPaymentMethodIdRequest) Execute() (map[string]interface{}, *http.Response, *common.XenditSdkError) { - return r.ApiService.GetPaymentsByPaymentMethodIdExecute(r) +func (r ApiGetAllPaymentMethodsRequest) Execute() (*PaymentMethodList, *http.Response, *common.XenditSdkError) { + return r.ApiService.GetAllPaymentMethodsExecute(r) } /* -GetPaymentsByPaymentMethodId Returns payments with matching PaymentMethodID. +GetAllPaymentMethods Get all payment methods by filters -Returns payments with matching PaymentMethodID. +Get all payment methods by filters @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param paymentMethodId - @return ApiGetPaymentsByPaymentMethodIdRequest + @return ApiGetAllPaymentMethodsRequest */ -func (a *PaymentMethodApiService) GetPaymentsByPaymentMethodId(ctx context.Context, paymentMethodId string) ApiGetPaymentsByPaymentMethodIdRequest { - return ApiGetPaymentsByPaymentMethodIdRequest{ +func (a *PaymentMethodApiService) GetAllPaymentMethods(ctx context.Context) ApiGetAllPaymentMethodsRequest { + return ApiGetAllPaymentMethodsRequest{ ApiService: a, ctx: ctx, - paymentMethodId: paymentMethodId, } } // Execute executes the request -// @return map[string]interface{} -func (a *PaymentMethodApiService) GetPaymentsByPaymentMethodIdExecute(r ApiGetPaymentsByPaymentMethodIdRequest) (map[string]interface{}, *http.Response, *common.XenditSdkError) { +// @return PaymentMethodList +func (a *PaymentMethodApiService) GetAllPaymentMethodsExecute(r ApiGetAllPaymentMethodsRequest) (*PaymentMethodList, *http.Response, *common.XenditSdkError) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []common.FormFile - localVarReturnValue map[string]interface{} + localVarReturnValue *PaymentMethodList ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentMethodApiService.GetPaymentsByPaymentMethodId") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentMethodApiService.GetAllPaymentMethods") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.GetPaymentsByPaymentMethodIdExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.GetAllPaymentMethodsExecute") } - localVarPath := localBasePath + "/v2/payment_methods/{paymentMethodId}/payments" - localVarPath = strings.Replace(localVarPath, "{"+"paymentMethodId"+"}", url.PathEscape(utils.ParameterValueToString(r.paymentMethodId, "paymentMethodId")), -1) + localVarPath := localBasePath + "/v2/payment_methods" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.paymentRequestId != nil { - t := *r.paymentRequestId - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_request_id", s.Index(i), "multi") - } - } else { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_request_id", t, "multi") - } - } - if r.paymentMethodId2 != nil { - t := *r.paymentMethodId2 - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_method_id", s.Index(i), "multi") - } - } else { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_method_id", t, "multi") - } - } - if r.referenceId != nil { - t := *r.referenceId - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "reference_id", s.Index(i), "multi") - } - } else { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "reference_id", t, "multi") - } - } - if r.paymentMethodType != nil { - t := *r.paymentMethodType + if r.id != nil { + t := *r.id if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_method_type", s.Index(i), "multi") + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "id", s.Index(i), "multi") } } else { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_method_type", t, "multi") + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "id", t, "multi") } } - if r.channelCode != nil { - t := *r.channelCode + if r.type_ != nil { + t := *r.type_ if reflect.TypeOf(t).Kind() == reflect.Slice { s := reflect.ValueOf(t) for i := 0; i < s.Len(); i++ { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "channel_code", s.Index(i), "multi") + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "type", s.Index(i), "multi") } } else { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "channel_code", t, "multi") + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "type", t, "multi") } } if r.status != nil { @@ -897,28 +851,20 @@ func (a *PaymentMethodApiService) GetPaymentsByPaymentMethodIdExecute(r ApiGetPa utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "status", t, "multi") } } - if r.currency != nil { - t := *r.currency - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "currency", s.Index(i), "multi") - } - } else { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "currency", t, "multi") - } + if r.reusability != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "reusability", r.reusability, "") } - if r.createdGte != nil { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "created[gte]", r.createdGte, "") + if r.customerId != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "customer_id", r.customerId, "") } - if r.createdLte != nil { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "created[lte]", r.createdLte, "") + if r.referenceId != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "reference_id", r.referenceId, "") } - if r.updatedGte != nil { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "updated[gte]", r.updatedGte, "") + if r.afterId != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "after_id", r.afterId, "") } - if r.updatedLte != nil { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "updated[lte]", r.updatedLte, "") + if r.beforeId != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "before_id", r.beforeId, "") } if r.limit != nil { utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") @@ -940,9 +886,12 @@ func (a *PaymentMethodApiService) GetPaymentsByPaymentMethodIdExecute(r ApiGetPa if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.GetPaymentsByPaymentMethodIdExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.GetAllPaymentMethodsExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) @@ -962,33 +911,39 @@ func (a *PaymentMethodApiService) GetPaymentsByPaymentMethodIdExecute(r ApiGetPa return localVarReturnValue, localVarHTTPResponse, nil } -type ApiPatchPaymentMethodRequest struct { +type ApiExpirePaymentMethodRequest struct { ctx context.Context ApiService PaymentMethodApi paymentMethodId string - paymentMethodUpdateParameters *PaymentMethodUpdateParameters + forUserId *string + paymentMethodExpireParameters *PaymentMethodExpireParameters } -func (r ApiPatchPaymentMethodRequest) PaymentMethodUpdateParameters(paymentMethodUpdateParameters PaymentMethodUpdateParameters) ApiPatchPaymentMethodRequest { - r.paymentMethodUpdateParameters = &paymentMethodUpdateParameters +func (r ApiExpirePaymentMethodRequest) ForUserId(forUserId string) ApiExpirePaymentMethodRequest { + r.forUserId = &forUserId return r } -func (r ApiPatchPaymentMethodRequest) Execute() (*PaymentMethod, *http.Response, *common.XenditSdkError) { - return r.ApiService.PatchPaymentMethodExecute(r) +func (r ApiExpirePaymentMethodRequest) PaymentMethodExpireParameters(paymentMethodExpireParameters PaymentMethodExpireParameters) ApiExpirePaymentMethodRequest { + r.paymentMethodExpireParameters = &paymentMethodExpireParameters + return r +} + +func (r ApiExpirePaymentMethodRequest) Execute() (*PaymentMethod, *http.Response, *common.XenditSdkError) { + return r.ApiService.ExpirePaymentMethodExecute(r) } /* -PatchPaymentMethod Patch payment methods +ExpirePaymentMethod Expires a payment method -This endpoint is used to toggle the ```status``` of an e-Wallet or a Direct Debit payment method to ```ACTIVE``` or ```INACTIVE```. This is also used to update the details of an Over-the-Counter or a Virtual Account payment method. +This endpoint expires a payment method and performs unlinking if necessary @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param paymentMethodId - @return ApiPatchPaymentMethodRequest + @return ApiExpirePaymentMethodRequest */ -func (a *PaymentMethodApiService) PatchPaymentMethod(ctx context.Context, paymentMethodId string) ApiPatchPaymentMethodRequest { - return ApiPatchPaymentMethodRequest{ +func (a *PaymentMethodApiService) ExpirePaymentMethod(ctx context.Context, paymentMethodId string) ApiExpirePaymentMethodRequest { + return ApiExpirePaymentMethodRequest{ ApiService: a, ctx: ctx, paymentMethodId: paymentMethodId, @@ -997,20 +952,20 @@ func (a *PaymentMethodApiService) PatchPaymentMethod(ctx context.Context, paymen // Execute executes the request // @return PaymentMethod -func (a *PaymentMethodApiService) PatchPaymentMethodExecute(r ApiPatchPaymentMethodRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) { +func (a *PaymentMethodApiService) ExpirePaymentMethodExecute(r ApiExpirePaymentMethodRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) { var ( - localVarHTTPMethod = http.MethodPatch + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []common.FormFile localVarReturnValue *PaymentMethod ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentMethodApiService.PatchPaymentMethod") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentMethodApiService.ExpirePaymentMethod") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.PatchPaymentMethodExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.ExpirePaymentMethodExecute") } - localVarPath := localBasePath + "/v2/payment_methods/{paymentMethodId}" + localVarPath := localBasePath + "/v2/payment_methods/{paymentMethodId}/expire" localVarPath = strings.Replace(localVarPath, "{"+"paymentMethodId"+"}", url.PathEscape(utils.ParameterValueToString(r.paymentMethodId, "paymentMethodId")), -1) localVarHeaderParams := make(map[string]string) @@ -1034,11 +989,119 @@ func (a *PaymentMethodApiService) PatchPaymentMethodExecute(r ApiPatchPaymentMet if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } // body params - localVarPostBody = r.paymentMethodUpdateParameters + localVarPostBody = r.paymentMethodExpireParameters req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.PatchPaymentMethodExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.ExpirePaymentMethodExecute") + } + + localVarHTTPResponse, err := a.client.CallAPI(req) + + localVarBody, _ := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + + err = a.client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + + if err != nil || localVarHTTPResponse.StatusCode < 200 || localVarHTTPResponse.StatusCode >= 300 { + xenditSdkError := common.NewXenditSdkError(&localVarBody, strconv.Itoa(localVarHTTPResponse.StatusCode), localVarHTTPResponse.Status) + + return localVarReturnValue, localVarHTTPResponse, xenditSdkError + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiAuthPaymentMethodRequest struct { + ctx context.Context + ApiService PaymentMethodApi + paymentMethodId string + forUserId *string + paymentMethodAuthParameters *PaymentMethodAuthParameters +} + +func (r ApiAuthPaymentMethodRequest) ForUserId(forUserId string) ApiAuthPaymentMethodRequest { + r.forUserId = &forUserId + return r +} + +func (r ApiAuthPaymentMethodRequest) PaymentMethodAuthParameters(paymentMethodAuthParameters PaymentMethodAuthParameters) ApiAuthPaymentMethodRequest { + r.paymentMethodAuthParameters = &paymentMethodAuthParameters + return r +} + +func (r ApiAuthPaymentMethodRequest) Execute() (*PaymentMethod, *http.Response, *common.XenditSdkError) { + return r.ApiService.AuthPaymentMethodExecute(r) +} + +/* +AuthPaymentMethod Validate a payment method's linking OTP + +This endpoint validates a payment method linking OTP + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param paymentMethodId + @return ApiAuthPaymentMethodRequest +*/ +func (a *PaymentMethodApiService) AuthPaymentMethod(ctx context.Context, paymentMethodId string) ApiAuthPaymentMethodRequest { + return ApiAuthPaymentMethodRequest{ + ApiService: a, + ctx: ctx, + paymentMethodId: paymentMethodId, + } +} + +// Execute executes the request +// @return PaymentMethod +func (a *PaymentMethodApiService) AuthPaymentMethodExecute(r ApiAuthPaymentMethodRequest) (*PaymentMethod, *http.Response, *common.XenditSdkError) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []common.FormFile + localVarReturnValue *PaymentMethod + ) + + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentMethodApiService.AuthPaymentMethod") + if err != nil { + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.AuthPaymentMethodExecute") + } + + localVarPath := localBasePath + "/v2/payment_methods/{paymentMethodId}/auth" + localVarPath = strings.Replace(localVarPath, "{"+"paymentMethodId"+"}", url.PathEscape(utils.ParameterValueToString(r.paymentMethodId, "paymentMethodId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := utils.SelectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } + // body params + localVarPostBody = r.paymentMethodAuthParameters + req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentMethodApiService.AuthPaymentMethodExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) diff --git a/payment_method/model_billing_information.go b/payment_method/model_billing_information.go index 3116d09a..f7e12111 100644 --- a/payment_method/model_billing_information.go +++ b/payment_method/model_billing_information.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_card.go b/payment_method/model_card.go index 48a87113..a7b00268 100644 --- a/payment_method/model_card.go +++ b/payment_method/model_card.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_card_channel_properties.go b/payment_method/model_card_channel_properties.go index 7b300069..385e3996 100644 --- a/payment_method/model_card_channel_properties.go +++ b/payment_method/model_card_channel_properties.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_card_parameters.go b/payment_method/model_card_parameters.go index de749440..5588b728 100644 --- a/payment_method/model_card_parameters.go +++ b/payment_method/model_card_parameters.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_card_parameters_card_information.go b/payment_method/model_card_parameters_card_information.go index fd53669e..09b47cad 100644 --- a/payment_method/model_card_parameters_card_information.go +++ b/payment_method/model_card_parameters_card_information.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_card_verification_results.go b/payment_method/model_card_verification_results.go index 74385e26..157bc638 100644 --- a/payment_method/model_card_verification_results.go +++ b/payment_method/model_card_verification_results.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_card_verification_results_three_d_secure.go b/payment_method/model_card_verification_results_three_d_secure.go index 1c4a11bf..ac0c3936 100644 --- a/payment_method/model_card_verification_results_three_d_secure.go +++ b/payment_method/model_card_verification_results_three_d_secure.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_create_payment_method_409_response.go b/payment_method/model_create_payment_method_409_response.go index 5f765154..0b68b71d 100644 --- a/payment_method/model_create_payment_method_409_response.go +++ b/payment_method/model_create_payment_method_409_response.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_create_payment_method_503_response.go b/payment_method/model_create_payment_method_503_response.go index 5ef387d9..21cee348 100644 --- a/payment_method/model_create_payment_method_503_response.go +++ b/payment_method/model_create_payment_method_503_response.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_direct_debit.go b/payment_method/model_direct_debit.go index 007ffc2a..024f7ed4 100644 --- a/payment_method/model_direct_debit.go +++ b/payment_method/model_direct_debit.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_direct_debit_all_of.go b/payment_method/model_direct_debit_all_of.go index 5b233ee1..875f4f05 100644 --- a/payment_method/model_direct_debit_all_of.go +++ b/payment_method/model_direct_debit_all_of.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_direct_debit_bank_account.go b/payment_method/model_direct_debit_bank_account.go index 46a9c8a0..32d2109a 100644 --- a/payment_method/model_direct_debit_bank_account.go +++ b/payment_method/model_direct_debit_bank_account.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_direct_debit_channel_code.go b/payment_method/model_direct_debit_channel_code.go index a2acbb6e..18e79a70 100644 --- a/payment_method/model_direct_debit_channel_code.go +++ b/payment_method/model_direct_debit_channel_code.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ @@ -83,6 +83,7 @@ const ( DIRECTDEBITCHANNELCODE_RHB_FPX_BUSINESS DirectDebitChannelCode = "RHB_FPX_BUSINESS" DIRECTDEBITCHANNELCODE_SCH_FPX_BUSINESS DirectDebitChannelCode = "SCH_FPX_BUSINESS" DIRECTDEBITCHANNELCODE_UOB_FPX_BUSINESS DirectDebitChannelCode = "UOB_FPX_BUSINESS" + DIRECTDEBITCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK DirectDebitChannelCode = "UNKNOWN_ENUM_VALUE" ) // All allowed values of DirectDebitChannelCode enum @@ -150,6 +151,7 @@ var AllowedDirectDebitChannelCodeEnumValues = []DirectDebitChannelCode{ "RHB_FPX_BUSINESS", "SCH_FPX_BUSINESS", "UOB_FPX_BUSINESS", + "UNKNOWN_ENUM_VALUE", } func (v *DirectDebitChannelCode) UnmarshalJSON(src []byte) error { @@ -166,7 +168,8 @@ func (v *DirectDebitChannelCode) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid DirectDebitChannelCode", value) + *v = DIRECTDEBITCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewDirectDebitChannelCodeFromValue returns a pointer to a valid DirectDebitChannelCode diff --git a/payment_method/model_direct_debit_channel_properties.go b/payment_method/model_direct_debit_channel_properties.go index b1c745ee..b6cdca8e 100644 --- a/payment_method/model_direct_debit_channel_properties.go +++ b/payment_method/model_direct_debit_channel_properties.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_direct_debit_debit_card.go b/payment_method/model_direct_debit_debit_card.go index f89e0784..af80e807 100644 --- a/payment_method/model_direct_debit_debit_card.go +++ b/payment_method/model_direct_debit_debit_card.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_direct_debit_parameters.go b/payment_method/model_direct_debit_parameters.go index 4fd5ede4..d454c449 100644 --- a/payment_method/model_direct_debit_parameters.go +++ b/payment_method/model_direct_debit_parameters.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_direct_debit_type.go b/payment_method/model_direct_debit_type.go index dfa151cf..ca0eec47 100644 --- a/payment_method/model_direct_debit_type.go +++ b/payment_method/model_direct_debit_type.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ @@ -23,6 +23,7 @@ const ( DIRECTDEBITTYPE_DEBIT_CARD DirectDebitType = "DEBIT_CARD" DIRECTDEBITTYPE_BANK_ACCOUNT DirectDebitType = "BANK_ACCOUNT" DIRECTDEBITTYPE_BANK_REDIRECT DirectDebitType = "BANK_REDIRECT" + DIRECTDEBITTYPE_XENDIT_ENUM_DEFAULT_FALLBACK DirectDebitType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of DirectDebitType enum @@ -30,6 +31,7 @@ var AllowedDirectDebitTypeEnumValues = []DirectDebitType{ "DEBIT_CARD", "BANK_ACCOUNT", "BANK_REDIRECT", + "UNKNOWN_ENUM_VALUE", } func (v *DirectDebitType) UnmarshalJSON(src []byte) error { @@ -46,7 +48,8 @@ func (v *DirectDebitType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid DirectDebitType", value) + *v = DIRECTDEBITTYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewDirectDebitTypeFromValue returns a pointer to a valid DirectDebitType diff --git a/payment_method/model_e_wallet.go b/payment_method/model_e_wallet.go index 2a1d0ce7..04e977a4 100644 --- a/payment_method/model_e_wallet.go +++ b/payment_method/model_e_wallet.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_e_wallet_account.go b/payment_method/model_e_wallet_account.go index 477c4d28..26cfd0f8 100644 --- a/payment_method/model_e_wallet_account.go +++ b/payment_method/model_e_wallet_account.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_e_wallet_channel_code.go b/payment_method/model_e_wallet_channel_code.go index 44241bac..a0164e26 100644 --- a/payment_method/model_e_wallet_channel_code.go +++ b/payment_method/model_e_wallet_channel_code.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ @@ -40,6 +40,7 @@ const ( EWALLETCHANNELCODE_LINEPAY EWalletChannelCode = "LINEPAY" EWALLETCHANNELCODE_TRUEMONEY EWalletChannelCode = "TRUEMONEY" EWALLETCHANNELCODE_ALIPAY EWalletChannelCode = "ALIPAY" + EWALLETCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK EWalletChannelCode = "UNKNOWN_ENUM_VALUE" ) // All allowed values of EWalletChannelCode enum @@ -64,6 +65,7 @@ var AllowedEWalletChannelCodeEnumValues = []EWalletChannelCode{ "LINEPAY", "TRUEMONEY", "ALIPAY", + "UNKNOWN_ENUM_VALUE", } func (v *EWalletChannelCode) UnmarshalJSON(src []byte) error { @@ -80,7 +82,8 @@ func (v *EWalletChannelCode) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid EWalletChannelCode", value) + *v = EWALLETCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewEWalletChannelCodeFromValue returns a pointer to a valid EWalletChannelCode diff --git a/payment_method/model_e_wallet_channel_properties.go b/payment_method/model_e_wallet_channel_properties.go index 19e08e1c..9686354e 100644 --- a/payment_method/model_e_wallet_channel_properties.go +++ b/payment_method/model_e_wallet_channel_properties.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_e_wallet_parameters.go b/payment_method/model_e_wallet_parameters.go index 09a9aae1..cf06ba09 100644 --- a/payment_method/model_e_wallet_parameters.go +++ b/payment_method/model_e_wallet_parameters.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_get_all_payment_methods_400_response.go b/payment_method/model_get_all_payment_methods_400_response.go index 05eb1bc2..2e9cf969 100644 --- a/payment_method/model_get_all_payment_methods_400_response.go +++ b/payment_method/model_get_all_payment_methods_400_response.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_get_all_payment_methods_403_response.go b/payment_method/model_get_all_payment_methods_403_response.go index 885ab402..34cf98cd 100644 --- a/payment_method/model_get_all_payment_methods_403_response.go +++ b/payment_method/model_get_all_payment_methods_403_response.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_get_all_payment_methods_404_response.go b/payment_method/model_get_all_payment_methods_404_response.go index fb3461d2..8ed4bae5 100644 --- a/payment_method/model_get_all_payment_methods_404_response.go +++ b/payment_method/model_get_all_payment_methods_404_response.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_get_all_payment_methods_default_response.go b/payment_method/model_get_all_payment_methods_default_response.go index 6fc63e71..8717b231 100644 --- a/payment_method/model_get_all_payment_methods_default_response.go +++ b/payment_method/model_get_all_payment_methods_default_response.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_over_the_counter.go b/payment_method/model_over_the_counter.go index d9262749..8b1f61e4 100644 --- a/payment_method/model_over_the_counter.go +++ b/payment_method/model_over_the_counter.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_over_the_counter_channel_code.go b/payment_method/model_over_the_counter_channel_code.go index 80198071..24b6bfb6 100644 --- a/payment_method/model_over_the_counter_channel_code.go +++ b/payment_method/model_over_the_counter_channel_code.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ @@ -36,6 +36,7 @@ const ( OVERTHECOUNTERCHANNELCODE_ROBINSONS_BILLS OverTheCounterChannelCode = "ROBINSONS_BILLS" OVERTHECOUNTERCHANNELCODE_ALFAMART OverTheCounterChannelCode = "ALFAMART" OVERTHECOUNTERCHANNELCODE_INDOMARET OverTheCounterChannelCode = "INDOMARET" + OVERTHECOUNTERCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK OverTheCounterChannelCode = "UNKNOWN_ENUM_VALUE" ) // All allowed values of OverTheCounterChannelCode enum @@ -56,6 +57,7 @@ var AllowedOverTheCounterChannelCodeEnumValues = []OverTheCounterChannelCode{ "ROBINSONS_BILLS", "ALFAMART", "INDOMARET", + "UNKNOWN_ENUM_VALUE", } func (v *OverTheCounterChannelCode) UnmarshalJSON(src []byte) error { @@ -72,7 +74,8 @@ func (v *OverTheCounterChannelCode) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid OverTheCounterChannelCode", value) + *v = OVERTHECOUNTERCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewOverTheCounterChannelCodeFromValue returns a pointer to a valid OverTheCounterChannelCode diff --git a/payment_method/model_over_the_counter_channel_properties.go b/payment_method/model_over_the_counter_channel_properties.go index 2e327cc6..9d5c0b0b 100644 --- a/payment_method/model_over_the_counter_channel_properties.go +++ b/payment_method/model_over_the_counter_channel_properties.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_over_the_counter_channel_properties_update.go b/payment_method/model_over_the_counter_channel_properties_update.go index 20e77b2c..9837dbf3 100644 --- a/payment_method/model_over_the_counter_channel_properties_update.go +++ b/payment_method/model_over_the_counter_channel_properties_update.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_over_the_counter_parameters.go b/payment_method/model_over_the_counter_parameters.go index 9f8047a7..041d20fc 100644 --- a/payment_method/model_over_the_counter_parameters.go +++ b/payment_method/model_over_the_counter_parameters.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_over_the_counter_update_parameters.go b/payment_method/model_over_the_counter_update_parameters.go index 706020b3..bb904c82 100644 --- a/payment_method/model_over_the_counter_update_parameters.go +++ b/payment_method/model_over_the_counter_update_parameters.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_payment_method.go b/payment_method/model_payment_method.go index 1a43c834..42f99c50 100644 --- a/payment_method/model_payment_method.go +++ b/payment_method/model_payment_method.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_payment_method_action.go b/payment_method/model_payment_method_action.go index a6d78813..feb22f66 100644 --- a/payment_method/model_payment_method_action.go +++ b/payment_method/model_payment_method_action.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_payment_method_auth_parameters.go b/payment_method/model_payment_method_auth_parameters.go index 6f0bdc98..f75951e9 100644 --- a/payment_method/model_payment_method_auth_parameters.go +++ b/payment_method/model_payment_method_auth_parameters.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_payment_method_country.go b/payment_method/model_payment_method_country.go index 1915498f..40086ac5 100644 --- a/payment_method/model_payment_method_country.go +++ b/payment_method/model_payment_method_country.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ @@ -25,6 +25,7 @@ const ( PAYMENTMETHODCOUNTRY_VN PaymentMethodCountry = "VN" PAYMENTMETHODCOUNTRY_TH PaymentMethodCountry = "TH" PAYMENTMETHODCOUNTRY_MY PaymentMethodCountry = "MY" + PAYMENTMETHODCOUNTRY_XENDIT_ENUM_DEFAULT_FALLBACK PaymentMethodCountry = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaymentMethodCountry enum @@ -34,6 +35,7 @@ var AllowedPaymentMethodCountryEnumValues = []PaymentMethodCountry{ "VN", "TH", "MY", + "UNKNOWN_ENUM_VALUE", } func (v *PaymentMethodCountry) UnmarshalJSON(src []byte) error { @@ -50,7 +52,8 @@ func (v *PaymentMethodCountry) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaymentMethodCountry", value) + *v = PAYMENTMETHODCOUNTRY_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaymentMethodCountryFromValue returns a pointer to a valid PaymentMethodCountry diff --git a/payment_method/model_payment_method_expire_parameters.go b/payment_method/model_payment_method_expire_parameters.go index 68cd722f..57f3d586 100644 --- a/payment_method/model_payment_method_expire_parameters.go +++ b/payment_method/model_payment_method_expire_parameters.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_payment_method_list.go b/payment_method/model_payment_method_list.go index fc2a889a..df572c66 100644 --- a/payment_method/model_payment_method_list.go +++ b/payment_method/model_payment_method_list.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_payment_method_parameters.go b/payment_method/model_payment_method_parameters.go index fb8e8ef1..0a86697a 100644 --- a/payment_method/model_payment_method_parameters.go +++ b/payment_method/model_payment_method_parameters.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_payment_method_reusability.go b/payment_method/model_payment_method_reusability.go index e0cac850..1f68b919 100644 --- a/payment_method/model_payment_method_reusability.go +++ b/payment_method/model_payment_method_reusability.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ @@ -22,12 +22,14 @@ type PaymentMethodReusability string const ( PAYMENTMETHODREUSABILITY_MULTIPLE_USE PaymentMethodReusability = "MULTIPLE_USE" PAYMENTMETHODREUSABILITY_ONE_TIME_USE PaymentMethodReusability = "ONE_TIME_USE" + PAYMENTMETHODREUSABILITY_XENDIT_ENUM_DEFAULT_FALLBACK PaymentMethodReusability = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaymentMethodReusability enum var AllowedPaymentMethodReusabilityEnumValues = []PaymentMethodReusability{ "MULTIPLE_USE", "ONE_TIME_USE", + "UNKNOWN_ENUM_VALUE", } func (v *PaymentMethodReusability) UnmarshalJSON(src []byte) error { @@ -44,7 +46,8 @@ func (v *PaymentMethodReusability) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaymentMethodReusability", value) + *v = PAYMENTMETHODREUSABILITY_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaymentMethodReusabilityFromValue returns a pointer to a valid PaymentMethodReusability diff --git a/payment_method/model_payment_method_status.go b/payment_method/model_payment_method_status.go index b59f0e51..70bd1aa6 100644 --- a/payment_method/model_payment_method_status.go +++ b/payment_method/model_payment_method_status.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ @@ -26,6 +26,7 @@ const ( PAYMENTMETHODSTATUS_PENDING PaymentMethodStatus = "PENDING" PAYMENTMETHODSTATUS_REQUIRES_ACTION PaymentMethodStatus = "REQUIRES_ACTION" PAYMENTMETHODSTATUS_FAILED PaymentMethodStatus = "FAILED" + PAYMENTMETHODSTATUS_XENDIT_ENUM_DEFAULT_FALLBACK PaymentMethodStatus = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaymentMethodStatus enum @@ -36,6 +37,7 @@ var AllowedPaymentMethodStatusEnumValues = []PaymentMethodStatus{ "PENDING", "REQUIRES_ACTION", "FAILED", + "UNKNOWN_ENUM_VALUE", } func (v *PaymentMethodStatus) UnmarshalJSON(src []byte) error { @@ -52,7 +54,8 @@ func (v *PaymentMethodStatus) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaymentMethodStatus", value) + *v = PAYMENTMETHODSTATUS_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaymentMethodStatusFromValue returns a pointer to a valid PaymentMethodStatus diff --git a/payment_method/model_payment_method_type.go b/payment_method/model_payment_method_type.go index 4674286d..f68e60c5 100644 --- a/payment_method/model_payment_method_type.go +++ b/payment_method/model_payment_method_type.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ @@ -28,6 +28,7 @@ const ( PAYMENTMETHODTYPE_OVER_THE_COUNTER PaymentMethodType = "OVER_THE_COUNTER" PAYMENTMETHODTYPE_QR_CODE PaymentMethodType = "QR_CODE" PAYMENTMETHODTYPE_VIRTUAL_ACCOUNT PaymentMethodType = "VIRTUAL_ACCOUNT" + PAYMENTMETHODTYPE_XENDIT_ENUM_DEFAULT_FALLBACK PaymentMethodType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaymentMethodType enum @@ -40,6 +41,7 @@ var AllowedPaymentMethodTypeEnumValues = []PaymentMethodType{ "OVER_THE_COUNTER", "QR_CODE", "VIRTUAL_ACCOUNT", + "UNKNOWN_ENUM_VALUE", } func (v *PaymentMethodType) UnmarshalJSON(src []byte) error { @@ -56,7 +58,8 @@ func (v *PaymentMethodType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaymentMethodType", value) + *v = PAYMENTMETHODTYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaymentMethodTypeFromValue returns a pointer to a valid PaymentMethodType diff --git a/payment_method/model_payment_method_update_parameters.go b/payment_method/model_payment_method_update_parameters.go index 9fc3593f..d445d340 100644 --- a/payment_method/model_payment_method_update_parameters.go +++ b/payment_method/model_payment_method_update_parameters.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_qr_code.go b/payment_method/model_qr_code.go index bf035fac..b8cba059 100644 --- a/payment_method/model_qr_code.go +++ b/payment_method/model_qr_code.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_qr_code_channel_code.go b/payment_method/model_qr_code_channel_code.go index e23658b1..0d8fcbcd 100644 --- a/payment_method/model_qr_code_channel_code.go +++ b/payment_method/model_qr_code_channel_code.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ @@ -25,6 +25,7 @@ const ( QRCODECHANNELCODE_RCBC QRCodeChannelCode = "RCBC" QRCODECHANNELCODE_PROMPTPAY QRCodeChannelCode = "PROMPTPAY" QRCODECHANNELCODE_LINKAJA QRCodeChannelCode = "LINKAJA" + QRCODECHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK QRCodeChannelCode = "UNKNOWN_ENUM_VALUE" ) // All allowed values of QRCodeChannelCode enum @@ -34,6 +35,7 @@ var AllowedQRCodeChannelCodeEnumValues = []QRCodeChannelCode{ "RCBC", "PROMPTPAY", "LINKAJA", + "UNKNOWN_ENUM_VALUE", } func (v *QRCodeChannelCode) UnmarshalJSON(src []byte) error { @@ -50,7 +52,8 @@ func (v *QRCodeChannelCode) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid QRCodeChannelCode", value) + *v = QRCODECHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewQRCodeChannelCodeFromValue returns a pointer to a valid QRCodeChannelCode diff --git a/payment_method/model_qr_code_channel_properties.go b/payment_method/model_qr_code_channel_properties.go index ecc3f23e..d05ee4d7 100644 --- a/payment_method/model_qr_code_channel_properties.go +++ b/payment_method/model_qr_code_channel_properties.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_qr_code_parameters.go b/payment_method/model_qr_code_parameters.go index 8d196a0e..54f19940 100644 --- a/payment_method/model_qr_code_parameters.go +++ b/payment_method/model_qr_code_parameters.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_simulate_payment_request.go b/payment_method/model_simulate_payment_request.go index 5f44339a..47c134cd 100644 --- a/payment_method/model_simulate_payment_request.go +++ b/payment_method/model_simulate_payment_request.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_tokenized_card_information.go b/payment_method/model_tokenized_card_information.go index d5c63dda..3221bca8 100644 --- a/payment_method/model_tokenized_card_information.go +++ b/payment_method/model_tokenized_card_information.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_virtual_account.go b/payment_method/model_virtual_account.go index 54160335..d0982eb0 100644 --- a/payment_method/model_virtual_account.go +++ b/payment_method/model_virtual_account.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_virtual_account_all_of.go b/payment_method/model_virtual_account_all_of.go index d78f4ea1..02f486f5 100644 --- a/payment_method/model_virtual_account_all_of.go +++ b/payment_method/model_virtual_account_all_of.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_virtual_account_alternative_display.go b/payment_method/model_virtual_account_alternative_display.go index cb71411f..68451f6d 100644 --- a/payment_method/model_virtual_account_alternative_display.go +++ b/payment_method/model_virtual_account_alternative_display.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_virtual_account_channel_code.go b/payment_method/model_virtual_account_channel_code.go index bb3c383d..340cd99f 100644 --- a/payment_method/model_virtual_account_channel_code.go +++ b/payment_method/model_virtual_account_channel_code.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ @@ -35,6 +35,7 @@ const ( VIRTUALACCOUNTCHANNELCODE_WOORI VirtualAccountChannelCode = "WOORI" VIRTUALACCOUNTCHANNELCODE_MSB VirtualAccountChannelCode = "MSB" VIRTUALACCOUNTCHANNELCODE_STANDARD_CHARTERED VirtualAccountChannelCode = "STANDARD_CHARTERED" + VIRTUALACCOUNTCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK VirtualAccountChannelCode = "UNKNOWN_ENUM_VALUE" ) // All allowed values of VirtualAccountChannelCode enum @@ -54,6 +55,7 @@ var AllowedVirtualAccountChannelCodeEnumValues = []VirtualAccountChannelCode{ "WOORI", "MSB", "STANDARD_CHARTERED", + "UNKNOWN_ENUM_VALUE", } func (v *VirtualAccountChannelCode) UnmarshalJSON(src []byte) error { @@ -70,7 +72,8 @@ func (v *VirtualAccountChannelCode) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid VirtualAccountChannelCode", value) + *v = VIRTUALACCOUNTCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewVirtualAccountChannelCodeFromValue returns a pointer to a valid VirtualAccountChannelCode diff --git a/payment_method/model_virtual_account_channel_properties.go b/payment_method/model_virtual_account_channel_properties.go index 23afc79a..2234041c 100644 --- a/payment_method/model_virtual_account_channel_properties.go +++ b/payment_method/model_virtual_account_channel_properties.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_virtual_account_channel_properties_patch.go b/payment_method/model_virtual_account_channel_properties_patch.go index 071197a3..1baf75f3 100644 --- a/payment_method/model_virtual_account_channel_properties_patch.go +++ b/payment_method/model_virtual_account_channel_properties_patch.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_virtual_account_parameters.go b/payment_method/model_virtual_account_parameters.go index d66206d7..71cffe47 100644 --- a/payment_method/model_virtual_account_parameters.go +++ b/payment_method/model_virtual_account_parameters.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_method/model_virtual_account_update_parameters.go b/payment_method/model_virtual_account_update_parameters.go index 5652360c..0919ed70 100644 --- a/payment_method/model_virtual_account_update_parameters.go +++ b/payment_method/model_virtual_account_update_parameters.go @@ -3,7 +3,7 @@ Payment Method Service v2 This API is used for Payment Method Service v2 -API version: 2.89.1 +API version: 2.89.2 */ diff --git a/payment_request/api_payment_request.go b/payment_request/api_payment_request.go index 9a442c13..01ad0df1 100644 --- a/payment_request/api_payment_request.go +++ b/payment_request/api_payment_request.go @@ -18,48 +18,48 @@ import ( type PaymentRequestApi interface { /* - AuthorizePaymentRequest Payment Request Authorize + CreatePaymentRequest Create Payment Request - Payment Request Authorize + Create Payment Request @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param paymentRequestId - @return ApiAuthorizePaymentRequestRequest + @return ApiCreatePaymentRequestRequest */ - AuthorizePaymentRequest(ctx context.Context, paymentRequestId string) ApiAuthorizePaymentRequestRequest + CreatePaymentRequest(ctx context.Context) ApiCreatePaymentRequestRequest - // AuthorizePaymentRequestExecute executes the request + // CreatePaymentRequestExecute executes the request // @return PaymentRequest - AuthorizePaymentRequestExecute(r ApiAuthorizePaymentRequestRequest) (*PaymentRequest, *http.Response, *common.XenditSdkError) + CreatePaymentRequestExecute(r ApiCreatePaymentRequestRequest) (*PaymentRequest, *http.Response, *common.XenditSdkError) /* - CapturePaymentRequest Payment Request Capture + GetPaymentRequestByID Get payment request by ID - Payment Request Capture + Get payment request by ID @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param paymentRequestId - @return ApiCapturePaymentRequestRequest + @return ApiGetPaymentRequestByIDRequest */ - CapturePaymentRequest(ctx context.Context, paymentRequestId string) ApiCapturePaymentRequestRequest + GetPaymentRequestByID(ctx context.Context, paymentRequestId string) ApiGetPaymentRequestByIDRequest - // CapturePaymentRequestExecute executes the request - // @return Capture - CapturePaymentRequestExecute(r ApiCapturePaymentRequestRequest) (*Capture, *http.Response, *common.XenditSdkError) + // GetPaymentRequestByIDExecute executes the request + // @return PaymentRequest + GetPaymentRequestByIDExecute(r ApiGetPaymentRequestByIDRequest) (*PaymentRequest, *http.Response, *common.XenditSdkError) /* - CreatePaymentRequest Create Payment Request + GetPaymentRequestCaptures Get Payment Request Capture - Create Payment Request + Get Payment Request Capture @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiCreatePaymentRequestRequest + @param paymentRequestId + @return ApiGetPaymentRequestCapturesRequest */ - CreatePaymentRequest(ctx context.Context) ApiCreatePaymentRequestRequest + GetPaymentRequestCaptures(ctx context.Context, paymentRequestId string) ApiGetPaymentRequestCapturesRequest - // CreatePaymentRequestExecute executes the request - // @return PaymentRequest - CreatePaymentRequestExecute(r ApiCreatePaymentRequestRequest) (*PaymentRequest, *http.Response, *common.XenditSdkError) + // GetPaymentRequestCapturesExecute executes the request + // @return CaptureListResponse + GetPaymentRequestCapturesExecute(r ApiGetPaymentRequestCapturesRequest) (*CaptureListResponse, *http.Response, *common.XenditSdkError) /* GetAllPaymentRequests Get all payment requests by filter @@ -76,34 +76,34 @@ type PaymentRequestApi interface { GetAllPaymentRequestsExecute(r ApiGetAllPaymentRequestsRequest) (*PaymentRequestListResponse, *http.Response, *common.XenditSdkError) /* - GetPaymentRequestByID Get payment request by ID + CapturePaymentRequest Payment Request Capture - Get payment request by ID + Payment Request Capture @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param paymentRequestId - @return ApiGetPaymentRequestByIDRequest + @return ApiCapturePaymentRequestRequest */ - GetPaymentRequestByID(ctx context.Context, paymentRequestId string) ApiGetPaymentRequestByIDRequest + CapturePaymentRequest(ctx context.Context, paymentRequestId string) ApiCapturePaymentRequestRequest - // GetPaymentRequestByIDExecute executes the request - // @return PaymentRequest - GetPaymentRequestByIDExecute(r ApiGetPaymentRequestByIDRequest) (*PaymentRequest, *http.Response, *common.XenditSdkError) + // CapturePaymentRequestExecute executes the request + // @return Capture + CapturePaymentRequestExecute(r ApiCapturePaymentRequestRequest) (*Capture, *http.Response, *common.XenditSdkError) /* - GetPaymentRequestCaptures Get Payment Request Capture + AuthorizePaymentRequest Payment Request Authorize - Get Payment Request Capture + Payment Request Authorize @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param paymentRequestId - @return ApiGetPaymentRequestCapturesRequest + @return ApiAuthorizePaymentRequestRequest */ - GetPaymentRequestCaptures(ctx context.Context, paymentRequestId string) ApiGetPaymentRequestCapturesRequest + AuthorizePaymentRequest(ctx context.Context, paymentRequestId string) ApiAuthorizePaymentRequestRequest - // GetPaymentRequestCapturesExecute executes the request - // @return CaptureListResponse - GetPaymentRequestCapturesExecute(r ApiGetPaymentRequestCapturesRequest) (*CaptureListResponse, *http.Response, *common.XenditSdkError) + // AuthorizePaymentRequestExecute executes the request + // @return PaymentRequest + AuthorizePaymentRequestExecute(r ApiAuthorizePaymentRequestRequest) (*PaymentRequest, *http.Response, *common.XenditSdkError) /* ResendPaymentRequestAuth Payment Request Resend Auth @@ -134,42 +134,51 @@ func NewPaymentRequestApi (client common.IClient) PaymentRequestApi { } -type ApiAuthorizePaymentRequestRequest struct { +type ApiCreatePaymentRequestRequest struct { ctx context.Context ApiService PaymentRequestApi - paymentRequestId string - paymentRequestAuthParameters *PaymentRequestAuthParameters + idempotencyKey *string + forUserId *string + paymentRequestParameters *PaymentRequestParameters } -func (r ApiAuthorizePaymentRequestRequest) PaymentRequestAuthParameters(paymentRequestAuthParameters PaymentRequestAuthParameters) ApiAuthorizePaymentRequestRequest { - r.paymentRequestAuthParameters = &paymentRequestAuthParameters +func (r ApiCreatePaymentRequestRequest) IdempotencyKey(idempotencyKey string) ApiCreatePaymentRequestRequest { + r.idempotencyKey = &idempotencyKey return r } -func (r ApiAuthorizePaymentRequestRequest) Execute() (*PaymentRequest, *http.Response, *common.XenditSdkError) { - return r.ApiService.AuthorizePaymentRequestExecute(r) +func (r ApiCreatePaymentRequestRequest) ForUserId(forUserId string) ApiCreatePaymentRequestRequest { + r.forUserId = &forUserId + return r +} + +func (r ApiCreatePaymentRequestRequest) PaymentRequestParameters(paymentRequestParameters PaymentRequestParameters) ApiCreatePaymentRequestRequest { + r.paymentRequestParameters = &paymentRequestParameters + return r +} + +func (r ApiCreatePaymentRequestRequest) Execute() (*PaymentRequest, *http.Response, *common.XenditSdkError) { + return r.ApiService.CreatePaymentRequestExecute(r) } /* -AuthorizePaymentRequest Payment Request Authorize +CreatePaymentRequest Create Payment Request -Payment Request Authorize +Create Payment Request @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param paymentRequestId - @return ApiAuthorizePaymentRequestRequest + @return ApiCreatePaymentRequestRequest */ -func (a *PaymentRequestApiService) AuthorizePaymentRequest(ctx context.Context, paymentRequestId string) ApiAuthorizePaymentRequestRequest { - return ApiAuthorizePaymentRequestRequest{ +func (a *PaymentRequestApiService) CreatePaymentRequest(ctx context.Context) ApiCreatePaymentRequestRequest { + return ApiCreatePaymentRequestRequest{ ApiService: a, ctx: ctx, - paymentRequestId: paymentRequestId, } } // Execute executes the request // @return PaymentRequest -func (a *PaymentRequestApiService) AuthorizePaymentRequestExecute(r ApiAuthorizePaymentRequestRequest) (*PaymentRequest, *http.Response, *common.XenditSdkError) { +func (a *PaymentRequestApiService) CreatePaymentRequestExecute(r ApiCreatePaymentRequestRequest) (*PaymentRequest, *http.Response, *common.XenditSdkError) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} @@ -177,13 +186,12 @@ func (a *PaymentRequestApiService) AuthorizePaymentRequestExecute(r ApiAuthorize localVarReturnValue *PaymentRequest ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentRequestApiService.AuthorizePaymentRequest") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentRequestApiService.CreatePaymentRequest") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.AuthorizePaymentRequestExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.CreatePaymentRequestExecute") } - localVarPath := localBasePath + "/payment_requests/{paymentRequestId}/auth" - localVarPath = strings.Replace(localVarPath, "{"+"paymentRequestId"+"}", url.PathEscape(utils.ParameterValueToString(r.paymentRequestId, "paymentRequestId")), -1) + localVarPath := localBasePath + "/payment_requests" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -206,11 +214,17 @@ func (a *PaymentRequestApiService) AuthorizePaymentRequestExecute(r ApiAuthorize if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.idempotencyKey != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "idempotency-key", r.idempotencyKey, "") + } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } // body params - localVarPostBody = r.paymentRequestAuthParameters + localVarPostBody = r.paymentRequestParameters req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.AuthorizePaymentRequestExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.CreatePaymentRequestExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) @@ -230,33 +244,33 @@ func (a *PaymentRequestApiService) AuthorizePaymentRequestExecute(r ApiAuthorize return localVarReturnValue, localVarHTTPResponse, nil } -type ApiCapturePaymentRequestRequest struct { +type ApiGetPaymentRequestByIDRequest struct { ctx context.Context ApiService PaymentRequestApi paymentRequestId string - captureParameters *CaptureParameters + forUserId *string } -func (r ApiCapturePaymentRequestRequest) CaptureParameters(captureParameters CaptureParameters) ApiCapturePaymentRequestRequest { - r.captureParameters = &captureParameters +func (r ApiGetPaymentRequestByIDRequest) ForUserId(forUserId string) ApiGetPaymentRequestByIDRequest { + r.forUserId = &forUserId return r } -func (r ApiCapturePaymentRequestRequest) Execute() (*Capture, *http.Response, *common.XenditSdkError) { - return r.ApiService.CapturePaymentRequestExecute(r) +func (r ApiGetPaymentRequestByIDRequest) Execute() (*PaymentRequest, *http.Response, *common.XenditSdkError) { + return r.ApiService.GetPaymentRequestByIDExecute(r) } /* -CapturePaymentRequest Payment Request Capture +GetPaymentRequestByID Get payment request by ID -Payment Request Capture +Get payment request by ID @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param paymentRequestId - @return ApiCapturePaymentRequestRequest + @return ApiGetPaymentRequestByIDRequest */ -func (a *PaymentRequestApiService) CapturePaymentRequest(ctx context.Context, paymentRequestId string) ApiCapturePaymentRequestRequest { - return ApiCapturePaymentRequestRequest{ +func (a *PaymentRequestApiService) GetPaymentRequestByID(ctx context.Context, paymentRequestId string) ApiGetPaymentRequestByIDRequest { + return ApiGetPaymentRequestByIDRequest{ ApiService: a, ctx: ctx, paymentRequestId: paymentRequestId, @@ -264,21 +278,21 @@ func (a *PaymentRequestApiService) CapturePaymentRequest(ctx context.Context, pa } // Execute executes the request -// @return Capture -func (a *PaymentRequestApiService) CapturePaymentRequestExecute(r ApiCapturePaymentRequestRequest) (*Capture, *http.Response, *common.XenditSdkError) { +// @return PaymentRequest +func (a *PaymentRequestApiService) GetPaymentRequestByIDExecute(r ApiGetPaymentRequestByIDRequest) (*PaymentRequest, *http.Response, *common.XenditSdkError) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []common.FormFile - localVarReturnValue *Capture + localVarReturnValue *PaymentRequest ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentRequestApiService.CapturePaymentRequest") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentRequestApiService.GetPaymentRequestByID") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.CapturePaymentRequestExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.GetPaymentRequestByIDExecute") } - localVarPath := localBasePath + "/payment_requests/{paymentRequestId}/captures" + localVarPath := localBasePath + "/payment_requests/{paymentRequestId}" localVarPath = strings.Replace(localVarPath, "{"+"paymentRequestId"+"}", url.PathEscape(utils.ParameterValueToString(r.paymentRequestId, "paymentRequestId")), -1) localVarHeaderParams := make(map[string]string) @@ -286,7 +300,7 @@ func (a *PaymentRequestApiService) CapturePaymentRequestExecute(r ApiCapturePaym localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) @@ -302,11 +316,12 @@ func (a *PaymentRequestApiService) CapturePaymentRequestExecute(r ApiCapturePaym if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.captureParameters + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.CapturePaymentRequestExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.GetPaymentRequestByIDExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) @@ -326,65 +341,72 @@ func (a *PaymentRequestApiService) CapturePaymentRequestExecute(r ApiCapturePaym return localVarReturnValue, localVarHTTPResponse, nil } -type ApiCreatePaymentRequestRequest struct { +type ApiGetPaymentRequestCapturesRequest struct { ctx context.Context ApiService PaymentRequestApi - idempotencyKey *string - paymentRequestParameters *PaymentRequestParameters + paymentRequestId string + forUserId *string + limit *int32 } -func (r ApiCreatePaymentRequestRequest) IdempotencyKey(idempotencyKey string) ApiCreatePaymentRequestRequest { - r.idempotencyKey = &idempotencyKey +func (r ApiGetPaymentRequestCapturesRequest) ForUserId(forUserId string) ApiGetPaymentRequestCapturesRequest { + r.forUserId = &forUserId return r } -func (r ApiCreatePaymentRequestRequest) PaymentRequestParameters(paymentRequestParameters PaymentRequestParameters) ApiCreatePaymentRequestRequest { - r.paymentRequestParameters = &paymentRequestParameters +func (r ApiGetPaymentRequestCapturesRequest) Limit(limit int32) ApiGetPaymentRequestCapturesRequest { + r.limit = &limit return r } -func (r ApiCreatePaymentRequestRequest) Execute() (*PaymentRequest, *http.Response, *common.XenditSdkError) { - return r.ApiService.CreatePaymentRequestExecute(r) +func (r ApiGetPaymentRequestCapturesRequest) Execute() (*CaptureListResponse, *http.Response, *common.XenditSdkError) { + return r.ApiService.GetPaymentRequestCapturesExecute(r) } /* -CreatePaymentRequest Create Payment Request +GetPaymentRequestCaptures Get Payment Request Capture -Create Payment Request +Get Payment Request Capture @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiCreatePaymentRequestRequest + @param paymentRequestId + @return ApiGetPaymentRequestCapturesRequest */ -func (a *PaymentRequestApiService) CreatePaymentRequest(ctx context.Context) ApiCreatePaymentRequestRequest { - return ApiCreatePaymentRequestRequest{ +func (a *PaymentRequestApiService) GetPaymentRequestCaptures(ctx context.Context, paymentRequestId string) ApiGetPaymentRequestCapturesRequest { + return ApiGetPaymentRequestCapturesRequest{ ApiService: a, ctx: ctx, + paymentRequestId: paymentRequestId, } } // Execute executes the request -// @return PaymentRequest -func (a *PaymentRequestApiService) CreatePaymentRequestExecute(r ApiCreatePaymentRequestRequest) (*PaymentRequest, *http.Response, *common.XenditSdkError) { +// @return CaptureListResponse +func (a *PaymentRequestApiService) GetPaymentRequestCapturesExecute(r ApiGetPaymentRequestCapturesRequest) (*CaptureListResponse, *http.Response, *common.XenditSdkError) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []common.FormFile - localVarReturnValue *PaymentRequest + localVarReturnValue *CaptureListResponse ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentRequestApiService.CreatePaymentRequest") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentRequestApiService.GetPaymentRequestCaptures") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.CreatePaymentRequestExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.GetPaymentRequestCapturesExecute") } - localVarPath := localBasePath + "/payment_requests" + localVarPath := localBasePath + "/payment_requests/{paymentRequestId}/captures" + localVarPath = strings.Replace(localVarPath, "{"+"paymentRequestId"+"}", url.PathEscape(utils.ParameterValueToString(r.paymentRequestId, "paymentRequestId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.limit != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) @@ -400,14 +422,12 @@ func (a *PaymentRequestApiService) CreatePaymentRequestExecute(r ApiCreatePaymen if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - if r.idempotencyKey != nil { - utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "idempotency-key", r.idempotencyKey, "") + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") } - // body params - localVarPostBody = r.paymentRequestParameters req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.CreatePaymentRequestExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.GetPaymentRequestCapturesExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) @@ -430,6 +450,7 @@ func (a *PaymentRequestApiService) CreatePaymentRequestExecute(r ApiCreatePaymen type ApiGetAllPaymentRequestsRequest struct { ctx context.Context ApiService PaymentRequestApi + forUserId *string referenceId *[]string id *[]string customerId *[]string @@ -438,6 +459,11 @@ type ApiGetAllPaymentRequestsRequest struct { afterId *string } +func (r ApiGetAllPaymentRequestsRequest) ForUserId(forUserId string) ApiGetAllPaymentRequestsRequest { + r.forUserId = &forUserId + return r +} + func (r ApiGetAllPaymentRequestsRequest) ReferenceId(referenceId []string) ApiGetAllPaymentRequestsRequest { r.referenceId = &referenceId return r @@ -567,6 +593,9 @@ func (a *PaymentRequestApiService) GetAllPaymentRequestsExecute(r ApiGetAllPayme if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.GetAllPaymentRequestsExecute") @@ -589,27 +618,39 @@ func (a *PaymentRequestApiService) GetAllPaymentRequestsExecute(r ApiGetAllPayme return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetPaymentRequestByIDRequest struct { +type ApiCapturePaymentRequestRequest struct { ctx context.Context ApiService PaymentRequestApi paymentRequestId string + forUserId *string + captureParameters *CaptureParameters } -func (r ApiGetPaymentRequestByIDRequest) Execute() (*PaymentRequest, *http.Response, *common.XenditSdkError) { - return r.ApiService.GetPaymentRequestByIDExecute(r) +func (r ApiCapturePaymentRequestRequest) ForUserId(forUserId string) ApiCapturePaymentRequestRequest { + r.forUserId = &forUserId + return r +} + +func (r ApiCapturePaymentRequestRequest) CaptureParameters(captureParameters CaptureParameters) ApiCapturePaymentRequestRequest { + r.captureParameters = &captureParameters + return r +} + +func (r ApiCapturePaymentRequestRequest) Execute() (*Capture, *http.Response, *common.XenditSdkError) { + return r.ApiService.CapturePaymentRequestExecute(r) } /* -GetPaymentRequestByID Get payment request by ID +CapturePaymentRequest Payment Request Capture -Get payment request by ID +Payment Request Capture @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param paymentRequestId - @return ApiGetPaymentRequestByIDRequest + @return ApiCapturePaymentRequestRequest */ -func (a *PaymentRequestApiService) GetPaymentRequestByID(ctx context.Context, paymentRequestId string) ApiGetPaymentRequestByIDRequest { - return ApiGetPaymentRequestByIDRequest{ +func (a *PaymentRequestApiService) CapturePaymentRequest(ctx context.Context, paymentRequestId string) ApiCapturePaymentRequestRequest { + return ApiCapturePaymentRequestRequest{ ApiService: a, ctx: ctx, paymentRequestId: paymentRequestId, @@ -617,21 +658,21 @@ func (a *PaymentRequestApiService) GetPaymentRequestByID(ctx context.Context, pa } // Execute executes the request -// @return PaymentRequest -func (a *PaymentRequestApiService) GetPaymentRequestByIDExecute(r ApiGetPaymentRequestByIDRequest) (*PaymentRequest, *http.Response, *common.XenditSdkError) { +// @return Capture +func (a *PaymentRequestApiService) CapturePaymentRequestExecute(r ApiCapturePaymentRequestRequest) (*Capture, *http.Response, *common.XenditSdkError) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []common.FormFile - localVarReturnValue *PaymentRequest + localVarReturnValue *Capture ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentRequestApiService.GetPaymentRequestByID") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentRequestApiService.CapturePaymentRequest") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.GetPaymentRequestByIDExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.CapturePaymentRequestExecute") } - localVarPath := localBasePath + "/payment_requests/{paymentRequestId}" + localVarPath := localBasePath + "/payment_requests/{paymentRequestId}/captures" localVarPath = strings.Replace(localVarPath, "{"+"paymentRequestId"+"}", url.PathEscape(utils.ParameterValueToString(r.paymentRequestId, "paymentRequestId")), -1) localVarHeaderParams := make(map[string]string) @@ -639,7 +680,7 @@ func (a *PaymentRequestApiService) GetPaymentRequestByIDExecute(r ApiGetPaymentR localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) @@ -655,9 +696,14 @@ func (a *PaymentRequestApiService) GetPaymentRequestByIDExecute(r ApiGetPaymentR if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } + // body params + localVarPostBody = r.captureParameters req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.GetPaymentRequestByIDExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.CapturePaymentRequestExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) @@ -677,33 +723,39 @@ func (a *PaymentRequestApiService) GetPaymentRequestByIDExecute(r ApiGetPaymentR return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetPaymentRequestCapturesRequest struct { +type ApiAuthorizePaymentRequestRequest struct { ctx context.Context ApiService PaymentRequestApi paymentRequestId string - limit *int32 + forUserId *string + paymentRequestAuthParameters *PaymentRequestAuthParameters } -func (r ApiGetPaymentRequestCapturesRequest) Limit(limit int32) ApiGetPaymentRequestCapturesRequest { - r.limit = &limit +func (r ApiAuthorizePaymentRequestRequest) ForUserId(forUserId string) ApiAuthorizePaymentRequestRequest { + r.forUserId = &forUserId return r } -func (r ApiGetPaymentRequestCapturesRequest) Execute() (*CaptureListResponse, *http.Response, *common.XenditSdkError) { - return r.ApiService.GetPaymentRequestCapturesExecute(r) +func (r ApiAuthorizePaymentRequestRequest) PaymentRequestAuthParameters(paymentRequestAuthParameters PaymentRequestAuthParameters) ApiAuthorizePaymentRequestRequest { + r.paymentRequestAuthParameters = &paymentRequestAuthParameters + return r +} + +func (r ApiAuthorizePaymentRequestRequest) Execute() (*PaymentRequest, *http.Response, *common.XenditSdkError) { + return r.ApiService.AuthorizePaymentRequestExecute(r) } /* -GetPaymentRequestCaptures Get Payment Request Capture +AuthorizePaymentRequest Payment Request Authorize -Get Payment Request Capture +Payment Request Authorize @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param paymentRequestId - @return ApiGetPaymentRequestCapturesRequest + @return ApiAuthorizePaymentRequestRequest */ -func (a *PaymentRequestApiService) GetPaymentRequestCaptures(ctx context.Context, paymentRequestId string) ApiGetPaymentRequestCapturesRequest { - return ApiGetPaymentRequestCapturesRequest{ +func (a *PaymentRequestApiService) AuthorizePaymentRequest(ctx context.Context, paymentRequestId string) ApiAuthorizePaymentRequestRequest { + return ApiAuthorizePaymentRequestRequest{ ApiService: a, ctx: ctx, paymentRequestId: paymentRequestId, @@ -711,32 +763,29 @@ func (a *PaymentRequestApiService) GetPaymentRequestCaptures(ctx context.Context } // Execute executes the request -// @return CaptureListResponse -func (a *PaymentRequestApiService) GetPaymentRequestCapturesExecute(r ApiGetPaymentRequestCapturesRequest) (*CaptureListResponse, *http.Response, *common.XenditSdkError) { +// @return PaymentRequest +func (a *PaymentRequestApiService) AuthorizePaymentRequestExecute(r ApiAuthorizePaymentRequestRequest) (*PaymentRequest, *http.Response, *common.XenditSdkError) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []common.FormFile - localVarReturnValue *CaptureListResponse + localVarReturnValue *PaymentRequest ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentRequestApiService.GetPaymentRequestCaptures") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PaymentRequestApiService.AuthorizePaymentRequest") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.GetPaymentRequestCapturesExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.AuthorizePaymentRequestExecute") } - localVarPath := localBasePath + "/payment_requests/{paymentRequestId}/captures" + localVarPath := localBasePath + "/payment_requests/{paymentRequestId}/auth" localVarPath = strings.Replace(localVarPath, "{"+"paymentRequestId"+"}", url.PathEscape(utils.ParameterValueToString(r.paymentRequestId, "paymentRequestId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.limit != nil { - utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") - } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) @@ -752,9 +801,14 @@ func (a *PaymentRequestApiService) GetPaymentRequestCapturesExecute(r ApiGetPaym if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } + // body params + localVarPostBody = r.paymentRequestAuthParameters req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.GetPaymentRequestCapturesExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.AuthorizePaymentRequestExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) @@ -778,6 +832,12 @@ type ApiResendPaymentRequestAuthRequest struct { ctx context.Context ApiService PaymentRequestApi paymentRequestId string + forUserId *string +} + +func (r ApiResendPaymentRequestAuthRequest) ForUserId(forUserId string) ApiResendPaymentRequestAuthRequest { + r.forUserId = &forUserId + return r } func (r ApiResendPaymentRequestAuthRequest) Execute() (*PaymentRequest, *http.Response, *common.XenditSdkError) { @@ -840,6 +900,9 @@ func (a *PaymentRequestApiService) ResendPaymentRequestAuthExecute(r ApiResendPa if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PaymentRequestApiService.ResendPaymentRequestAuthExecute") diff --git a/payment_request/model_direct_debit_channel_code.go b/payment_request/model_direct_debit_channel_code.go index 71c6a0d4..9384e0da 100644 --- a/payment_request/model_direct_debit_channel_code.go +++ b/payment_request/model_direct_debit_channel_code.go @@ -83,6 +83,7 @@ const ( DIRECTDEBITCHANNELCODE_RHB_FPX_BUSINESS DirectDebitChannelCode = "RHB_FPX_BUSINESS" DIRECTDEBITCHANNELCODE_SCH_FPX_BUSINESS DirectDebitChannelCode = "SCH_FPX_BUSINESS" DIRECTDEBITCHANNELCODE_UOB_FPX_BUSINESS DirectDebitChannelCode = "UOB_FPX_BUSINESS" + DIRECTDEBITCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK DirectDebitChannelCode = "UNKNOWN_ENUM_VALUE" ) // All allowed values of DirectDebitChannelCode enum @@ -150,6 +151,7 @@ var AllowedDirectDebitChannelCodeEnumValues = []DirectDebitChannelCode{ "RHB_FPX_BUSINESS", "SCH_FPX_BUSINESS", "UOB_FPX_BUSINESS", + "UNKNOWN_ENUM_VALUE", } func (v *DirectDebitChannelCode) UnmarshalJSON(src []byte) error { @@ -166,7 +168,8 @@ func (v *DirectDebitChannelCode) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid DirectDebitChannelCode", value) + *v = DIRECTDEBITCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewDirectDebitChannelCodeFromValue returns a pointer to a valid DirectDebitChannelCode diff --git a/payment_request/model_direct_debit_type.go b/payment_request/model_direct_debit_type.go index 748c0b96..9ac26706 100644 --- a/payment_request/model_direct_debit_type.go +++ b/payment_request/model_direct_debit_type.go @@ -23,6 +23,7 @@ const ( DIRECTDEBITTYPE_DEBIT_CARD DirectDebitType = "DEBIT_CARD" DIRECTDEBITTYPE_BANK_ACCOUNT DirectDebitType = "BANK_ACCOUNT" DIRECTDEBITTYPE_BANK_REDIRECT DirectDebitType = "BANK_REDIRECT" + DIRECTDEBITTYPE_XENDIT_ENUM_DEFAULT_FALLBACK DirectDebitType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of DirectDebitType enum @@ -30,6 +31,7 @@ var AllowedDirectDebitTypeEnumValues = []DirectDebitType{ "DEBIT_CARD", "BANK_ACCOUNT", "BANK_REDIRECT", + "UNKNOWN_ENUM_VALUE", } func (v *DirectDebitType) UnmarshalJSON(src []byte) error { @@ -46,7 +48,8 @@ func (v *DirectDebitType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid DirectDebitType", value) + *v = DIRECTDEBITTYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewDirectDebitTypeFromValue returns a pointer to a valid DirectDebitType diff --git a/payment_request/model_e_wallet_channel_code.go b/payment_request/model_e_wallet_channel_code.go index 8512268f..2a7d8893 100644 --- a/payment_request/model_e_wallet_channel_code.go +++ b/payment_request/model_e_wallet_channel_code.go @@ -39,6 +39,7 @@ const ( EWALLETCHANNELCODE_LINEPAY EWalletChannelCode = "LINEPAY" EWALLETCHANNELCODE_TRUEMONEY EWalletChannelCode = "TRUEMONEY" EWALLETCHANNELCODE_ALIPAY EWalletChannelCode = "ALIPAY" + EWALLETCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK EWalletChannelCode = "UNKNOWN_ENUM_VALUE" ) // All allowed values of EWalletChannelCode enum @@ -62,6 +63,7 @@ var AllowedEWalletChannelCodeEnumValues = []EWalletChannelCode{ "LINEPAY", "TRUEMONEY", "ALIPAY", + "UNKNOWN_ENUM_VALUE", } func (v *EWalletChannelCode) UnmarshalJSON(src []byte) error { @@ -78,7 +80,8 @@ func (v *EWalletChannelCode) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid EWalletChannelCode", value) + *v = EWALLETCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewEWalletChannelCodeFromValue returns a pointer to a valid EWalletChannelCode diff --git a/payment_request/model_over_the_counter_channel_code.go b/payment_request/model_over_the_counter_channel_code.go index b05268d9..8b7c9160 100644 --- a/payment_request/model_over_the_counter_channel_code.go +++ b/payment_request/model_over_the_counter_channel_code.go @@ -36,6 +36,7 @@ const ( OVERTHECOUNTERCHANNELCODE_ROBINSONS_BILLS OverTheCounterChannelCode = "ROBINSONS_BILLS" OVERTHECOUNTERCHANNELCODE_ALFAMART OverTheCounterChannelCode = "ALFAMART" OVERTHECOUNTERCHANNELCODE_INDOMARET OverTheCounterChannelCode = "INDOMARET" + OVERTHECOUNTERCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK OverTheCounterChannelCode = "UNKNOWN_ENUM_VALUE" ) // All allowed values of OverTheCounterChannelCode enum @@ -56,6 +57,7 @@ var AllowedOverTheCounterChannelCodeEnumValues = []OverTheCounterChannelCode{ "ROBINSONS_BILLS", "ALFAMART", "INDOMARET", + "UNKNOWN_ENUM_VALUE", } func (v *OverTheCounterChannelCode) UnmarshalJSON(src []byte) error { @@ -72,7 +74,8 @@ func (v *OverTheCounterChannelCode) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid OverTheCounterChannelCode", value) + *v = OVERTHECOUNTERCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewOverTheCounterChannelCodeFromValue returns a pointer to a valid OverTheCounterChannelCode diff --git a/payment_request/model_payment_method_reusability.go b/payment_request/model_payment_method_reusability.go index 2f679522..a0a28e32 100644 --- a/payment_request/model_payment_method_reusability.go +++ b/payment_request/model_payment_method_reusability.go @@ -22,12 +22,14 @@ type PaymentMethodReusability string const ( PAYMENTMETHODREUSABILITY_MULTIPLE_USE PaymentMethodReusability = "MULTIPLE_USE" PAYMENTMETHODREUSABILITY_ONE_TIME_USE PaymentMethodReusability = "ONE_TIME_USE" + PAYMENTMETHODREUSABILITY_XENDIT_ENUM_DEFAULT_FALLBACK PaymentMethodReusability = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaymentMethodReusability enum var AllowedPaymentMethodReusabilityEnumValues = []PaymentMethodReusability{ "MULTIPLE_USE", "ONE_TIME_USE", + "UNKNOWN_ENUM_VALUE", } func (v *PaymentMethodReusability) UnmarshalJSON(src []byte) error { @@ -44,7 +46,8 @@ func (v *PaymentMethodReusability) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaymentMethodReusability", value) + *v = PAYMENTMETHODREUSABILITY_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaymentMethodReusabilityFromValue returns a pointer to a valid PaymentMethodReusability diff --git a/payment_request/model_payment_method_status.go b/payment_request/model_payment_method_status.go index 4911d1dc..c4158549 100644 --- a/payment_request/model_payment_method_status.go +++ b/payment_request/model_payment_method_status.go @@ -25,6 +25,7 @@ const ( PAYMENTMETHODSTATUS_PENDING PaymentMethodStatus = "PENDING" PAYMENTMETHODSTATUS_EXPIRED PaymentMethodStatus = "EXPIRED" PAYMENTMETHODSTATUS_FAILED PaymentMethodStatus = "FAILED" + PAYMENTMETHODSTATUS_XENDIT_ENUM_DEFAULT_FALLBACK PaymentMethodStatus = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaymentMethodStatus enum @@ -34,6 +35,7 @@ var AllowedPaymentMethodStatusEnumValues = []PaymentMethodStatus{ "PENDING", "EXPIRED", "FAILED", + "UNKNOWN_ENUM_VALUE", } func (v *PaymentMethodStatus) UnmarshalJSON(src []byte) error { @@ -50,7 +52,8 @@ func (v *PaymentMethodStatus) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaymentMethodStatus", value) + *v = PAYMENTMETHODSTATUS_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaymentMethodStatusFromValue returns a pointer to a valid PaymentMethodStatus diff --git a/payment_request/model_payment_method_type.go b/payment_request/model_payment_method_type.go index 3b4b9d46..e72cb9f2 100644 --- a/payment_request/model_payment_method_type.go +++ b/payment_request/model_payment_method_type.go @@ -26,6 +26,7 @@ const ( PAYMENTMETHODTYPE_OVER_THE_COUNTER PaymentMethodType = "OVER_THE_COUNTER" PAYMENTMETHODTYPE_QR_CODE PaymentMethodType = "QR_CODE" PAYMENTMETHODTYPE_VIRTUAL_ACCOUNT PaymentMethodType = "VIRTUAL_ACCOUNT" + PAYMENTMETHODTYPE_XENDIT_ENUM_DEFAULT_FALLBACK PaymentMethodType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaymentMethodType enum @@ -36,6 +37,7 @@ var AllowedPaymentMethodTypeEnumValues = []PaymentMethodType{ "OVER_THE_COUNTER", "QR_CODE", "VIRTUAL_ACCOUNT", + "UNKNOWN_ENUM_VALUE", } func (v *PaymentMethodType) UnmarshalJSON(src []byte) error { @@ -52,7 +54,8 @@ func (v *PaymentMethodType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaymentMethodType", value) + *v = PAYMENTMETHODTYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaymentMethodTypeFromValue returns a pointer to a valid PaymentMethodType diff --git a/payment_request/model_payment_request_capture_method.go b/payment_request/model_payment_request_capture_method.go index ea714996..732f0b79 100644 --- a/payment_request/model_payment_request_capture_method.go +++ b/payment_request/model_payment_request_capture_method.go @@ -22,12 +22,14 @@ type PaymentRequestCaptureMethod string const ( PAYMENTREQUESTCAPTUREMETHOD_AUTOMATIC PaymentRequestCaptureMethod = "AUTOMATIC" PAYMENTREQUESTCAPTUREMETHOD_MANUAL PaymentRequestCaptureMethod = "MANUAL" + PAYMENTREQUESTCAPTUREMETHOD_XENDIT_ENUM_DEFAULT_FALLBACK PaymentRequestCaptureMethod = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaymentRequestCaptureMethod enum var AllowedPaymentRequestCaptureMethodEnumValues = []PaymentRequestCaptureMethod{ "AUTOMATIC", "MANUAL", + "UNKNOWN_ENUM_VALUE", } func (v *PaymentRequestCaptureMethod) UnmarshalJSON(src []byte) error { @@ -44,7 +46,8 @@ func (v *PaymentRequestCaptureMethod) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaymentRequestCaptureMethod", value) + *v = PAYMENTREQUESTCAPTUREMETHOD_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaymentRequestCaptureMethodFromValue returns a pointer to a valid PaymentRequestCaptureMethod diff --git a/payment_request/model_payment_request_country.go b/payment_request/model_payment_request_country.go index e6ac6dc2..78b25fba 100644 --- a/payment_request/model_payment_request_country.go +++ b/payment_request/model_payment_request_country.go @@ -25,6 +25,7 @@ const ( PAYMENTREQUESTCOUNTRY_VN PaymentRequestCountry = "VN" PAYMENTREQUESTCOUNTRY_TH PaymentRequestCountry = "TH" PAYMENTREQUESTCOUNTRY_MY PaymentRequestCountry = "MY" + PAYMENTREQUESTCOUNTRY_XENDIT_ENUM_DEFAULT_FALLBACK PaymentRequestCountry = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaymentRequestCountry enum @@ -34,6 +35,7 @@ var AllowedPaymentRequestCountryEnumValues = []PaymentRequestCountry{ "VN", "TH", "MY", + "UNKNOWN_ENUM_VALUE", } func (v *PaymentRequestCountry) UnmarshalJSON(src []byte) error { @@ -50,7 +52,8 @@ func (v *PaymentRequestCountry) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaymentRequestCountry", value) + *v = PAYMENTREQUESTCOUNTRY_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaymentRequestCountryFromValue returns a pointer to a valid PaymentRequestCountry diff --git a/payment_request/model_payment_request_currency.go b/payment_request/model_payment_request_currency.go index 49592e54..89421566 100644 --- a/payment_request/model_payment_request_currency.go +++ b/payment_request/model_payment_request_currency.go @@ -25,6 +25,7 @@ const ( PAYMENTREQUESTCURRENCY_VND PaymentRequestCurrency = "VND" PAYMENTREQUESTCURRENCY_THB PaymentRequestCurrency = "THB" PAYMENTREQUESTCURRENCY_MYR PaymentRequestCurrency = "MYR" + PAYMENTREQUESTCURRENCY_XENDIT_ENUM_DEFAULT_FALLBACK PaymentRequestCurrency = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaymentRequestCurrency enum @@ -34,6 +35,7 @@ var AllowedPaymentRequestCurrencyEnumValues = []PaymentRequestCurrency{ "VND", "THB", "MYR", + "UNKNOWN_ENUM_VALUE", } func (v *PaymentRequestCurrency) UnmarshalJSON(src []byte) error { @@ -50,7 +52,8 @@ func (v *PaymentRequestCurrency) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaymentRequestCurrency", value) + *v = PAYMENTREQUESTCURRENCY_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaymentRequestCurrencyFromValue returns a pointer to a valid PaymentRequestCurrency diff --git a/payment_request/model_payment_request_initiator.go b/payment_request/model_payment_request_initiator.go index 642c72b7..2102d4f5 100644 --- a/payment_request/model_payment_request_initiator.go +++ b/payment_request/model_payment_request_initiator.go @@ -22,12 +22,14 @@ type PaymentRequestInitiator string const ( PAYMENTREQUESTINITIATOR_CUSTOMER PaymentRequestInitiator = "CUSTOMER" PAYMENTREQUESTINITIATOR_MERCHANT PaymentRequestInitiator = "MERCHANT" + PAYMENTREQUESTINITIATOR_XENDIT_ENUM_DEFAULT_FALLBACK PaymentRequestInitiator = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaymentRequestInitiator enum var AllowedPaymentRequestInitiatorEnumValues = []PaymentRequestInitiator{ "CUSTOMER", "MERCHANT", + "UNKNOWN_ENUM_VALUE", } func (v *PaymentRequestInitiator) UnmarshalJSON(src []byte) error { @@ -44,7 +46,8 @@ func (v *PaymentRequestInitiator) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaymentRequestInitiator", value) + *v = PAYMENTREQUESTINITIATOR_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaymentRequestInitiatorFromValue returns a pointer to a valid PaymentRequestInitiator diff --git a/payment_request/model_payment_request_status.go b/payment_request/model_payment_request_status.go index 3dea2635..dff8fdd9 100644 --- a/payment_request/model_payment_request_status.go +++ b/payment_request/model_payment_request_status.go @@ -28,6 +28,7 @@ const ( PAYMENTREQUESTSTATUS_VOIDED PaymentRequestStatus = "VOIDED" PAYMENTREQUESTSTATUS_UNKNOWN PaymentRequestStatus = "UNKNOWN" PAYMENTREQUESTSTATUS_AWAITING_CAPTURE PaymentRequestStatus = "AWAITING_CAPTURE" + PAYMENTREQUESTSTATUS_XENDIT_ENUM_DEFAULT_FALLBACK PaymentRequestStatus = "UNKNOWN_ENUM_VALUE" ) // All allowed values of PaymentRequestStatus enum @@ -40,6 +41,7 @@ var AllowedPaymentRequestStatusEnumValues = []PaymentRequestStatus{ "VOIDED", "UNKNOWN", "AWAITING_CAPTURE", + "UNKNOWN_ENUM_VALUE", } func (v *PaymentRequestStatus) UnmarshalJSON(src []byte) error { @@ -56,7 +58,8 @@ func (v *PaymentRequestStatus) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid PaymentRequestStatus", value) + *v = PAYMENTREQUESTSTATUS_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewPaymentRequestStatusFromValue returns a pointer to a valid PaymentRequestStatus diff --git a/payment_request/model_qr_code_channel_code.go b/payment_request/model_qr_code_channel_code.go index ad3b31de..02aa4ea3 100644 --- a/payment_request/model_qr_code_channel_code.go +++ b/payment_request/model_qr_code_channel_code.go @@ -24,6 +24,7 @@ const ( QRCODECHANNELCODE_RCBC QRCodeChannelCode = "RCBC" QRCODECHANNELCODE_LINKAJA QRCodeChannelCode = "LINKAJA" QRCODECHANNELCODE_PROMPTPAY QRCodeChannelCode = "PROMPTPAY" + QRCODECHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK QRCodeChannelCode = "UNKNOWN_ENUM_VALUE" ) // All allowed values of QRCodeChannelCode enum @@ -32,6 +33,7 @@ var AllowedQRCodeChannelCodeEnumValues = []QRCodeChannelCode{ "RCBC", "LINKAJA", "PROMPTPAY", + "UNKNOWN_ENUM_VALUE", } func (v *QRCodeChannelCode) UnmarshalJSON(src []byte) error { @@ -48,7 +50,8 @@ func (v *QRCodeChannelCode) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid QRCodeChannelCode", value) + *v = QRCODECHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewQRCodeChannelCodeFromValue returns a pointer to a valid QRCodeChannelCode diff --git a/payment_request/model_virtual_account_channel_code.go b/payment_request/model_virtual_account_channel_code.go index 3ec23184..c45e26a4 100644 --- a/payment_request/model_virtual_account_channel_code.go +++ b/payment_request/model_virtual_account_channel_code.go @@ -35,6 +35,7 @@ const ( VIRTUALACCOUNTCHANNELCODE_WOORI VirtualAccountChannelCode = "WOORI" VIRTUALACCOUNTCHANNELCODE_MSB VirtualAccountChannelCode = "MSB" VIRTUALACCOUNTCHANNELCODE_STANDARD_CHARTERED VirtualAccountChannelCode = "STANDARD_CHARTERED" + VIRTUALACCOUNTCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK VirtualAccountChannelCode = "UNKNOWN_ENUM_VALUE" ) // All allowed values of VirtualAccountChannelCode enum @@ -54,6 +55,7 @@ var AllowedVirtualAccountChannelCodeEnumValues = []VirtualAccountChannelCode{ "WOORI", "MSB", "STANDARD_CHARTERED", + "UNKNOWN_ENUM_VALUE", } func (v *VirtualAccountChannelCode) UnmarshalJSON(src []byte) error { @@ -70,7 +72,8 @@ func (v *VirtualAccountChannelCode) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid VirtualAccountChannelCode", value) + *v = VIRTUALACCOUNTCHANNELCODE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewVirtualAccountChannelCodeFromValue returns a pointer to a valid VirtualAccountChannelCode diff --git a/payout/api_payout.go b/payout/api_payout.go index d3c1a23d..11c6089a 100644 --- a/payout/api_payout.go +++ b/payout/api_payout.go @@ -16,19 +16,6 @@ import ( type PayoutApi interface { - /* - CancelPayout API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id Payout id returned from the response of /v2/payouts - @return ApiCancelPayoutRequest - */ - CancelPayout(ctx context.Context, id string) ApiCancelPayoutRequest - - // CancelPayoutExecute executes the request - // @return GetPayouts200ResponseDataInner - CancelPayoutExecute(r ApiCancelPayoutRequest) (*GetPayouts200ResponseDataInner, *http.Response, *common.XenditSdkError) - /* CreatePayout API to send money at scale to bank accounts & eWallets @@ -77,6 +64,19 @@ type PayoutApi interface { // GetPayoutsExecute executes the request // @return GetPayouts200Response GetPayoutsExecute(r ApiGetPayoutsRequest) (*GetPayouts200Response, *http.Response, *common.XenditSdkError) + + /* + CancelPayout API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Payout id returned from the response of /v2/payouts + @return ApiCancelPayoutRequest + */ + CancelPayout(ctx context.Context, id string) ApiCancelPayoutRequest + + // CancelPayoutExecute executes the request + // @return GetPayouts200ResponseDataInner + CancelPayoutExecute(r ApiCancelPayoutRequest) (*GetPayouts200ResponseDataInner, *http.Response, *common.XenditSdkError) } // PayoutApiService PayoutApi service @@ -92,92 +92,6 @@ func NewPayoutApi (client common.IClient) PayoutApi { } -type ApiCancelPayoutRequest struct { - ctx context.Context - ApiService PayoutApi - id string -} - -func (r ApiCancelPayoutRequest) Execute() (*GetPayouts200ResponseDataInner, *http.Response, *common.XenditSdkError) { - return r.ApiService.CancelPayoutExecute(r) -} - -/* -CancelPayout API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param id Payout id returned from the response of /v2/payouts - @return ApiCancelPayoutRequest -*/ -func (a *PayoutApiService) CancelPayout(ctx context.Context, id string) ApiCancelPayoutRequest { - return ApiCancelPayoutRequest{ - ApiService: a, - ctx: ctx, - id: id, - } -} - -// Execute executes the request -// @return GetPayouts200ResponseDataInner -func (a *PayoutApiService) CancelPayoutExecute(r ApiCancelPayoutRequest) (*GetPayouts200ResponseDataInner, *http.Response, *common.XenditSdkError) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []common.FormFile - localVarReturnValue *GetPayouts200ResponseDataInner - ) - - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PayoutApiService.CancelPayout") - if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PayoutApiService.CancelPayoutExecute") - } - - localVarPath := localBasePath + "/v2/payouts/{id}/cancel" - localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(utils.ParameterValueToString(r.id, "id")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := utils.SelectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PayoutApiService.CancelPayoutExecute") - } - - localVarHTTPResponse, err := a.client.CallAPI(req) - - localVarBody, _ := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - - err = a.client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - - if err != nil || localVarHTTPResponse.StatusCode < 200 || localVarHTTPResponse.StatusCode >= 300 { - xenditSdkError := common.NewXenditSdkError(&localVarBody, strconv.Itoa(localVarHTTPResponse.StatusCode), localVarHTTPResponse.Status) - - return localVarReturnValue, localVarHTTPResponse, xenditSdkError - } - - return localVarReturnValue, localVarHTTPResponse, nil -} - type ApiCreatePayoutRequest struct { ctx context.Context ApiService PayoutApi @@ -293,6 +207,13 @@ type ApiGetPayoutByIdRequest struct { ctx context.Context ApiService PayoutApi id string + forUserId *string +} + +// The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. +func (r ApiGetPayoutByIdRequest) ForUserId(forUserId string) ApiGetPayoutByIdRequest { + r.forUserId = &forUserId + return r } func (r ApiGetPayoutByIdRequest) Execute() (*GetPayouts200ResponseDataInner, *http.Response, *common.XenditSdkError) { @@ -353,6 +274,9 @@ func (a *PayoutApiService) GetPayoutByIdExecute(r ApiGetPayoutByIdRequest) (*Get if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PayoutApiService.GetPayoutByIdExecute") @@ -381,6 +305,7 @@ type ApiGetPayoutChannelsRequest struct { currency *string channelCategory *[]ChannelCategory channelCode *string + forUserId *string } // Filter channels by currency from ISO-4217 values @@ -401,6 +326,12 @@ func (r ApiGetPayoutChannelsRequest) ChannelCode(channelCode string) ApiGetPayou return r } +// The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. +func (r ApiGetPayoutChannelsRequest) ForUserId(forUserId string) ApiGetPayoutChannelsRequest { + r.forUserId = &forUserId + return r +} + func (r ApiGetPayoutChannelsRequest) Execute() ([]Channel, *http.Response, *common.XenditSdkError) { return r.ApiService.GetPayoutChannelsExecute(r) } @@ -465,6 +396,9 @@ func (a *PayoutApiService) GetPayoutChannelsExecute(r ApiGetPayoutChannelsReques if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PayoutApiService.GetPayoutChannelsExecute") @@ -494,6 +428,7 @@ type ApiGetPayoutsRequest struct { limit *float32 afterId *string beforeId *string + forUserId *string } // Reference_id provided when creating the payout @@ -520,6 +455,12 @@ func (r ApiGetPayoutsRequest) BeforeId(beforeId string) ApiGetPayoutsRequest { return r } +// The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. +func (r ApiGetPayoutsRequest) ForUserId(forUserId string) ApiGetPayoutsRequest { + r.forUserId = &forUserId + return r +} + func (r ApiGetPayoutsRequest) Execute() (*GetPayouts200Response, *http.Response, *common.XenditSdkError) { return r.ApiService.GetPayoutsExecute(r) } @@ -588,6 +529,9 @@ func (a *PayoutApiService) GetPayoutsExecute(r ApiGetPayoutsRequest) (*GetPayout if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PayoutApiService.GetPayoutsExecute") @@ -609,3 +553,99 @@ func (a *PayoutApiService) GetPayoutsExecute(r ApiGetPayoutsRequest) (*GetPayout return localVarReturnValue, localVarHTTPResponse, nil } + +type ApiCancelPayoutRequest struct { + ctx context.Context + ApiService PayoutApi + id string + forUserId *string +} + +// The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information. +func (r ApiCancelPayoutRequest) ForUserId(forUserId string) ApiCancelPayoutRequest { + r.forUserId = &forUserId + return r +} + +func (r ApiCancelPayoutRequest) Execute() (*GetPayouts200ResponseDataInner, *http.Response, *common.XenditSdkError) { + return r.ApiService.CancelPayoutExecute(r) +} + +/* +CancelPayout API to cancel requested payouts that have not yet been sent to partner banks and e-wallets. Cancellation is possible if the payout has not been sent out via our partner and when payout status is ACCEPTED. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param id Payout id returned from the response of /v2/payouts + @return ApiCancelPayoutRequest +*/ +func (a *PayoutApiService) CancelPayout(ctx context.Context, id string) ApiCancelPayoutRequest { + return ApiCancelPayoutRequest{ + ApiService: a, + ctx: ctx, + id: id, + } +} + +// Execute executes the request +// @return GetPayouts200ResponseDataInner +func (a *PayoutApiService) CancelPayoutExecute(r ApiCancelPayoutRequest) (*GetPayouts200ResponseDataInner, *http.Response, *common.XenditSdkError) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []common.FormFile + localVarReturnValue *GetPayouts200ResponseDataInner + ) + + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "PayoutApiService.CancelPayout") + if err != nil { + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PayoutApiService.CancelPayoutExecute") + } + + localVarPath := localBasePath + "/v2/payouts/{id}/cancel" + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(utils.ParameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := utils.SelectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } + req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: PayoutApiService.CancelPayoutExecute") + } + + localVarHTTPResponse, err := a.client.CallAPI(req) + + localVarBody, _ := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + + err = a.client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + + if err != nil || localVarHTTPResponse.StatusCode < 200 || localVarHTTPResponse.StatusCode >= 300 { + xenditSdkError := common.NewXenditSdkError(&localVarBody, strconv.Itoa(localVarHTTPResponse.StatusCode), localVarHTTPResponse.Status) + + return localVarReturnValue, localVarHTTPResponse, xenditSdkError + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/payout/model_channel_account_type.go b/payout/model_channel_account_type.go index d20bc765..4632c100 100644 --- a/payout/model_channel_account_type.go +++ b/payout/model_channel_account_type.go @@ -25,6 +25,7 @@ const ( CHANNELACCOUNTTYPE_PASSPORT ChannelAccountType = "PASSPORT" CHANNELACCOUNTTYPE_BUSINESS_REGISTRATION ChannelAccountType = "BUSINESS_REGISTRATION" CHANNELACCOUNTTYPE_BANK_ACCOUNT ChannelAccountType = "BANK_ACCOUNT" + CHANNELACCOUNTTYPE_XENDIT_ENUM_DEFAULT_FALLBACK ChannelAccountType = "UNKNOWN_ENUM_VALUE" ) // All allowed values of ChannelAccountType enum @@ -34,6 +35,7 @@ var AllowedChannelAccountTypeEnumValues = []ChannelAccountType{ "PASSPORT", "BUSINESS_REGISTRATION", "BANK_ACCOUNT", + "UNKNOWN_ENUM_VALUE", } func (v *ChannelAccountType) UnmarshalJSON(src []byte) error { @@ -50,7 +52,8 @@ func (v *ChannelAccountType) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid ChannelAccountType", value) + *v = CHANNELACCOUNTTYPE_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewChannelAccountTypeFromValue returns a pointer to a valid ChannelAccountType diff --git a/payout/model_channel_category.go b/payout/model_channel_category.go index c98e3dcd..14683a16 100644 --- a/payout/model_channel_category.go +++ b/payout/model_channel_category.go @@ -23,6 +23,7 @@ const ( CHANNELCATEGORY_BANK ChannelCategory = "BANK" CHANNELCATEGORY_EWALLET ChannelCategory = "EWALLET" CHANNELCATEGORY_OTC ChannelCategory = "OTC" + CHANNELCATEGORY_XENDIT_ENUM_DEFAULT_FALLBACK ChannelCategory = "UNKNOWN_ENUM_VALUE" ) // All allowed values of ChannelCategory enum @@ -30,6 +31,7 @@ var AllowedChannelCategoryEnumValues = []ChannelCategory{ "BANK", "EWALLET", "OTC", + "UNKNOWN_ENUM_VALUE", } func (v *ChannelCategory) UnmarshalJSON(src []byte) error { @@ -46,7 +48,8 @@ func (v *ChannelCategory) UnmarshalJSON(src []byte) error { } } - return fmt.Errorf("%+v is not a valid ChannelCategory", value) + *v = CHANNELCATEGORY_XENDIT_ENUM_DEFAULT_FALLBACK + return nil } // NewChannelCategoryFromValue returns a pointer to a valid ChannelCategory diff --git a/refund/api_refund.go b/refund/api_refund.go index dc694fa8..92034685 100644 --- a/refund/api_refund.go +++ b/refund/api_refund.go @@ -17,29 +17,29 @@ import ( type RefundApi interface { /* - CancelRefund Method for CancelRefund + CreateRefund Method for CreateRefund @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param refundID - @return ApiCancelRefundRequest + @return ApiCreateRefundRequest */ - CancelRefund(ctx context.Context, refundID string) ApiCancelRefundRequest + CreateRefund(ctx context.Context) ApiCreateRefundRequest - // CancelRefundExecute executes the request + // CreateRefundExecute executes the request // @return Refund - CancelRefundExecute(r ApiCancelRefundRequest) (*Refund, *http.Response, *common.XenditSdkError) + CreateRefundExecute(r ApiCreateRefundRequest) (*Refund, *http.Response, *common.XenditSdkError) /* - CreateRefund Method for CreateRefund + GetRefund Method for GetRefund @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiCreateRefundRequest + @param refundID + @return ApiGetRefundRequest */ - CreateRefund(ctx context.Context) ApiCreateRefundRequest + GetRefund(ctx context.Context, refundID string) ApiGetRefundRequest - // CreateRefundExecute executes the request + // GetRefundExecute executes the request // @return Refund - CreateRefundExecute(r ApiCreateRefundRequest) (*Refund, *http.Response, *common.XenditSdkError) + GetRefundExecute(r ApiGetRefundRequest) (*Refund, *http.Response, *common.XenditSdkError) /* GetAllRefunds Method for GetAllRefunds @@ -54,17 +54,17 @@ type RefundApi interface { GetAllRefundsExecute(r ApiGetAllRefundsRequest) (*RefundList, *http.Response, *common.XenditSdkError) /* - GetRefund Method for GetRefund + CancelRefund Method for CancelRefund @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param refundID - @return ApiGetRefundRequest + @return ApiCancelRefundRequest */ - GetRefund(ctx context.Context, refundID string) ApiGetRefundRequest + CancelRefund(ctx context.Context, refundID string) ApiCancelRefundRequest - // GetRefundExecute executes the request + // CancelRefundExecute executes the request // @return Refund - GetRefundExecute(r ApiGetRefundRequest) (*Refund, *http.Response, *common.XenditSdkError) + CancelRefundExecute(r ApiCancelRefundRequest) (*Refund, *http.Response, *common.XenditSdkError) } // RefundApiService RefundApi service @@ -80,40 +80,49 @@ func NewRefundApi (client common.IClient) RefundApi { } -type ApiCancelRefundRequest struct { +type ApiCreateRefundRequest struct { ctx context.Context ApiService RefundApi - refundID string idempotencyKey *string + forUserId *string + createRefund *CreateRefund } -func (r ApiCancelRefundRequest) IdempotencyKey(idempotencyKey string) ApiCancelRefundRequest { +func (r ApiCreateRefundRequest) IdempotencyKey(idempotencyKey string) ApiCreateRefundRequest { r.idempotencyKey = &idempotencyKey return r } -func (r ApiCancelRefundRequest) Execute() (*Refund, *http.Response, *common.XenditSdkError) { - return r.ApiService.CancelRefundExecute(r) +func (r ApiCreateRefundRequest) ForUserId(forUserId string) ApiCreateRefundRequest { + r.forUserId = &forUserId + return r +} + +func (r ApiCreateRefundRequest) CreateRefund(createRefund CreateRefund) ApiCreateRefundRequest { + r.createRefund = &createRefund + return r +} + +func (r ApiCreateRefundRequest) Execute() (*Refund, *http.Response, *common.XenditSdkError) { + return r.ApiService.CreateRefundExecute(r) } /* -CancelRefund Method for CancelRefund +CreateRefund Method for CreateRefund @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param refundID - @return ApiCancelRefundRequest + @return ApiCreateRefundRequest */ -func (a *RefundApiService) CancelRefund(ctx context.Context, refundID string) ApiCancelRefundRequest { - return ApiCancelRefundRequest{ +func (a *RefundApiService) CreateRefund(ctx context.Context) ApiCreateRefundRequest { + return ApiCreateRefundRequest{ ApiService: a, ctx: ctx, - refundID: refundID, } } // Execute executes the request // @return Refund -func (a *RefundApiService) CancelRefundExecute(r ApiCancelRefundRequest) (*Refund, *http.Response, *common.XenditSdkError) { +func (a *RefundApiService) CreateRefundExecute(r ApiCreateRefundRequest) (*Refund, *http.Response, *common.XenditSdkError) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} @@ -121,20 +130,19 @@ func (a *RefundApiService) CancelRefundExecute(r ApiCancelRefundRequest) (*Refun localVarReturnValue *Refund ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "RefundApiService.CancelRefund") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "RefundApiService.CreateRefund") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.CancelRefundExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.CreateRefundExecute") } - localVarPath := localBasePath + "/refunds/{refundID}/cancel" - localVarPath = strings.Replace(localVarPath, "{"+"refundID"+"}", url.PathEscape(utils.ParameterValueToString(r.refundID, "refundID")), -1) + localVarPath := localBasePath + "/refunds" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) @@ -153,9 +161,14 @@ func (a *RefundApiService) CancelRefundExecute(r ApiCancelRefundRequest) (*Refun if r.idempotencyKey != nil { utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "idempotency-key", r.idempotencyKey, "") } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } + // body params + localVarPostBody = r.createRefund req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.CancelRefundExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.CreateRefundExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) @@ -175,63 +188,67 @@ func (a *RefundApiService) CancelRefundExecute(r ApiCancelRefundRequest) (*Refun return localVarReturnValue, localVarHTTPResponse, nil } -type ApiCreateRefundRequest struct { +type ApiGetRefundRequest struct { ctx context.Context ApiService RefundApi + refundID string idempotencyKey *string - createRefund *CreateRefund + forUserId *string } -func (r ApiCreateRefundRequest) IdempotencyKey(idempotencyKey string) ApiCreateRefundRequest { +func (r ApiGetRefundRequest) IdempotencyKey(idempotencyKey string) ApiGetRefundRequest { r.idempotencyKey = &idempotencyKey return r } -func (r ApiCreateRefundRequest) CreateRefund(createRefund CreateRefund) ApiCreateRefundRequest { - r.createRefund = &createRefund +func (r ApiGetRefundRequest) ForUserId(forUserId string) ApiGetRefundRequest { + r.forUserId = &forUserId return r } -func (r ApiCreateRefundRequest) Execute() (*Refund, *http.Response, *common.XenditSdkError) { - return r.ApiService.CreateRefundExecute(r) +func (r ApiGetRefundRequest) Execute() (*Refund, *http.Response, *common.XenditSdkError) { + return r.ApiService.GetRefundExecute(r) } /* -CreateRefund Method for CreateRefund +GetRefund Method for GetRefund @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @return ApiCreateRefundRequest + @param refundID + @return ApiGetRefundRequest */ -func (a *RefundApiService) CreateRefund(ctx context.Context) ApiCreateRefundRequest { - return ApiCreateRefundRequest{ +func (a *RefundApiService) GetRefund(ctx context.Context, refundID string) ApiGetRefundRequest { + return ApiGetRefundRequest{ ApiService: a, ctx: ctx, + refundID: refundID, } } // Execute executes the request // @return Refund -func (a *RefundApiService) CreateRefundExecute(r ApiCreateRefundRequest) (*Refund, *http.Response, *common.XenditSdkError) { +func (a *RefundApiService) GetRefundExecute(r ApiGetRefundRequest) (*Refund, *http.Response, *common.XenditSdkError) { var ( - localVarHTTPMethod = http.MethodPost + localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []common.FormFile localVarReturnValue *Refund ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "RefundApiService.CreateRefund") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "RefundApiService.GetRefund") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.CreateRefundExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.GetRefundExecute") } - localVarPath := localBasePath + "/refunds" + localVarPath := localBasePath + "/refunds/{refundID}" + localVarPath = strings.Replace(localVarPath, "{"+"refundID"+"}", url.PathEscape(utils.ParameterValueToString(r.refundID, "refundID")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := utils.SelectHeaderContentType(localVarHTTPContentTypes) @@ -250,11 +267,12 @@ func (a *RefundApiService) CreateRefundExecute(r ApiCreateRefundRequest) (*Refun if r.idempotencyKey != nil { utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "idempotency-key", r.idempotencyKey, "") } - // body params - localVarPostBody = r.createRefund + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.CreateRefundExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.GetRefundExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) @@ -277,6 +295,54 @@ func (a *RefundApiService) CreateRefundExecute(r ApiCreateRefundRequest) (*Refun type ApiGetAllRefundsRequest struct { ctx context.Context ApiService RefundApi + forUserId *string + paymentRequestId *string + invoiceId *string + paymentMethodType *string + channelCode *string + limit *float32 + afterId *string + beforeId *string +} + +func (r ApiGetAllRefundsRequest) ForUserId(forUserId string) ApiGetAllRefundsRequest { + r.forUserId = &forUserId + return r +} + +func (r ApiGetAllRefundsRequest) PaymentRequestId(paymentRequestId string) ApiGetAllRefundsRequest { + r.paymentRequestId = &paymentRequestId + return r +} + +func (r ApiGetAllRefundsRequest) InvoiceId(invoiceId string) ApiGetAllRefundsRequest { + r.invoiceId = &invoiceId + return r +} + +func (r ApiGetAllRefundsRequest) PaymentMethodType(paymentMethodType string) ApiGetAllRefundsRequest { + r.paymentMethodType = &paymentMethodType + return r +} + +func (r ApiGetAllRefundsRequest) ChannelCode(channelCode string) ApiGetAllRefundsRequest { + r.channelCode = &channelCode + return r +} + +func (r ApiGetAllRefundsRequest) Limit(limit float32) ApiGetAllRefundsRequest { + r.limit = &limit + return r +} + +func (r ApiGetAllRefundsRequest) AfterId(afterId string) ApiGetAllRefundsRequest { + r.afterId = &afterId + return r +} + +func (r ApiGetAllRefundsRequest) BeforeId(beforeId string) ApiGetAllRefundsRequest { + r.beforeId = &beforeId + return r } func (r ApiGetAllRefundsRequest) Execute() (*RefundList, *http.Response, *common.XenditSdkError) { @@ -311,12 +377,33 @@ func (a *RefundApiService) GetAllRefundsExecute(r ApiGetAllRefundsRequest) (*Ref return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.GetAllRefundsExecute") } - localVarPath := localBasePath + "/refunds/" + localVarPath := localBasePath + "/refunds" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.paymentRequestId != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_request_id", r.paymentRequestId, "") + } + if r.invoiceId != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "invoice_id", r.invoiceId, "") + } + if r.paymentMethodType != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "payment_method_type", r.paymentMethodType, "") + } + if r.channelCode != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "channel_code", r.channelCode, "") + } + if r.limit != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + if r.afterId != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "after_id", r.afterId, "") + } + if r.beforeId != nil { + utils.ParameterAddToHeaderOrQuery(localVarQueryParams, "before_id", r.beforeId, "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -334,6 +421,9 @@ func (a *RefundApiService) GetAllRefundsExecute(r ApiGetAllRefundsRequest) (*Ref if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.GetAllRefundsExecute") @@ -356,31 +446,37 @@ func (a *RefundApiService) GetAllRefundsExecute(r ApiGetAllRefundsRequest) (*Ref return localVarReturnValue, localVarHTTPResponse, nil } -type ApiGetRefundRequest struct { +type ApiCancelRefundRequest struct { ctx context.Context ApiService RefundApi refundID string idempotencyKey *string + forUserId *string } -func (r ApiGetRefundRequest) IdempotencyKey(idempotencyKey string) ApiGetRefundRequest { +func (r ApiCancelRefundRequest) IdempotencyKey(idempotencyKey string) ApiCancelRefundRequest { r.idempotencyKey = &idempotencyKey return r } -func (r ApiGetRefundRequest) Execute() (*Refund, *http.Response, *common.XenditSdkError) { - return r.ApiService.GetRefundExecute(r) +func (r ApiCancelRefundRequest) ForUserId(forUserId string) ApiCancelRefundRequest { + r.forUserId = &forUserId + return r +} + +func (r ApiCancelRefundRequest) Execute() (*Refund, *http.Response, *common.XenditSdkError) { + return r.ApiService.CancelRefundExecute(r) } /* -GetRefund Method for GetRefund +CancelRefund Method for CancelRefund @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param refundID - @return ApiGetRefundRequest + @return ApiCancelRefundRequest */ -func (a *RefundApiService) GetRefund(ctx context.Context, refundID string) ApiGetRefundRequest { - return ApiGetRefundRequest{ +func (a *RefundApiService) CancelRefund(ctx context.Context, refundID string) ApiCancelRefundRequest { + return ApiCancelRefundRequest{ ApiService: a, ctx: ctx, refundID: refundID, @@ -389,20 +485,20 @@ func (a *RefundApiService) GetRefund(ctx context.Context, refundID string) ApiGe // Execute executes the request // @return Refund -func (a *RefundApiService) GetRefundExecute(r ApiGetRefundRequest) (*Refund, *http.Response, *common.XenditSdkError) { +func (a *RefundApiService) CancelRefundExecute(r ApiCancelRefundRequest) (*Refund, *http.Response, *common.XenditSdkError) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []common.FormFile localVarReturnValue *Refund ) - localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "RefundApiService.GetRefund") + localBasePath, err := a.client.GetConfig().ServerURLWithContext(r.ctx, "RefundApiService.CancelRefund") if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.GetRefundExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.CancelRefundExecute") } - localVarPath := localBasePath + "/refunds/{refundID}" + localVarPath := localBasePath + "/refunds/{refundID}/cancel" localVarPath = strings.Replace(localVarPath, "{"+"refundID"+"}", url.PathEscape(utils.ParameterValueToString(r.refundID, "refundID")), -1) localVarHeaderParams := make(map[string]string) @@ -429,9 +525,12 @@ func (a *RefundApiService) GetRefundExecute(r ApiGetRefundRequest) (*Refund, *ht if r.idempotencyKey != nil { utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "idempotency-key", r.idempotencyKey, "") } + if r.forUserId != nil { + utils.ParameterAddToHeaderOrQuery(localVarHeaderParams, "for-user-id", r.forUserId, "") + } req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { - return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.GetRefundExecute") + return localVarReturnValue, nil, common.NewXenditSdkError(nil, "", "Error creating HTTP request: RefundApiService.CancelRefundExecute") } localVarHTTPResponse, err := a.client.CallAPI(req) diff --git a/refund/model_create_refund.go b/refund/model_create_refund.go index d4f6ab69..3a054224 100644 --- a/refund/model_create_refund.go +++ b/refund/model_create_refund.go @@ -3,7 +3,7 @@ Refund Service This API is used for the unified refund service -API version: 1.2.3 +API version: 1.3.3 */ diff --git a/refund/model_create_refund_400_response.go b/refund/model_create_refund_400_response.go index c66b5ae6..4105a90a 100644 --- a/refund/model_create_refund_400_response.go +++ b/refund/model_create_refund_400_response.go @@ -3,7 +3,7 @@ Refund Service This API is used for the unified refund service -API version: 1.2.3 +API version: 1.3.3 */ diff --git a/refund/model_create_refund_403_response.go b/refund/model_create_refund_403_response.go index b222f6b7..abef9549 100644 --- a/refund/model_create_refund_403_response.go +++ b/refund/model_create_refund_403_response.go @@ -3,7 +3,7 @@ Refund Service This API is used for the unified refund service -API version: 1.2.3 +API version: 1.3.3 */ diff --git a/refund/model_create_refund_404_response.go b/refund/model_create_refund_404_response.go index 09ee8930..1e91da34 100644 --- a/refund/model_create_refund_404_response.go +++ b/refund/model_create_refund_404_response.go @@ -3,7 +3,7 @@ Refund Service This API is used for the unified refund service -API version: 1.2.3 +API version: 1.3.3 */ diff --git a/refund/model_create_refund_409_response.go b/refund/model_create_refund_409_response.go index 36851c82..f7e11f5d 100644 --- a/refund/model_create_refund_409_response.go +++ b/refund/model_create_refund_409_response.go @@ -3,7 +3,7 @@ Refund Service This API is used for the unified refund service -API version: 1.2.3 +API version: 1.3.3 */ diff --git a/refund/model_create_refund_503_response.go b/refund/model_create_refund_503_response.go index 93924236..2dd125fe 100644 --- a/refund/model_create_refund_503_response.go +++ b/refund/model_create_refund_503_response.go @@ -3,7 +3,7 @@ Refund Service This API is used for the unified refund service -API version: 1.2.3 +API version: 1.3.3 */ diff --git a/refund/model_create_refund_default_response.go b/refund/model_get_all_refunds_default_response.go similarity index 54% rename from refund/model_create_refund_default_response.go rename to refund/model_get_all_refunds_default_response.go index f21f669b..4a0664d6 100644 --- a/refund/model_create_refund_default_response.go +++ b/refund/model_get_all_refunds_default_response.go @@ -3,7 +3,7 @@ Refund Service This API is used for the unified refund service -API version: 1.2.3 +API version: 1.3.3 */ @@ -15,34 +15,34 @@ import ( utils "github.com/xendit/xendit-go/v3/utils" ) -// checks if the CreateRefundDefaultResponse type satisfies the MappedNullable interface at compile time -var _ utils.MappedNullable = &CreateRefundDefaultResponse{} +// checks if the GetAllRefundsDefaultResponse type satisfies the MappedNullable interface at compile time +var _ utils.MappedNullable = &GetAllRefundsDefaultResponse{} -// CreateRefundDefaultResponse struct for CreateRefundDefaultResponse -type CreateRefundDefaultResponse struct { +// GetAllRefundsDefaultResponse struct for GetAllRefundsDefaultResponse +type GetAllRefundsDefaultResponse struct { ErrorCode *string `json:"error_code,omitempty"` Message *string `json:"message,omitempty"` } -// NewCreateRefundDefaultResponse instantiates a new CreateRefundDefaultResponse object +// NewGetAllRefundsDefaultResponse instantiates a new GetAllRefundsDefaultResponse 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 NewCreateRefundDefaultResponse() *CreateRefundDefaultResponse { - this := CreateRefundDefaultResponse{} +func NewGetAllRefundsDefaultResponse() *GetAllRefundsDefaultResponse { + this := GetAllRefundsDefaultResponse{} return &this } -// NewCreateRefundDefaultResponseWithDefaults instantiates a new CreateRefundDefaultResponse object +// NewGetAllRefundsDefaultResponseWithDefaults instantiates a new GetAllRefundsDefaultResponse 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 NewCreateRefundDefaultResponseWithDefaults() *CreateRefundDefaultResponse { - this := CreateRefundDefaultResponse{} +func NewGetAllRefundsDefaultResponseWithDefaults() *GetAllRefundsDefaultResponse { + this := GetAllRefundsDefaultResponse{} return &this } // GetErrorCode returns the ErrorCode field value if set, zero value otherwise. -func (o *CreateRefundDefaultResponse) GetErrorCode() string { +func (o *GetAllRefundsDefaultResponse) GetErrorCode() string { if o == nil || utils.IsNil(o.ErrorCode) { var ret string return ret @@ -52,7 +52,7 @@ func (o *CreateRefundDefaultResponse) GetErrorCode() string { // GetErrorCodeOk returns a tuple with the ErrorCode field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateRefundDefaultResponse) GetErrorCodeOk() (*string, bool) { +func (o *GetAllRefundsDefaultResponse) GetErrorCodeOk() (*string, bool) { if o == nil || utils.IsNil(o.ErrorCode) { return nil, false } @@ -60,7 +60,7 @@ func (o *CreateRefundDefaultResponse) GetErrorCodeOk() (*string, bool) { } // HasErrorCode returns a boolean if a field has been set. -func (o *CreateRefundDefaultResponse) HasErrorCode() bool { +func (o *GetAllRefundsDefaultResponse) HasErrorCode() bool { if o != nil && !utils.IsNil(o.ErrorCode) { return true } @@ -69,12 +69,12 @@ func (o *CreateRefundDefaultResponse) HasErrorCode() bool { } // SetErrorCode gets a reference to the given string and assigns it to the ErrorCode field. -func (o *CreateRefundDefaultResponse) SetErrorCode(v string) { +func (o *GetAllRefundsDefaultResponse) SetErrorCode(v string) { o.ErrorCode = &v } // GetMessage returns the Message field value if set, zero value otherwise. -func (o *CreateRefundDefaultResponse) GetMessage() string { +func (o *GetAllRefundsDefaultResponse) GetMessage() string { if o == nil || utils.IsNil(o.Message) { var ret string return ret @@ -84,7 +84,7 @@ func (o *CreateRefundDefaultResponse) GetMessage() string { // GetMessageOk returns a tuple with the Message field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *CreateRefundDefaultResponse) GetMessageOk() (*string, bool) { +func (o *GetAllRefundsDefaultResponse) GetMessageOk() (*string, bool) { if o == nil || utils.IsNil(o.Message) { return nil, false } @@ -92,7 +92,7 @@ func (o *CreateRefundDefaultResponse) GetMessageOk() (*string, bool) { } // HasMessage returns a boolean if a field has been set. -func (o *CreateRefundDefaultResponse) HasMessage() bool { +func (o *GetAllRefundsDefaultResponse) HasMessage() bool { if o != nil && !utils.IsNil(o.Message) { return true } @@ -101,11 +101,11 @@ func (o *CreateRefundDefaultResponse) HasMessage() bool { } // SetMessage gets a reference to the given string and assigns it to the Message field. -func (o *CreateRefundDefaultResponse) SetMessage(v string) { +func (o *GetAllRefundsDefaultResponse) SetMessage(v string) { o.Message = &v } -func (o CreateRefundDefaultResponse) MarshalJSON() ([]byte, error) { +func (o GetAllRefundsDefaultResponse) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { return []byte{}, err @@ -113,7 +113,7 @@ func (o CreateRefundDefaultResponse) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -func (o CreateRefundDefaultResponse) ToMap() (map[string]interface{}, error) { +func (o GetAllRefundsDefaultResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if !utils.IsNil(o.ErrorCode) { toSerialize["error_code"] = o.ErrorCode @@ -124,38 +124,38 @@ func (o CreateRefundDefaultResponse) ToMap() (map[string]interface{}, error) { return toSerialize, nil } -type NullableCreateRefundDefaultResponse struct { - value *CreateRefundDefaultResponse +type NullableGetAllRefundsDefaultResponse struct { + value *GetAllRefundsDefaultResponse isSet bool } -func (v NullableCreateRefundDefaultResponse) Get() *CreateRefundDefaultResponse { +func (v NullableGetAllRefundsDefaultResponse) Get() *GetAllRefundsDefaultResponse { return v.value } -func (v *NullableCreateRefundDefaultResponse) Set(val *CreateRefundDefaultResponse) { +func (v *NullableGetAllRefundsDefaultResponse) Set(val *GetAllRefundsDefaultResponse) { v.value = val v.isSet = true } -func (v NullableCreateRefundDefaultResponse) IsSet() bool { +func (v NullableGetAllRefundsDefaultResponse) IsSet() bool { return v.isSet } -func (v *NullableCreateRefundDefaultResponse) Unset() { +func (v *NullableGetAllRefundsDefaultResponse) Unset() { v.value = nil v.isSet = false } -func NewNullableCreateRefundDefaultResponse(val *CreateRefundDefaultResponse) *NullableCreateRefundDefaultResponse { - return &NullableCreateRefundDefaultResponse{value: val, isSet: true} +func NewNullableGetAllRefundsDefaultResponse(val *GetAllRefundsDefaultResponse) *NullableGetAllRefundsDefaultResponse { + return &NullableGetAllRefundsDefaultResponse{value: val, isSet: true} } -func (v NullableCreateRefundDefaultResponse) MarshalJSON() ([]byte, error) { +func (v NullableGetAllRefundsDefaultResponse) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableCreateRefundDefaultResponse) UnmarshalJSON(src []byte) error { +func (v *NullableGetAllRefundsDefaultResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } diff --git a/refund/model_refund.go b/refund/model_refund.go index 43d26e17..bfc265b5 100644 --- a/refund/model_refund.go +++ b/refund/model_refund.go @@ -3,7 +3,7 @@ Refund Service This API is used for the unified refund service -API version: 1.2.3 +API version: 1.3.3 */ diff --git a/refund/model_refund_list.go b/refund/model_refund_list.go index 9b3c565e..59c938f9 100644 --- a/refund/model_refund_list.go +++ b/refund/model_refund_list.go @@ -3,7 +3,7 @@ Refund Service This API is used for the unified refund service -API version: 1.2.3 +API version: 1.3.3 */ diff --git a/test/api_invoice_test.go b/test/api_invoice_test.go index a9c7a7e0..fe65ed7c 100644 --- a/test/api_invoice_test.go +++ b/test/api_invoice_test.go @@ -39,11 +39,11 @@ func Test_xendit_InvoiceApiService(t *testing.T) { }) - t.Run("Test InvoiceApiService ExpireInvoice", func(t *testing.T) { + t.Run("Test InvoiceApiService GetInvoiceById", func(t *testing.T) { var invoiceId string - resp, httpRes, err := apiClient.InvoiceApi.ExpireInvoice(context.Background(), invoiceId).Execute() + resp, httpRes, err := apiClient.InvoiceApi.GetInvoiceById(context.Background(), invoiceId).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -51,11 +51,9 @@ func Test_xendit_InvoiceApiService(t *testing.T) { }) - t.Run("Test InvoiceApiService GetInvoiceById", func(t *testing.T) { - - var invoiceId string + t.Run("Test InvoiceApiService GetInvoices", func(t *testing.T) { - resp, httpRes, err := apiClient.InvoiceApi.GetInvoiceById(context.Background(), invoiceId).Execute() + resp, httpRes, err := apiClient.InvoiceApi.GetInvoices(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -63,9 +61,11 @@ func Test_xendit_InvoiceApiService(t *testing.T) { }) - t.Run("Test InvoiceApiService GetInvoices", func(t *testing.T) { + t.Run("Test InvoiceApiService ExpireInvoice", func(t *testing.T) { - resp, httpRes, err := apiClient.InvoiceApi.GetInvoices(context.Background()).Execute() + var invoiceId string + + resp, httpRes, err := apiClient.InvoiceApi.ExpireInvoice(context.Background(), invoiceId).Execute() require.Nil(t, err) require.NotNil(t, resp) diff --git a/test/api_payment_method_test.go b/test/api_payment_method_test.go index 8f61197e..3a983edf 100644 --- a/test/api_payment_method_test.go +++ b/test/api_payment_method_test.go @@ -29,11 +29,9 @@ func Test_xendit_PaymentMethodApiService(t *testing.T) { apiClient := xendit.NewClient(apiKey) - t.Run("Test PaymentMethodApiService AuthPaymentMethod", func(t *testing.T) { - - var paymentMethodId string + t.Run("Test PaymentMethodApiService CreatePaymentMethod", func(t *testing.T) { - resp, httpRes, err := apiClient.PaymentMethodApi.AuthPaymentMethod(context.Background(), paymentMethodId).Execute() + resp, httpRes, err := apiClient.PaymentMethodApi.CreatePaymentMethod(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -41,9 +39,11 @@ func Test_xendit_PaymentMethodApiService(t *testing.T) { }) - t.Run("Test PaymentMethodApiService CreatePaymentMethod", func(t *testing.T) { + t.Run("Test PaymentMethodApiService GetPaymentMethodByID", func(t *testing.T) { - resp, httpRes, err := apiClient.PaymentMethodApi.CreatePaymentMethod(context.Background()).Execute() + var paymentMethodId string + + resp, httpRes, err := apiClient.PaymentMethodApi.GetPaymentMethodByID(context.Background(), paymentMethodId).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -51,11 +51,11 @@ func Test_xendit_PaymentMethodApiService(t *testing.T) { }) - t.Run("Test PaymentMethodApiService ExpirePaymentMethod", func(t *testing.T) { + t.Run("Test PaymentMethodApiService GetPaymentsByPaymentMethodId", func(t *testing.T) { var paymentMethodId string - resp, httpRes, err := apiClient.PaymentMethodApi.ExpirePaymentMethod(context.Background(), paymentMethodId).Execute() + resp, httpRes, err := apiClient.PaymentMethodApi.GetPaymentsByPaymentMethodId(context.Background(), paymentMethodId).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -63,9 +63,11 @@ func Test_xendit_PaymentMethodApiService(t *testing.T) { }) - t.Run("Test PaymentMethodApiService GetAllPaymentMethods", func(t *testing.T) { + t.Run("Test PaymentMethodApiService PatchPaymentMethod", func(t *testing.T) { - resp, httpRes, err := apiClient.PaymentMethodApi.GetAllPaymentMethods(context.Background()).Execute() + var paymentMethodId string + + resp, httpRes, err := apiClient.PaymentMethodApi.PatchPaymentMethod(context.Background(), paymentMethodId).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -73,11 +75,9 @@ func Test_xendit_PaymentMethodApiService(t *testing.T) { }) - t.Run("Test PaymentMethodApiService GetPaymentMethodByID", func(t *testing.T) { - - var paymentMethodId string + t.Run("Test PaymentMethodApiService GetAllPaymentMethods", func(t *testing.T) { - resp, httpRes, err := apiClient.PaymentMethodApi.GetPaymentMethodByID(context.Background(), paymentMethodId).Execute() + resp, httpRes, err := apiClient.PaymentMethodApi.GetAllPaymentMethods(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -85,11 +85,11 @@ func Test_xendit_PaymentMethodApiService(t *testing.T) { }) - t.Run("Test PaymentMethodApiService GetPaymentsByPaymentMethodId", func(t *testing.T) { + t.Run("Test PaymentMethodApiService ExpirePaymentMethod", func(t *testing.T) { var paymentMethodId string - resp, httpRes, err := apiClient.PaymentMethodApi.GetPaymentsByPaymentMethodId(context.Background(), paymentMethodId).Execute() + resp, httpRes, err := apiClient.PaymentMethodApi.ExpirePaymentMethod(context.Background(), paymentMethodId).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -97,11 +97,11 @@ func Test_xendit_PaymentMethodApiService(t *testing.T) { }) - t.Run("Test PaymentMethodApiService PatchPaymentMethod", func(t *testing.T) { + t.Run("Test PaymentMethodApiService AuthPaymentMethod", func(t *testing.T) { var paymentMethodId string - resp, httpRes, err := apiClient.PaymentMethodApi.PatchPaymentMethod(context.Background(), paymentMethodId).Execute() + resp, httpRes, err := apiClient.PaymentMethodApi.AuthPaymentMethod(context.Background(), paymentMethodId).Execute() require.Nil(t, err) require.NotNil(t, resp) diff --git a/test/api_payment_request_test.go b/test/api_payment_request_test.go index 6779a5fc..17bb0774 100644 --- a/test/api_payment_request_test.go +++ b/test/api_payment_request_test.go @@ -29,11 +29,9 @@ func Test_xendit_PaymentRequestApiService(t *testing.T) { apiClient := xendit.NewClient(apiKey) - t.Run("Test PaymentRequestApiService AuthorizePaymentRequest", func(t *testing.T) { - - var paymentRequestId string + t.Run("Test PaymentRequestApiService CreatePaymentRequest", func(t *testing.T) { - resp, httpRes, err := apiClient.PaymentRequestApi.AuthorizePaymentRequest(context.Background(), paymentRequestId).Execute() + resp, httpRes, err := apiClient.PaymentRequestApi.CreatePaymentRequest(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -41,11 +39,11 @@ func Test_xendit_PaymentRequestApiService(t *testing.T) { }) - t.Run("Test PaymentRequestApiService CapturePaymentRequest", func(t *testing.T) { + t.Run("Test PaymentRequestApiService GetPaymentRequestByID", func(t *testing.T) { var paymentRequestId string - resp, httpRes, err := apiClient.PaymentRequestApi.CapturePaymentRequest(context.Background(), paymentRequestId).Execute() + resp, httpRes, err := apiClient.PaymentRequestApi.GetPaymentRequestByID(context.Background(), paymentRequestId).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -53,9 +51,11 @@ func Test_xendit_PaymentRequestApiService(t *testing.T) { }) - t.Run("Test PaymentRequestApiService CreatePaymentRequest", func(t *testing.T) { + t.Run("Test PaymentRequestApiService GetPaymentRequestCaptures", func(t *testing.T) { - resp, httpRes, err := apiClient.PaymentRequestApi.CreatePaymentRequest(context.Background()).Execute() + var paymentRequestId string + + resp, httpRes, err := apiClient.PaymentRequestApi.GetPaymentRequestCaptures(context.Background(), paymentRequestId).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -73,11 +73,11 @@ func Test_xendit_PaymentRequestApiService(t *testing.T) { }) - t.Run("Test PaymentRequestApiService GetPaymentRequestByID", func(t *testing.T) { + t.Run("Test PaymentRequestApiService CapturePaymentRequest", func(t *testing.T) { var paymentRequestId string - resp, httpRes, err := apiClient.PaymentRequestApi.GetPaymentRequestByID(context.Background(), paymentRequestId).Execute() + resp, httpRes, err := apiClient.PaymentRequestApi.CapturePaymentRequest(context.Background(), paymentRequestId).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -85,11 +85,11 @@ func Test_xendit_PaymentRequestApiService(t *testing.T) { }) - t.Run("Test PaymentRequestApiService GetPaymentRequestCaptures", func(t *testing.T) { + t.Run("Test PaymentRequestApiService AuthorizePaymentRequest", func(t *testing.T) { var paymentRequestId string - resp, httpRes, err := apiClient.PaymentRequestApi.GetPaymentRequestCaptures(context.Background(), paymentRequestId).Execute() + resp, httpRes, err := apiClient.PaymentRequestApi.AuthorizePaymentRequest(context.Background(), paymentRequestId).Execute() require.Nil(t, err) require.NotNil(t, resp) diff --git a/test/api_payout_test.go b/test/api_payout_test.go index b9f4b91d..65aef241 100644 --- a/test/api_payout_test.go +++ b/test/api_payout_test.go @@ -29,18 +29,6 @@ func Test_xendit_PayoutApiService(t *testing.T) { apiClient := xendit.NewClient(apiKey) - t.Run("Test PayoutApiService CancelPayout", func(t *testing.T) { - - var id string - - resp, httpRes, err := apiClient.PayoutApi.CancelPayout(context.Background(), id).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - t.Run("Test PayoutApiService CreatePayout", func(t *testing.T) { resp, httpRes, err := apiClient.PayoutApi.CreatePayout(context.Background()).Execute() @@ -83,4 +71,16 @@ func Test_xendit_PayoutApiService(t *testing.T) { }) + t.Run("Test PayoutApiService CancelPayout", func(t *testing.T) { + + var id string + + resp, httpRes, err := apiClient.PayoutApi.CancelPayout(context.Background(), id).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + } diff --git a/test/api_refund_test.go b/test/api_refund_test.go index 222dfdd6..08fc6f25 100644 --- a/test/api_refund_test.go +++ b/test/api_refund_test.go @@ -29,11 +29,9 @@ func Test_xendit_RefundApiService(t *testing.T) { apiClient := xendit.NewClient(apiKey) - t.Run("Test RefundApiService CancelRefund", func(t *testing.T) { - - var refundID string + t.Run("Test RefundApiService CreateRefund", func(t *testing.T) { - resp, httpRes, err := apiClient.RefundApi.CancelRefund(context.Background(), refundID).Execute() + resp, httpRes, err := apiClient.RefundApi.CreateRefund(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -41,9 +39,11 @@ func Test_xendit_RefundApiService(t *testing.T) { }) - t.Run("Test RefundApiService CreateRefund", func(t *testing.T) { + t.Run("Test RefundApiService GetRefund", func(t *testing.T) { - resp, httpRes, err := apiClient.RefundApi.CreateRefund(context.Background()).Execute() + var refundID string + + resp, httpRes, err := apiClient.RefundApi.GetRefund(context.Background(), refundID).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -61,11 +61,11 @@ func Test_xendit_RefundApiService(t *testing.T) { }) - t.Run("Test RefundApiService GetRefund", func(t *testing.T) { + t.Run("Test RefundApiService CancelRefund", func(t *testing.T) { var refundID string - resp, httpRes, err := apiClient.RefundApi.GetRefund(context.Background(), refundID).Execute() + resp, httpRes, err := apiClient.RefundApi.CancelRefund(context.Background(), refundID).Execute() require.Nil(t, err) require.NotNil(t, resp) diff --git a/test/api_transaction_test.go b/test/api_transaction_test.go index c8040e3e..e5c96648 100644 --- a/test/api_transaction_test.go +++ b/test/api_transaction_test.go @@ -29,9 +29,11 @@ func Test_xendit_TransactionApiService(t *testing.T) { apiClient := xendit.NewClient(apiKey) - t.Run("Test TransactionApiService GetAllTransactions", func(t *testing.T) { + t.Run("Test TransactionApiService GetTransactionByID", func(t *testing.T) { - resp, httpRes, err := apiClient.TransactionApi.GetAllTransactions(context.Background()).Execute() + var id string + + resp, httpRes, err := apiClient.TransactionApi.GetTransactionByID(context.Background(), id).Execute() require.Nil(t, err) require.NotNil(t, resp) @@ -39,11 +41,9 @@ func Test_xendit_TransactionApiService(t *testing.T) { }) - t.Run("Test TransactionApiService GetTransactionByID", func(t *testing.T) { - - var id string + t.Run("Test TransactionApiService GetAllTransactions", func(t *testing.T) { - resp, httpRes, err := apiClient.TransactionApi.GetTransactionByID(context.Background(), id).Execute() + resp, httpRes, err := apiClient.TransactionApi.GetAllTransactions(context.Background()).Execute() require.Nil(t, err) require.NotNil(t, resp)