refactor(customers_v2): address panics and some bugs in customers v2 endpoints (#6836)

This commit is contained in:
Sanchith Hegde
2024-12-17 15:54:27 +05:30
committed by GitHub
parent 588ce408b4
commit dfbfce4e42
56 changed files with 909 additions and 478 deletions

View File

@ -1,3 +1,3 @@
---
openapi: post /v2/customers
---
---

View File

@ -1,3 +1,3 @@
---
openapi: delete /v2/customers/{id}
---
---

View File

@ -1,3 +1,3 @@
---
openapi: get /v2/customers/list
---
---

View File

@ -1,3 +1,3 @@
---
openapi: get /v2/customers/{id}
---
---

View File

@ -1,3 +1,3 @@
---
openapi: post /v2/customers/{id}
---
openapi: put /v2/customers/{id}
---

View File

@ -1712,7 +1712,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CustomerRequest"
"$ref": "#/components/schemas/CustomerUpdateRequest"
},
"examples": {
"Update name and email of a customer": {
@ -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",
@ -7280,10 +7287,6 @@
"type": "boolean",
"description": "Whether payment methods deleted or not",
"example": false
},
"id": {
"type": "string",
"description": "Global id"
}
}
},
@ -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"
@ -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",
@ -7651,13 +7662,87 @@
"example": "pm_djh2837dwduh890123",
"nullable": true,
"maxLength": 64
},
"id": {
"type": "string",
"description": "Global id"
}
}
},
"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
},
"name": {
"type": "string",
"description": "The customer's name",
"example": "Jon Test",
"maxLength": 255
},
"email": {
"type": "string",
"description": "The customer's email address",
"example": "JonTest@test.com",
"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
},
"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",
"enum": [
@ -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"
@ -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
@ -13854,6 +13939,7 @@
"type": "object",
"required": [
"merchant_id",
"customer_id",
"payment_method_id",
"payment_method_type",
"recurring_enabled"
@ -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",
@ -14436,7 +14521,8 @@
"PaymentsCreateIntentRequest": {
"type": "object",
"required": [
"amount_details"
"amount_details",
"customer_id"
],
"properties": {
"amount_details": {
@ -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": [
@ -15328,6 +15413,7 @@
"profile_id",
"capture_method",
"authentication_type",
"customer_id",
"customer_present",
"setup_future_usage",
"apply_mit_exemption",
@ -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"