Skip to content

Commit

Permalink
refactor(customers_v2): address panics and some bugs in customers v2 …
Browse files Browse the repository at this point in the history
…endpoints (#6836)
  • Loading branch information
SanchithHegde authored Dec 17, 2024
1 parent 588ce40 commit dfbfce4
Show file tree
Hide file tree
Showing 56 changed files with 906 additions and 475 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: post /v2/customers
---
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: delete /v2/customers/{id}
---
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: get /v2/customers/list
---
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: get /v2/customers/{id}
---
---
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
openapi: post /v2/customers/{id}
---
openapi: put /v2/customers/{id}
---
143 changes: 114 additions & 29 deletions api-reference-v2/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -1712,7 +1712,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CustomerRequest"
"$ref": "#/components/schemas/CustomerUpdateRequest"
},
"examples": {
"Update name and email of a customer": {
Expand Down Expand Up @@ -7253,13 +7253,20 @@
"CustomerDeleteResponse": {
"type": "object",
"required": [
"id",
"merchant_reference_id",
"customer_deleted",
"address_deleted",
"payment_methods_deleted",
"id"
"payment_methods_deleted"
],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the customer",
"example": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"maxLength": 64,
"minLength": 32
},
"merchant_reference_id": {
"type": "string",
"description": "The identifier for the customer object",
Expand All @@ -7280,10 +7287,6 @@
"type": "boolean",
"description": "Whether payment methods deleted or not",
"example": false
},
"id": {
"type": "string",
"description": "Global id"
}
}
},
Expand Down Expand Up @@ -7399,9 +7402,9 @@
"customer_id": {
"type": "string",
"description": "The unique identifier of the customer.",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"example": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"maxLength": 64,
"minLength": 1
"minLength": 32
},
"payment_method_type": {
"$ref": "#/components/schemas/PaymentMethod"
Expand Down Expand Up @@ -7566,16 +7569,24 @@
"description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500\ncharacters long. Metadata is useful for storing additional, structured information on an\nobject.",
"nullable": true
}
}
},
"additionalProperties": false
},
"CustomerResponse": {
"type": "object",
"required": [
"id",
"merchant_reference_id",
"created_at",
"id"
"created_at"
],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the customer",
"example": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"maxLength": 64,
"minLength": 32
},
"merchant_reference_id": {
"type": "string",
"description": "The identifier for the customer object",
Expand Down Expand Up @@ -7651,12 +7662,86 @@
"example": "pm_djh2837dwduh890123",
"nullable": true,
"maxLength": 64
}
}
},
"CustomerUpdateRequest": {
"type": "object",
"required": [
"name",
"email"
],
"properties": {
"merchant_reference_id": {
"type": "string",
"description": "The merchant identifier for the customer object.",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"nullable": true,
"maxLength": 64,
"minLength": 1
},
"id": {
"name": {
"type": "string",
"description": "The customer's name",
"example": "Jon Test",
"maxLength": 255
},
"email": {
"type": "string",
"description": "The customer's email address",
"example": "[email protected]",
"maxLength": 255
},
"phone": {
"type": "string",
"description": "The customer's phone number",
"example": "9123456789",
"nullable": true,
"maxLength": 255
},
"description": {
"type": "string",
"description": "Global id"
"description": "An arbitrary string that you can attach to a customer object.",
"example": "First Customer",
"nullable": true,
"maxLength": 255
},
"phone_country_code": {
"type": "string",
"description": "The country code for the customer phone number",
"example": "+65",
"nullable": true,
"maxLength": 255
},
"default_billing_address": {
"allOf": [
{
"$ref": "#/components/schemas/AddressDetails"
}
],
"nullable": true
},
"default_shipping_address": {
"allOf": [
{
"$ref": "#/components/schemas/AddressDetails"
}
],
"nullable": true
},
"metadata": {
"type": "object",
"description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500\ncharacters long. Metadata is useful for storing additional, structured information on an\nobject.",
"nullable": true
},
"default_payment_method_id": {
"type": "string",
"description": "The unique identifier of the payment method",
"example": "card_rGK4Vi5iSW70MY7J2mIg",
"nullable": true
}
}
},
"additionalProperties": false
},
"DecoupledAuthenticationType": {
"type": "string",
Expand Down Expand Up @@ -13122,9 +13207,9 @@
"customer_id": {
"type": "string",
"description": "The unique identifier of the customer.",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"example": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"maxLength": 64,
"minLength": 1
"minLength": 32
},
"payment_method_data": {
"$ref": "#/components/schemas/PaymentMethodCreateData"
Expand Down Expand Up @@ -13663,9 +13748,9 @@
"customer_id": {
"type": "string",
"description": "The unique identifier of the customer.",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"example": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"maxLength": 64,
"minLength": 1
"minLength": 32
}
},
"additionalProperties": false
Expand Down Expand Up @@ -13854,6 +13939,7 @@
"type": "object",
"required": [
"merchant_id",
"customer_id",
"payment_method_id",
"payment_method_type",
"recurring_enabled"
Expand All @@ -13867,10 +13953,9 @@
"customer_id": {
"type": "string",
"description": "The unique identifier of the customer.",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"nullable": true,
"example": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"maxLength": 64,
"minLength": 1
"minLength": 32
},
"payment_method_id": {
"type": "string",
Expand Down Expand Up @@ -14436,7 +14521,8 @@
"PaymentsCreateIntentRequest": {
"type": "object",
"required": [
"amount_details"
"amount_details",
"customer_id"
],
"properties": {
"amount_details": {
Expand Down Expand Up @@ -14491,10 +14577,9 @@
"customer_id": {
"type": "string",
"description": "The identifier for the customer",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"nullable": true,
"example": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"maxLength": 64,
"minLength": 1
"minLength": 32
},
"customer_present": {
"allOf": [
Expand Down Expand Up @@ -15328,6 +15413,7 @@
"profile_id",
"capture_method",
"authentication_type",
"customer_id",
"customer_present",
"setup_future_usage",
"apply_mit_exemption",
Expand Down Expand Up @@ -15399,10 +15485,9 @@
"customer_id": {
"type": "string",
"description": "The identifier for the customer",
"example": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"nullable": true,
"example": "12345_cus_01926c58bc6e77c09e809964e72af8c8",
"maxLength": 64,
"minLength": 1
"minLength": 32
},
"customer_present": {
"$ref": "#/components/schemas/PresenceOfCustomerDuringPayment"
Expand Down
56 changes: 55 additions & 1 deletion api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2266,7 +2266,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CustomerRequest"
"$ref": "#/components/schemas/CustomerUpdateRequest"
},
"examples": {
"Update name and email of a customer": {
Expand Down Expand Up @@ -10036,6 +10036,60 @@
}
}
},
"CustomerUpdateRequest": {
"type": "object",
"description": "The identifier for the customer object. If not provided the customer ID will be autogenerated.",
"properties": {
"name": {
"type": "string",
"description": "The customer's name",
"example": "Jon Test",
"nullable": true,
"maxLength": 255
},
"email": {
"type": "string",
"description": "The customer's email address",
"example": "[email protected]",
"nullable": true,
"maxLength": 255
},
"phone": {
"type": "string",
"description": "The customer's phone number",
"example": "9123456789",
"nullable": true,
"maxLength": 255
},
"description": {
"type": "string",
"description": "An arbitrary string that you can attach to a customer object.",
"example": "First Customer",
"nullable": true,
"maxLength": 255
},
"phone_country_code": {
"type": "string",
"description": "The country code for the customer phone number",
"example": "+65",
"nullable": true,
"maxLength": 255
},
"address": {
"allOf": [
{
"$ref": "#/components/schemas/AddressDetails"
}
],
"nullable": true
},
"metadata": {
"type": "object",
"description": "You can specify up to 50 keys, with key names up to 40 characters long and values up to 500\ncharacters long. Metadata is useful for storing additional, structured information on an\nobject.",
"nullable": true
}
}
},
"DecoupledAuthenticationType": {
"type": "string",
"enum": [
Expand Down
Loading

0 comments on commit dfbfce4

Please sign in to comment.