Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(router): Consistently use PUT instead of PATCH in v2 #6995

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: patch /v2/payment-methods/{id}/update-saved-payment-method
openapi: put /v2/payment-methods/{id}/update-saved-payment-method
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: patch /v2/profiles/{id}/activate-routing-algorithm
openapi: put /v2/profiles/{id}/activate-routing-algorithm
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: patch /v2/profiles/{id}/deactivate-routing-algorithm
openapi: put /v2/profiles/{id}/deactivate-routing-algorithm
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: patch /v2/profiles/{id}/fallback-routing
openapi: put /v2/profiles/{id}/fallback-routing
---
8 changes: 4 additions & 4 deletions api-reference-v2/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@
}
},
"/v2/profiles/{id}/activate-routing-algorithm": {
"patch": {
"put": {
"tags": [
"Profile"
],
Expand Down Expand Up @@ -983,7 +983,7 @@
}
},
"/v2/profiles/{id}/deactivate-routing-algorithm": {
"patch": {
"put": {
"tags": [
"Profile"
],
Expand Down Expand Up @@ -1036,7 +1036,7 @@
}
},
"/v2/profiles/{id}/fallback-routing": {
"patch": {
"put": {
"tags": [
"Profile"
],
Expand Down Expand Up @@ -2397,7 +2397,7 @@
}
},
"/v2/payment-methods/{id}/update-saved-payment-method": {
"patch": {
"put": {
"tags": [
"Payment Methods"
],
Expand Down
2 changes: 1 addition & 1 deletion crates/openapi/src/routes/payment_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ pub async fn payment_method_retrieve_api() {}
///
/// Update an existing payment method of a customer.
#[utoipa::path(
patch,
put,
path = "/v2/payment-methods/{id}/update-saved-payment-method",
request_body(
content = PaymentMethodUpdate,
Expand Down
6 changes: 3 additions & 3 deletions crates/openapi/src/routes/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub async fn profile_update() {}
///
/// Activates a routing algorithm under a profile
#[utoipa::path(
patch,
put,
path = "/v2/profiles/{id}/activate-routing-algorithm",
request_body ( content = RoutingAlgorithmId,
examples( (
Expand Down Expand Up @@ -239,7 +239,7 @@ pub async fn routing_link_config() {}
///
/// Deactivates a routing algorithm under a profile
#[utoipa::path(
patch,
put,
path = "/v2/profiles/{id}/deactivate-routing-algorithm",
params(
("id" = String, Path, description = "The unique identifier for the profile"),
Expand All @@ -262,7 +262,7 @@ pub async fn routing_unlink_config() {}
///
/// Update the default fallback routing algorithm for the profile
#[utoipa::path(
patch,
put,
path = "/v2/profiles/{id}/fallback-routing",
request_body = Vec<RoutableConnectorChoice>,
params(
Expand Down
8 changes: 4 additions & 4 deletions crates/router/src/routes/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ impl PaymentMethods {
)
.service(
web::resource("/{id}/update-saved-payment-method")
.route(web::patch().to(payment_method_update_api)),
.route(web::put().to(payment_method_update_api)),
)
.service(
web::resource("/{id}")
Expand Down Expand Up @@ -1754,10 +1754,10 @@ impl Profile {
.service(
web::resource("/fallback-routing")
.route(web::get().to(routing::routing_retrieve_default_config))
.route(web::patch().to(routing::routing_update_default_config)),
.route(web::put().to(routing::routing_update_default_config)),
)
.service(
web::resource("/activate-routing-algorithm").route(web::patch().to(
web::resource("/activate-routing-algorithm").route(web::put().to(
|state, req, path, payload| {
routing::routing_link_config(
state,
Expand All @@ -1770,7 +1770,7 @@ impl Profile {
)),
)
.service(
web::resource("/deactivate-routing-algorithm").route(web::patch().to(
web::resource("/deactivate-routing-algorithm").route(web::put().to(
|state, req, path| {
routing::routing_unlink_config(
state,
Expand Down
4 changes: 2 additions & 2 deletions cypress-tests-v2/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ Cypress.Commands.add(
routingActivationBody.routing_algorithm_id = routing_algorithm_id;

cy.request({
method: "PATCH",
method: "PUT",
url: url,
headers: {
Authorization: `Bearer ${api_key}`,
Expand Down Expand Up @@ -925,7 +925,7 @@ Cypress.Commands.add("routingDeactivateCall", (globalState) => {
const url = `${base_url}/v2/profiles/${profile_id}/deactivate-routing-algorithm`;

cy.request({
method: "PATCH",
method: "PUT",
url: url,
headers: {
Authorization: `Bearer ${api_key}`,
Expand Down
Loading