diff --git a/api-reference-v2/api-reference/business-profile/business-profile--update-default-fallback-routing-algorithm.mdx b/api-reference-v2/api-reference/business-profile/business-profile--update-default-fallback-routing-algorithm.mdx deleted file mode 100644 index ca4cb5f8fe25..000000000000 --- a/api-reference-v2/api-reference/business-profile/business-profile--update-default-fallback-routing-algorithm.mdx +++ /dev/null @@ -1,3 +0,0 @@ ---- -openapi: post /v2/profiles/{profile_id}/fallback_routing ---- \ No newline at end of file diff --git a/api-reference-v2/api-reference/business-profile/merchant-connector--list.mdx b/api-reference-v2/api-reference/profile/merchant-connector--list.mdx similarity index 100% rename from api-reference-v2/api-reference/business-profile/merchant-connector--list.mdx rename to api-reference-v2/api-reference/profile/merchant-connector--list.mdx diff --git a/api-reference-v2/api-reference/business-profile/business-profile--activate-routing-algorithm.mdx b/api-reference-v2/api-reference/profile/profile--activate-routing-algorithm.mdx similarity index 100% rename from api-reference-v2/api-reference/business-profile/business-profile--activate-routing-algorithm.mdx rename to api-reference-v2/api-reference/profile/profile--activate-routing-algorithm.mdx diff --git a/api-reference-v2/api-reference/business-profile/business-profile--create.mdx b/api-reference-v2/api-reference/profile/profile--create.mdx similarity index 88% rename from api-reference-v2/api-reference/business-profile/business-profile--create.mdx rename to api-reference-v2/api-reference/profile/profile--create.mdx index 670ec1dc52af..091f245deca7 100644 --- a/api-reference-v2/api-reference/business-profile/business-profile--create.mdx +++ b/api-reference-v2/api-reference/profile/profile--create.mdx @@ -1,3 +1,3 @@ --- openapi: post /v2/profiles ---- +--- \ No newline at end of file diff --git a/api-reference-v2/api-reference/business-profile/business-profile--deactivate-routing-algorithm.mdx b/api-reference-v2/api-reference/profile/profile--deactivate-routing-algorithm.mdx similarity index 100% rename from api-reference-v2/api-reference/business-profile/business-profile--deactivate-routing-algorithm.mdx rename to api-reference-v2/api-reference/profile/profile--deactivate-routing-algorithm.mdx diff --git a/api-reference-v2/api-reference/business-profile/business-profile--retrieve-active-routing-algorithm.mdx b/api-reference-v2/api-reference/profile/profile--retrieve-active-routing-algorithm.mdx similarity index 100% rename from api-reference-v2/api-reference/business-profile/business-profile--retrieve-active-routing-algorithm.mdx rename to api-reference-v2/api-reference/profile/profile--retrieve-active-routing-algorithm.mdx diff --git a/api-reference-v2/api-reference/business-profile/business-profile--retrieve-default-fallback-routing-algorithm.mdx b/api-reference-v2/api-reference/profile/profile--retrieve-default-fallback-routing-algorithm.mdx similarity index 100% rename from api-reference-v2/api-reference/business-profile/business-profile--retrieve-default-fallback-routing-algorithm.mdx rename to api-reference-v2/api-reference/profile/profile--retrieve-default-fallback-routing-algorithm.mdx diff --git a/api-reference-v2/api-reference/business-profile/business-profile--retrieve.mdx b/api-reference-v2/api-reference/profile/profile--retrieve.mdx similarity index 91% rename from api-reference-v2/api-reference/business-profile/business-profile--retrieve.mdx rename to api-reference-v2/api-reference/profile/profile--retrieve.mdx index 2a3ff1423b1b..235bb7d7f502 100644 --- a/api-reference-v2/api-reference/business-profile/business-profile--retrieve.mdx +++ b/api-reference-v2/api-reference/profile/profile--retrieve.mdx @@ -1,3 +1,3 @@ --- openapi: get /v2/profiles/{profile_id} ---- +--- \ No newline at end of file diff --git a/api-reference-v2/api-reference/profile/profile--update-default-fallback-routing-algorithm.mdx b/api-reference-v2/api-reference/profile/profile--update-default-fallback-routing-algorithm.mdx new file mode 100644 index 000000000000..0ba69796a7e9 --- /dev/null +++ b/api-reference-v2/api-reference/profile/profile--update-default-fallback-routing-algorithm.mdx @@ -0,0 +1,3 @@ +--- +openapi: patch /v2/profiles/{profile_id}/fallback_routing +--- \ No newline at end of file diff --git a/api-reference-v2/api-reference/business-profile/business-profile--update.mdx b/api-reference-v2/api-reference/profile/profile--update.mdx similarity index 91% rename from api-reference-v2/api-reference/business-profile/business-profile--update.mdx rename to api-reference-v2/api-reference/profile/profile--update.mdx index 36f556b3eefa..bf35d0afb64a 100644 --- a/api-reference-v2/api-reference/business-profile/business-profile--update.mdx +++ b/api-reference-v2/api-reference/profile/profile--update.mdx @@ -1,3 +1,3 @@ --- openapi: put /v2/profiles/{profile_id} ---- +--- \ No newline at end of file diff --git a/api-reference-v2/mint.json b/api-reference-v2/mint.json index ab7635a7cf25..ae48e2b8e768 100644 --- a/api-reference-v2/mint.json +++ b/api-reference-v2/mint.json @@ -53,17 +53,17 @@ ] }, { - "group": "Business Profile", + "group": "Profile", "pages": [ - "api-reference/business-profile/business-profile--create", - "api-reference/business-profile/business-profile--update", - "api-reference/business-profile/business-profile--retrieve", - "api-reference/business-profile/merchant-connector--list", - "api-reference/business-profile/business-profile--activate-routing-algorithm", - "api-reference/business-profile/business-profile--retrieve-active-routing-algorithm", - "api-reference/business-profile/business-profile--deactivate-routing-algorithm", - "api-reference/business-profile/business-profile--update-default-fallback-routing-algorithm", - "api-reference/business-profile/business-profile--retrieve-default-fallback-routing-algorithm" + "api-reference/profile/profile--create", + "api-reference/profile/profile--update", + "api-reference/profile/profile--activate-routing-algorithm", + "api-reference/profile/profile--update-default-fallback-routing-algorithm", + "api-reference/profile/profile--deactivate-routing-algorithm", + "api-reference/profile/profile--retrieve", + "api-reference/profile/merchant-connector--list", + "api-reference/profile/profile--retrieve-active-routing-algorithm", + "api-reference/profile/profile--retrieve-default-fallback-routing-algorithm" ] }, { diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json index 3690bcf24db6..6ff3e0176e9e 100644 --- a/api-reference-v2/openapi_spec.json +++ b/api-reference-v2/openapi_spec.json @@ -235,7 +235,7 @@ "connector_type": "payment_processor" } }, - "Create a merchant connector account under a specific business profile": { + "Create a merchant connector account under a specific profile": { "value": { "connector_account_details": { "api_key": "{{adyen-api-key}}", @@ -624,9 +624,9 @@ "tags": [ "Merchant Account" ], - "summary": "Business Profile - List", - "description": "List business profiles for an Merchant", - "operationId": "List Business Profiles", + "summary": "Profile - List", + "description": "List profiles for an Merchant", + "operationId": "List Profiles", "parameters": [ { "name": "account_id", @@ -640,13 +640,13 @@ ], "responses": { "200": { - "description": "Business profile list retrieved successfully", + "description": "profile list retrieved successfully", "content": { "application/json": { "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/BusinessProfileResponse" + "$ref": "#/components/schemas/ProfileResponse" } } } @@ -666,19 +666,19 @@ "/v2/profiles": { "post": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - Create", - "description": "Creates a new *business profile* for a merchant", - "operationId": "Create A Business Profile", + "summary": "Profile - Create", + "description": "Creates a new *profile* for a merchant", + "operationId": "Create A Profile", "requestBody": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BusinessProfileCreate" + "$ref": "#/components/schemas/ProfileCreate" }, "examples": { - "Create a business profile with profile name": { + "Create a profile with profile name": { "value": { "profile_name": "shoe_business" } @@ -690,11 +690,11 @@ }, "responses": { "200": { - "description": "Business Account Created", + "description": "Account Created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BusinessProfileResponse" + "$ref": "#/components/schemas/ProfileResponse" } } } @@ -713,16 +713,16 @@ "/v2/profiles/{profile_id}": { "get": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - Retrieve", - "description": "Retrieve existing *business profile*", - "operationId": "Retrieve a Business Profile", + "summary": "Profile - Retrieve", + "description": "Retrieve existing *profile*", + "operationId": "Retrieve a Profile", "parameters": [ { "name": "profile_id", "in": "path", - "description": "The unique identifier for the business profile", + "description": "The unique identifier for the profile", "required": true, "schema": { "type": "string" @@ -731,11 +731,11 @@ ], "responses": { "200": { - "description": "Business Profile Updated", + "description": "Profile Updated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BusinessProfileResponse" + "$ref": "#/components/schemas/ProfileResponse" } } } @@ -752,16 +752,16 @@ }, "put": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - Update", - "description": "Update the *business profile*", - "operationId": "Update a Business Profile", + "summary": "Profile - Update", + "description": "Update the *profile*", + "operationId": "Update a Profile", "parameters": [ { "name": "profile_id", "in": "path", - "description": "The unique identifier for the business profile", + "description": "The unique identifier for the profile", "required": true, "schema": { "type": "string" @@ -772,10 +772,10 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BusinessProfileCreate" + "$ref": "#/components/schemas/ProfileCreate" }, "examples": { - "Update business profile with profile name fields": { + "Update profile with profile name fields": { "value": { "profile_name": "shoe_business" } @@ -787,11 +787,11 @@ }, "responses": { "200": { - "description": "Business Profile Updated", + "description": "Profile Updated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BusinessProfileResponse" + "$ref": "#/components/schemas/ProfileResponse" } } } @@ -857,16 +857,16 @@ "/v2/profiles/{profile_id}/activate_routing_algorithm": { "patch": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - Activate routing algorithm", - "description": "Activates a routing algorithm under a business profile", - "operationId": "Activates a routing algorithm under a business profile", + "summary": "Profile - Activate routing algorithm", + "description": "Activates a routing algorithm under a profile", + "operationId": "Activates a routing algorithm under a profile", "parameters": [ { "name": "profile_id", "in": "path", - "description": "The unique identifier for the business profile", + "description": "The unique identifier for the profile", "required": true, "schema": { "type": "string" @@ -924,16 +924,16 @@ "/v2/profiles/{profile_id}/deactivate_routing_algorithm": { "patch": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - Deactivate routing algorithm", - "description": "Deactivates a routing algorithm under a business profile", - "operationId": " Deactivates a routing algorithm under a business profile", + "summary": "Profile - Deactivate routing algorithm", + "description": "Deactivates a routing algorithm under a profile", + "operationId": " Deactivates a routing algorithm under a profile", "parameters": [ { "name": "profile_id", "in": "path", - "description": "The unique identifier for the business profile", + "description": "The unique identifier for the profile", "required": true, "schema": { "type": "string" @@ -975,18 +975,18 @@ } }, "/v2/profiles/{profile_id}/fallback_routing": { - "post": { + "patch": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - Update Default Fallback Routing Algorithm", - "description": "Update the default fallback routing algorithm for the business profile", - "operationId": "Update the default fallback routing algorithm for the business profile", + "summary": "Profile - Update Default Fallback Routing Algorithm", + "description": "Update the default fallback routing algorithm for the profile", + "operationId": "Update the default fallback routing algorithm for the profile", "parameters": [ { "name": "profile_id", "in": "path", - "description": "The unique identifier for the business profile", + "description": "The unique identifier for the profile", "required": true, "schema": { "type": "string" @@ -1041,16 +1041,16 @@ }, "get": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - Retrieve Default Fallback Routing Algorithm", - "description": "Retrieve the default fallback routing algorithm for the business profile", - "operationId": "Retrieve the default fallback routing algorithm for the business profile", + "summary": "Profile - Retrieve Default Fallback Routing Algorithm", + "description": "Retrieve the default fallback routing algorithm for the profile", + "operationId": "Retrieve the default fallback routing algorithm for the profile", "parameters": [ { "name": "profile_id", "in": "path", - "description": "The unique identifier for the business profile", + "description": "The unique identifier for the profile", "required": true, "schema": { "type": "string" @@ -1088,16 +1088,16 @@ "/v2/profiles/{profile_id}/routing_algorithm": { "get": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - Retrieve Active Routing Algorithm", - "description": "Retrieve active routing algorithm under the business profile", - "operationId": "Retrieve the active routing algorithm under the business profile", + "summary": "Profile - Retrieve Active Routing Algorithm", + "description": "Retrieve active routing algorithm under the profile", + "operationId": "Retrieve the active routing algorithm under the profile", "parameters": [ { "name": "profile_id", "in": "path", - "description": "The unique identifier for the business profile", + "description": "The unique identifier for the profile", "required": true, "schema": { "type": "string" @@ -4365,677 +4365,324 @@ } ] }, - "BusinessProfileCreate": { + "CaptureMethod": { + "type": "string", + "description": "Default value if not passed is set to 'automatic' which results in Auth and Capture in one single API request. Pass 'manual' or 'manual_multiple' in case you want do a separate Auth and Capture by first authorizing and placing a hold on your customer's funds so that you can use the Payments/Capture endpoint later to capture the authorized amount. Pass 'manual' if you want to only capture the amount later once or 'manual_multiple' if you want to capture the funds multiple times later. Both 'manual' and 'manual_multiple' are only supported by a specific list of processors", + "enum": [ + "automatic", + "manual", + "manual_multiple", + "scheduled" + ] + }, + "CaptureResponse": { "type": "object", "required": [ - "profile_name" + "capture_id", + "status", + "amount", + "connector", + "authorized_attempt_id", + "capture_sequence" ], "properties": { - "profile_name": { - "type": "string", - "description": "The name of business profile", - "maxLength": 64 - }, - "return_url": { + "capture_id": { "type": "string", - "description": "The URL to redirect after the completion of the operation", - "example": "https://www.example.com/success", - "nullable": true, - "maxLength": 255 - }, - "enable_payment_response_hash": { - "type": "boolean", - "description": "A boolean value to indicate if payment response hash needs to be enabled", - "default": true, - "example": true, - "nullable": true + "description": "Unique identifier for the capture" }, - "payment_response_hash_key": { - "type": "string", - "description": "Refers to the hash key used for calculating the signature for webhooks and redirect response. If the value is not provided, a value is automatically generated.", - "nullable": true + "status": { + "$ref": "#/components/schemas/CaptureStatus" }, - "redirect_to_merchant_with_http_post": { - "type": "boolean", - "description": "A boolean value to indicate if redirect to merchant with http post needs to be enabled", - "default": false, - "example": true, - "nullable": true + "amount": { + "type": "integer", + "format": "int64", + "description": "The capture amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,", + "example": 6540 }, - "webhook_details": { + "currency": { "allOf": [ { - "$ref": "#/components/schemas/WebhookDetails" + "$ref": "#/components/schemas/Currency" } ], "nullable": true }, - "metadata": { - "type": "object", - "description": "Metadata is useful for storing additional, unstructured information on an object.", - "nullable": true - }, - "order_fulfillment_time": { - "type": "integer", - "format": "int32", - "description": "Will be used to determine the time till which your payment will be active once the payment session starts", - "example": 900, - "nullable": true, - "minimum": 0 + "connector": { + "type": "string", + "description": "The connector used for the payment" }, - "order_fulfillment_time_origin": { - "allOf": [ - { - "$ref": "#/components/schemas/OrderFulfillmentTimeOrigin" - } - ], - "nullable": true + "authorized_attempt_id": { + "type": "string", + "description": "Unique identifier for the parent attempt on which this capture is made" }, - "applepay_verified_domains": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Verified Apple Pay domains for a particular profile", + "connector_capture_id": { + "type": "string", + "description": "A unique identifier for this capture provided by the connector", "nullable": true }, - "session_expiry": { + "capture_sequence": { "type": "integer", "format": "int32", - "description": "Client Secret Default expiry for all payments created under this business profile", - "example": 900, - "nullable": true, - "minimum": 0 + "description": "Sequence number of this capture, in the series of captures made for the parent attempt" }, - "payment_link_config": { - "allOf": [ - { - "$ref": "#/components/schemas/BusinessPaymentLinkConfig" - } - ], + "error_message": { + "type": "string", + "description": "If there was an error while calling the connector the error message is received here", "nullable": true }, - "authentication_connector_details": { - "allOf": [ - { - "$ref": "#/components/schemas/AuthenticationConnectorDetails" - } - ], + "error_code": { + "type": "string", + "description": "If there was an error while calling the connectors the code is received here", "nullable": true }, - "use_billing_as_payment_method_billing": { - "type": "boolean", - "description": "Whether to use the billing details passed when creating the intent as payment method billing", + "error_reason": { + "type": "string", + "description": "If there was an error while calling the connectors the reason is received here", "nullable": true }, - "collect_shipping_details_from_wallet_connector_if_required": { - "type": "boolean", - "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", - "default": false, - "example": false, + "reference_id": { + "type": "string", + "description": "Reference to the capture at connector side", "nullable": true + } + } + }, + "CaptureStatus": { + "type": "string", + "enum": [ + "started", + "charged", + "pending", + "failed" + ] + }, + "Card": { + "type": "object", + "required": [ + "card_number", + "card_exp_month", + "card_exp_year", + "card_holder_name", + "card_cvc" + ], + "properties": { + "card_number": { + "type": "string", + "description": "The card number", + "example": "4242424242424242" }, - "collect_billing_details_from_wallet_connector_if_required": { - "type": "boolean", - "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", - "default": false, - "example": false, - "nullable": true + "card_exp_month": { + "type": "string", + "description": "The card's expiry month", + "example": "24" }, - "always_collect_shipping_details_from_wallet_connector": { - "type": "boolean", - "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", - "default": false, - "example": false, - "nullable": true + "card_exp_year": { + "type": "string", + "description": "The card's expiry year", + "example": "24" }, - "always_collect_billing_details_from_wallet_connector": { - "type": "boolean", - "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", - "default": false, - "example": false, - "nullable": true + "card_holder_name": { + "type": "string", + "description": "The card holder's name", + "example": "John Test" }, - "is_connector_agnostic_mit_enabled": { - "type": "boolean", - "description": "Indicates if the MIT (merchant initiated transaction) payments can be made connector\nagnostic, i.e., MITs may be processed through different connector than CIT (customer\ninitiated transaction) based on the routing rules.\nIf set to `false`, MIT will go through the same connector as the CIT.", + "card_cvc": { + "type": "string", + "description": "The CVC number for the card", + "example": "242" + }, + "card_issuer": { + "type": "string", + "description": "The name of the issuer of card", + "example": "chase", "nullable": true }, - "payout_link_config": { + "card_network": { "allOf": [ { - "$ref": "#/components/schemas/BusinessPayoutLinkConfig" + "$ref": "#/components/schemas/CardNetwork" } ], "nullable": true }, - "outgoing_webhook_custom_http_headers": { - "type": "object", - "description": "These key-value pairs are sent as additional custom headers in the outgoing webhook request. It is recommended not to use more than four key-value pairs.", + "card_type": { + "type": "string", + "example": "CREDIT", "nullable": true }, - "tax_connector_id": { + "card_issuing_country": { "type": "string", - "description": "Merchant Connector id to be stored for tax_calculator connector", + "example": "INDIA", "nullable": true }, - "is_tax_connector_enabled": { - "type": "boolean", - "description": "Indicates if tax_calculator connector is enabled or not.\nIf set to `true` tax_connector_id will be checked." + "bank_code": { + "type": "string", + "example": "JP_AMEX", + "nullable": true }, - "is_network_tokenization_enabled": { - "type": "boolean", - "description": "Indicates if is_network_tokenization_enabled is enabled or not.\nIf set to `true` is_network_tokenization_enabled will be checked." + "nick_name": { + "type": "string", + "description": "The card holder's nick name", + "example": "John Test", + "nullable": true } - }, - "additionalProperties": false + } }, - "BusinessProfileResponse": { + "CardDetail": { "type": "object", "required": [ - "merchant_id", - "id", - "profile_name", - "enable_payment_response_hash", - "redirect_to_merchant_with_http_post", - "is_tax_connector_enabled", - "is_network_tokenization_enabled" - ], - "properties": { - "merchant_id": { + "card_number", + "card_exp_month", + "card_exp_year", + "card_holder_name" + ], + "properties": { + "card_number": { "type": "string", - "description": "The identifier for Merchant Account", - "example": "y3oqhf46pyzuxjbcn2giaqnb44", - "maxLength": 64 + "description": "Card Number", + "example": "4111111145551142" }, - "id": { + "card_exp_month": { "type": "string", - "description": "The identifier for business profile. This must be used for creating merchant accounts, payments and payouts", - "example": "pro_abcdefghijklmnopqrstuvwxyz", - "maxLength": 64 + "description": "Card Expiry Month", + "example": "10" }, - "profile_name": { + "card_exp_year": { "type": "string", - "description": "Name of the business profile", - "maxLength": 64 + "description": "Card Expiry Year", + "example": "25" }, - "return_url": { + "card_holder_name": { "type": "string", - "description": "The URL to redirect after the completion of the operation", - "example": "https://www.example.com/success", - "nullable": true, - "maxLength": 255 - }, - "enable_payment_response_hash": { - "type": "boolean", - "description": "A boolean value to indicate if payment response hash needs to be enabled", - "default": true, - "example": true + "description": "Card Holder Name", + "example": "John Doe" }, - "payment_response_hash_key": { + "nick_name": { "type": "string", - "description": "Refers to the hash key used for calculating the signature for webhooks and redirect response. If the value is not provided, a value is automatically generated.", + "description": "Card Holder's Nick Name", + "example": "John Doe", "nullable": true }, - "redirect_to_merchant_with_http_post": { - "type": "boolean", - "description": "A boolean value to indicate if redirect to merchant with http post needs to be enabled", - "default": false, - "example": true + "card_issuing_country": { + "type": "string", + "description": "Card Issuing Country", + "nullable": true }, - "webhook_details": { + "card_network": { "allOf": [ { - "$ref": "#/components/schemas/WebhookDetails" + "$ref": "#/components/schemas/CardNetwork" } ], "nullable": true }, - "metadata": { - "type": "object", - "description": "Metadata is useful for storing additional, unstructured information on an object.", - "nullable": true - }, - "applepay_verified_domains": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Verified Apple Pay domains for a particular profile", + "card_issuer": { + "type": "string", + "description": "Issuer Bank for Card", "nullable": true }, - "session_expiry": { - "type": "integer", - "format": "int64", - "description": "Client Secret Default expiry for all payments created under this business profile", - "example": 900, + "card_type": { + "type": "string", + "description": "Card Type", "nullable": true - }, - "payment_link_config": { - "allOf": [ - { - "$ref": "#/components/schemas/BusinessPaymentLinkConfig" - } - ], + } + }, + "additionalProperties": false + }, + "CardDetailFromLocker": { + "type": "object", + "required": [ + "saved_to_locker" + ], + "properties": { + "scheme": { + "type": "string", "nullable": true }, - "authentication_connector_details": { - "allOf": [ - { - "$ref": "#/components/schemas/AuthenticationConnectorDetails" - } - ], + "issuer_country": { + "type": "string", "nullable": true }, - "use_billing_as_payment_method_billing": { - "type": "boolean", + "last4_digits": { + "type": "string", "nullable": true }, - "extended_card_info_config": { - "allOf": [ - { - "$ref": "#/components/schemas/ExtendedCardInfoConfig" - } - ], + "expiry_month": { + "type": "string", "nullable": true }, - "collect_shipping_details_from_wallet_connector_if_required": { - "type": "boolean", - "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", - "default": false, - "example": false, + "expiry_year": { + "type": "string", "nullable": true }, - "collect_billing_details_from_wallet_connector_if_required": { - "type": "boolean", - "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", - "default": false, - "example": false, + "card_token": { + "type": "string", "nullable": true }, - "always_collect_shipping_details_from_wallet_connector": { - "type": "boolean", - "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", - "default": false, - "example": false, + "card_holder_name": { + "type": "string", "nullable": true }, - "always_collect_billing_details_from_wallet_connector": { - "type": "boolean", - "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", - "default": false, - "example": false, + "card_fingerprint": { + "type": "string", "nullable": true }, - "is_connector_agnostic_mit_enabled": { - "type": "boolean", - "description": "Indicates if the MIT (merchant initiated transaction) payments can be made connector\nagnostic, i.e., MITs may be processed through different connector than CIT (customer\ninitiated transaction) based on the routing rules.\nIf set to `false`, MIT will go through the same connector as the CIT.", + "nick_name": { + "type": "string", "nullable": true }, - "payout_link_config": { + "card_network": { "allOf": [ { - "$ref": "#/components/schemas/BusinessPayoutLinkConfig" + "$ref": "#/components/schemas/CardNetwork" } ], "nullable": true }, - "outgoing_webhook_custom_http_headers": { - "type": "object", - "description": "These key-value pairs are sent as additional custom headers in the outgoing webhook request.", + "card_isin": { + "type": "string", "nullable": true }, - "order_fulfillment_time": { - "type": "integer", - "format": "int32", - "description": "Will be used to determine the time till which your payment will be active once the payment session starts", - "example": 900, - "nullable": true, - "minimum": 0 - }, - "order_fulfillment_time_origin": { - "allOf": [ - { - "$ref": "#/components/schemas/OrderFulfillmentTimeOrigin" - } - ], + "card_issuer": { + "type": "string", "nullable": true }, - "tax_connector_id": { + "card_type": { "type": "string", - "description": "Merchant Connector id to be stored for tax_calculator connector", "nullable": true }, - "is_tax_connector_enabled": { - "type": "boolean", - "description": "Indicates if tax_calculator connector is enabled or not.\nIf set to `true` tax_connector_id will be checked." - }, - "is_network_tokenization_enabled": { - "type": "boolean", - "description": "Indicates if is_network_tokenization_enabled is enabled or not.\nIf set to `true` is_network_tokenization_enabled will be checked.", - "default": false, - "example": false + "saved_to_locker": { + "type": "boolean" } } }, - "CaptureMethod": { - "type": "string", - "description": "Default value if not passed is set to 'automatic' which results in Auth and Capture in one single API request. Pass 'manual' or 'manual_multiple' in case you want do a separate Auth and Capture by first authorizing and placing a hold on your customer's funds so that you can use the Payments/Capture endpoint later to capture the authorized amount. Pass 'manual' if you want to only capture the amount later once or 'manual_multiple' if you want to capture the funds multiple times later. Both 'manual' and 'manual_multiple' are only supported by a specific list of processors", - "enum": [ - "automatic", - "manual", - "manual_multiple", - "scheduled" - ] - }, - "CaptureResponse": { + "CardDetailUpdate": { "type": "object", "required": [ - "capture_id", - "status", - "amount", - "connector", - "authorized_attempt_id", - "capture_sequence" + "card_exp_month", + "card_exp_year", + "card_holder_name" ], "properties": { - "capture_id": { - "type": "string", - "description": "Unique identifier for the capture" - }, - "status": { - "$ref": "#/components/schemas/CaptureStatus" - }, - "amount": { - "type": "integer", - "format": "int64", - "description": "The capture amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,", - "example": 6540 - }, - "currency": { - "allOf": [ - { - "$ref": "#/components/schemas/Currency" - } - ], - "nullable": true - }, - "connector": { + "card_exp_month": { "type": "string", - "description": "The connector used for the payment" + "description": "Card Expiry Month", + "example": "10" }, - "authorized_attempt_id": { + "card_exp_year": { "type": "string", - "description": "Unique identifier for the parent attempt on which this capture is made" + "description": "Card Expiry Year", + "example": "25" }, - "connector_capture_id": { + "card_holder_name": { "type": "string", - "description": "A unique identifier for this capture provided by the connector", - "nullable": true - }, - "capture_sequence": { - "type": "integer", - "format": "int32", - "description": "Sequence number of this capture, in the series of captures made for the parent attempt" + "description": "Card Holder Name", + "example": "John Doe" }, - "error_message": { + "nick_name": { "type": "string", - "description": "If there was an error while calling the connector the error message is received here", - "nullable": true - }, - "error_code": { - "type": "string", - "description": "If there was an error while calling the connectors the code is received here", - "nullable": true - }, - "error_reason": { - "type": "string", - "description": "If there was an error while calling the connectors the reason is received here", - "nullable": true - }, - "reference_id": { - "type": "string", - "description": "Reference to the capture at connector side", - "nullable": true - } - } - }, - "CaptureStatus": { - "type": "string", - "enum": [ - "started", - "charged", - "pending", - "failed" - ] - }, - "Card": { - "type": "object", - "required": [ - "card_number", - "card_exp_month", - "card_exp_year", - "card_holder_name", - "card_cvc" - ], - "properties": { - "card_number": { - "type": "string", - "description": "The card number", - "example": "4242424242424242" - }, - "card_exp_month": { - "type": "string", - "description": "The card's expiry month", - "example": "24" - }, - "card_exp_year": { - "type": "string", - "description": "The card's expiry year", - "example": "24" - }, - "card_holder_name": { - "type": "string", - "description": "The card holder's name", - "example": "John Test" - }, - "card_cvc": { - "type": "string", - "description": "The CVC number for the card", - "example": "242" - }, - "card_issuer": { - "type": "string", - "description": "The name of the issuer of card", - "example": "chase", - "nullable": true - }, - "card_network": { - "allOf": [ - { - "$ref": "#/components/schemas/CardNetwork" - } - ], - "nullable": true - }, - "card_type": { - "type": "string", - "example": "CREDIT", - "nullable": true - }, - "card_issuing_country": { - "type": "string", - "example": "INDIA", - "nullable": true - }, - "bank_code": { - "type": "string", - "example": "JP_AMEX", - "nullable": true - }, - "nick_name": { - "type": "string", - "description": "The card holder's nick name", - "example": "John Test", - "nullable": true - } - } - }, - "CardDetail": { - "type": "object", - "required": [ - "card_number", - "card_exp_month", - "card_exp_year", - "card_holder_name" - ], - "properties": { - "card_number": { - "type": "string", - "description": "Card Number", - "example": "4111111145551142" - }, - "card_exp_month": { - "type": "string", - "description": "Card Expiry Month", - "example": "10" - }, - "card_exp_year": { - "type": "string", - "description": "Card Expiry Year", - "example": "25" - }, - "card_holder_name": { - "type": "string", - "description": "Card Holder Name", - "example": "John Doe" - }, - "nick_name": { - "type": "string", - "description": "Card Holder's Nick Name", - "example": "John Doe", - "nullable": true - }, - "card_issuing_country": { - "type": "string", - "description": "Card Issuing Country", - "nullable": true - }, - "card_network": { - "allOf": [ - { - "$ref": "#/components/schemas/CardNetwork" - } - ], - "nullable": true - }, - "card_issuer": { - "type": "string", - "description": "Issuer Bank for Card", - "nullable": true - }, - "card_type": { - "type": "string", - "description": "Card Type", - "nullable": true - } - }, - "additionalProperties": false - }, - "CardDetailFromLocker": { - "type": "object", - "required": [ - "saved_to_locker" - ], - "properties": { - "scheme": { - "type": "string", - "nullable": true - }, - "issuer_country": { - "type": "string", - "nullable": true - }, - "last4_digits": { - "type": "string", - "nullable": true - }, - "expiry_month": { - "type": "string", - "nullable": true - }, - "expiry_year": { - "type": "string", - "nullable": true - }, - "card_token": { - "type": "string", - "nullable": true - }, - "card_holder_name": { - "type": "string", - "nullable": true - }, - "card_fingerprint": { - "type": "string", - "nullable": true - }, - "nick_name": { - "type": "string", - "nullable": true - }, - "card_network": { - "allOf": [ - { - "$ref": "#/components/schemas/CardNetwork" - } - ], - "nullable": true - }, - "card_isin": { - "type": "string", - "nullable": true - }, - "card_issuer": { - "type": "string", - "nullable": true - }, - "card_type": { - "type": "string", - "nullable": true - }, - "saved_to_locker": { - "type": "boolean" - } - } - }, - "CardDetailUpdate": { - "type": "object", - "required": [ - "card_exp_month", - "card_exp_year", - "card_holder_name" - ], - "properties": { - "card_exp_month": { - "type": "string", - "description": "Card Expiry Month", - "example": "10" - }, - "card_exp_year": { - "type": "string", - "description": "Card Expiry Year", - "example": "25" - }, - "card_holder_name": { - "type": "string", - "description": "Card Holder Name", - "example": "John Doe" - }, - "nick_name": { - "type": "string", - "description": "Card Holder's Nick Name", - "example": "John Doe", + "description": "Card Holder's Nick Name", + "example": "John Doe", "nullable": true } }, @@ -9150,7 +8797,7 @@ }, "profile_id": { "type": "string", - "description": "Identifier for the business profile, if not provided default will be chosen from merchant account", + "description": "Identifier for the profile, if not provided default will be chosen from merchant account", "maxLength": 64 }, "connector_account_details": { @@ -9349,7 +8996,7 @@ }, "connector_label": { "type": "string", - "description": "A unique label to identify the connector account created under a business profile", + "description": "A unique label to identify the connector account created under a profile", "example": "stripe_US_travel", "nullable": true }, @@ -9360,7 +9007,7 @@ }, "profile_id": { "type": "string", - "description": "Identifier for the business profile, if not provided default will be chosen from merchant account", + "description": "Identifier for the profile, if not provided default will be chosen from merchant account", "maxLength": 64 }, "payment_methods_enabled": { @@ -9473,7 +9120,7 @@ }, "connector_label": { "type": "string", - "description": "A unique label to identify the connector account created under a business profile", + "description": "A unique label to identify the connector account created under a profile", "example": "stripe_US_travel", "nullable": true }, @@ -9484,7 +9131,7 @@ }, "profile_id": { "type": "string", - "description": "Identifier for the business profile, if not provided default will be chosen from merchant account", + "description": "Identifier for the profile, if not provided default will be chosen from merchant account", "maxLength": 64 }, "connector_account_details": { @@ -16744,7 +16391,172 @@ "accommodation" ] }, - "ProfileDefaultRoutingConfig": { + "ProfileCreate": { + "type": "object", + "required": [ + "profile_name" + ], + "properties": { + "profile_name": { + "type": "string", + "description": "The name of profile", + "maxLength": 64 + }, + "return_url": { + "type": "string", + "description": "The URL to redirect after the completion of the operation", + "example": "https://www.example.com/success", + "nullable": true, + "maxLength": 255 + }, + "enable_payment_response_hash": { + "type": "boolean", + "description": "A boolean value to indicate if payment response hash needs to be enabled", + "default": true, + "example": true, + "nullable": true + }, + "payment_response_hash_key": { + "type": "string", + "description": "Refers to the hash key used for calculating the signature for webhooks and redirect response. If the value is not provided, a value is automatically generated.", + "nullable": true + }, + "redirect_to_merchant_with_http_post": { + "type": "boolean", + "description": "A boolean value to indicate if redirect to merchant with http post needs to be enabled", + "default": false, + "example": true, + "nullable": true + }, + "webhook_details": { + "allOf": [ + { + "$ref": "#/components/schemas/WebhookDetails" + } + ], + "nullable": true + }, + "metadata": { + "type": "object", + "description": "Metadata is useful for storing additional, unstructured information on an object.", + "nullable": true + }, + "order_fulfillment_time": { + "type": "integer", + "format": "int32", + "description": "Will be used to determine the time till which your payment will be active once the payment session starts", + "example": 900, + "nullable": true, + "minimum": 0 + }, + "order_fulfillment_time_origin": { + "allOf": [ + { + "$ref": "#/components/schemas/OrderFulfillmentTimeOrigin" + } + ], + "nullable": true + }, + "applepay_verified_domains": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Verified Apple Pay domains for a particular profile", + "nullable": true + }, + "session_expiry": { + "type": "integer", + "format": "int32", + "description": "Client Secret Default expiry for all payments created under this profile", + "example": 900, + "nullable": true, + "minimum": 0 + }, + "payment_link_config": { + "allOf": [ + { + "$ref": "#/components/schemas/BusinessPaymentLinkConfig" + } + ], + "nullable": true + }, + "authentication_connector_details": { + "allOf": [ + { + "$ref": "#/components/schemas/AuthenticationConnectorDetails" + } + ], + "nullable": true + }, + "use_billing_as_payment_method_billing": { + "type": "boolean", + "description": "Whether to use the billing details passed when creating the intent as payment method billing", + "nullable": true + }, + "collect_shipping_details_from_wallet_connector_if_required": { + "type": "boolean", + "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "collect_billing_details_from_wallet_connector_if_required": { + "type": "boolean", + "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "always_collect_shipping_details_from_wallet_connector": { + "type": "boolean", + "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "always_collect_billing_details_from_wallet_connector": { + "type": "boolean", + "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "is_connector_agnostic_mit_enabled": { + "type": "boolean", + "description": "Indicates if the MIT (merchant initiated transaction) payments can be made connector\nagnostic, i.e., MITs may be processed through different connector than CIT (customer\ninitiated transaction) based on the routing rules.\nIf set to `false`, MIT will go through the same connector as the CIT.", + "nullable": true + }, + "payout_link_config": { + "allOf": [ + { + "$ref": "#/components/schemas/BusinessPayoutLinkConfig" + } + ], + "nullable": true + }, + "outgoing_webhook_custom_http_headers": { + "type": "object", + "description": "These key-value pairs are sent as additional custom headers in the outgoing webhook request. It is recommended not to use more than four key-value pairs.", + "nullable": true + }, + "tax_connector_id": { + "type": "string", + "description": "Merchant Connector id to be stored for tax_calculator connector", + "nullable": true + }, + "is_tax_connector_enabled": { + "type": "boolean", + "description": "Indicates if tax_calculator connector is enabled or not.\nIf set to `true` tax_connector_id will be checked." + }, + "is_network_tokenization_enabled": { + "type": "boolean", + "description": "Indicates if is_network_tokenization_enabled is enabled or not.\nIf set to `true` is_network_tokenization_enabled will be checked." + } + }, + "additionalProperties": false + }, + "ProfileDefaultRoutingConfig": { "type": "object", "required": [ "profile_id", @@ -16762,6 +16574,194 @@ } } }, + "ProfileResponse": { + "type": "object", + "required": [ + "merchant_id", + "id", + "profile_name", + "enable_payment_response_hash", + "redirect_to_merchant_with_http_post", + "is_tax_connector_enabled", + "is_network_tokenization_enabled" + ], + "properties": { + "merchant_id": { + "type": "string", + "description": "The identifier for Merchant Account", + "example": "y3oqhf46pyzuxjbcn2giaqnb44", + "maxLength": 64 + }, + "id": { + "type": "string", + "description": "The identifier for profile. This must be used for creating merchant accounts, payments and payouts", + "example": "pro_abcdefghijklmnopqrstuvwxyz", + "maxLength": 64 + }, + "profile_name": { + "type": "string", + "description": "Name of the profile", + "maxLength": 64 + }, + "return_url": { + "type": "string", + "description": "The URL to redirect after the completion of the operation", + "example": "https://www.example.com/success", + "nullable": true, + "maxLength": 255 + }, + "enable_payment_response_hash": { + "type": "boolean", + "description": "A boolean value to indicate if payment response hash needs to be enabled", + "default": true, + "example": true + }, + "payment_response_hash_key": { + "type": "string", + "description": "Refers to the hash key used for calculating the signature for webhooks and redirect response. If the value is not provided, a value is automatically generated.", + "nullable": true + }, + "redirect_to_merchant_with_http_post": { + "type": "boolean", + "description": "A boolean value to indicate if redirect to merchant with http post needs to be enabled", + "default": false, + "example": true + }, + "webhook_details": { + "allOf": [ + { + "$ref": "#/components/schemas/WebhookDetails" + } + ], + "nullable": true + }, + "metadata": { + "type": "object", + "description": "Metadata is useful for storing additional, unstructured information on an object.", + "nullable": true + }, + "applepay_verified_domains": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Verified Apple Pay domains for a particular profile", + "nullable": true + }, + "session_expiry": { + "type": "integer", + "format": "int64", + "description": "Client Secret Default expiry for all payments created under this profile", + "example": 900, + "nullable": true + }, + "payment_link_config": { + "allOf": [ + { + "$ref": "#/components/schemas/BusinessPaymentLinkConfig" + } + ], + "nullable": true + }, + "authentication_connector_details": { + "allOf": [ + { + "$ref": "#/components/schemas/AuthenticationConnectorDetails" + } + ], + "nullable": true + }, + "use_billing_as_payment_method_billing": { + "type": "boolean", + "nullable": true + }, + "extended_card_info_config": { + "allOf": [ + { + "$ref": "#/components/schemas/ExtendedCardInfoConfig" + } + ], + "nullable": true + }, + "collect_shipping_details_from_wallet_connector_if_required": { + "type": "boolean", + "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "collect_billing_details_from_wallet_connector_if_required": { + "type": "boolean", + "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "always_collect_shipping_details_from_wallet_connector": { + "type": "boolean", + "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "always_collect_billing_details_from_wallet_connector": { + "type": "boolean", + "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "is_connector_agnostic_mit_enabled": { + "type": "boolean", + "description": "Indicates if the MIT (merchant initiated transaction) payments can be made connector\nagnostic, i.e., MITs may be processed through different connector than CIT (customer\ninitiated transaction) based on the routing rules.\nIf set to `false`, MIT will go through the same connector as the CIT.", + "nullable": true + }, + "payout_link_config": { + "allOf": [ + { + "$ref": "#/components/schemas/BusinessPayoutLinkConfig" + } + ], + "nullable": true + }, + "outgoing_webhook_custom_http_headers": { + "type": "object", + "description": "These key-value pairs are sent as additional custom headers in the outgoing webhook request.", + "nullable": true + }, + "order_fulfillment_time": { + "type": "integer", + "format": "int32", + "description": "Will be used to determine the time till which your payment will be active once the payment session starts", + "example": 900, + "nullable": true, + "minimum": 0 + }, + "order_fulfillment_time_origin": { + "allOf": [ + { + "$ref": "#/components/schemas/OrderFulfillmentTimeOrigin" + } + ], + "nullable": true + }, + "tax_connector_id": { + "type": "string", + "description": "Merchant Connector id to be stored for tax_calculator connector", + "nullable": true + }, + "is_tax_connector_enabled": { + "type": "boolean", + "description": "Indicates if tax_calculator connector is enabled or not.\nIf set to `true` tax_connector_id will be checked." + }, + "is_network_tokenization_enabled": { + "type": "boolean", + "description": "Indicates if is_network_tokenization_enabled is enabled or not.\nIf set to `true` is_network_tokenization_enabled will be checked.", + "default": false, + "example": false + } + } + }, "ProgramConnectorSelection": { "type": "object", "description": "The program, having a default connector selection and\na bunch of rules. Also can hold arbitrary metadata.", @@ -19612,8 +19612,8 @@ "description": "Create and manage merchant accounts" }, { - "name": "Business Profile", - "description": "Create and manage business profiles" + "name": "Profile", + "description": "Create and manage profiles" }, { "name": "Merchant Connector Account", diff --git a/api-reference/openapi_spec.json b/api-reference/openapi_spec.json index 2d0a71475704..4934b4fb3457 100644 --- a/api-reference/openapi_spec.json +++ b/api-reference/openapi_spec.json @@ -1558,7 +1558,7 @@ "connector_type": "payment_processor" } }, - "Create a merchant connector account under a specific business profile": { + "Create a merchant connector account under a specific profile": { "value": { "connector_account_details": { "api_key": "{{adyen-api-key}}", @@ -2912,11 +2912,11 @@ "/account/{account_id}/business_profile": { "post": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - Create", - "description": "Creates a new *business profile* for a merchant", - "operationId": "Create A Business Profile", + "summary": "Profile - Create", + "description": "Creates a new *profile* for a merchant", + "operationId": "Create A Profile", "parameters": [ { "name": "account_id", @@ -2932,13 +2932,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BusinessProfileCreate" + "$ref": "#/components/schemas/ProfileCreate" }, "examples": { - "Create a business profile with minimal fields": { + "Create a profile with minimal fields": { "value": {} }, - "Create a business profile with profile name": { + "Create a profile with profile name": { "value": { "profile_name": "shoe_business" } @@ -2950,11 +2950,11 @@ }, "responses": { "200": { - "description": "Business Account Created", + "description": "Profile Created", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BusinessProfileResponse" + "$ref": "#/components/schemas/ProfileResponse" } } } @@ -2971,11 +2971,11 @@ }, "get": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - List", - "description": "Lists all the *business profiles* under a merchant", - "operationId": "List Business Profiles", + "summary": "Profile - List", + "description": "Lists all the *profiles* under a merchant", + "operationId": "List Profiles", "parameters": [ { "name": "account_id", @@ -2989,13 +2989,13 @@ ], "responses": { "200": { - "description": "Business profiles Retrieved", + "description": "Profiles Retrieved", "content": { "application/json": { "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/BusinessProfileResponse" + "$ref": "#/components/schemas/ProfileResponse" } } } @@ -3012,11 +3012,11 @@ "/account/{account_id}/business_profile/{profile_id}": { "get": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - Retrieve", - "description": "Retrieve existing *business profile*", - "operationId": "Retrieve a Business Profile", + "summary": "Profile - Retrieve", + "description": "Retrieve existing *profile*", + "operationId": "Retrieve a Profile", "parameters": [ { "name": "account_id", @@ -3030,7 +3030,7 @@ { "name": "profile_id", "in": "path", - "description": "The unique identifier for the business profile", + "description": "The unique identifier for the profile", "required": true, "schema": { "type": "string" @@ -3039,11 +3039,11 @@ ], "responses": { "200": { - "description": "Business Profile Updated", + "description": "Profile Updated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BusinessProfileResponse" + "$ref": "#/components/schemas/ProfileResponse" } } } @@ -3060,11 +3060,11 @@ }, "post": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - Update", - "description": "Update the *business profile*", - "operationId": "Update a Business Profile", + "summary": "Profile - Update", + "description": "Update the *profile*", + "operationId": "Update a Profile", "parameters": [ { "name": "account_id", @@ -3078,7 +3078,7 @@ { "name": "profile_id", "in": "path", - "description": "The unique identifier for the business profile", + "description": "The unique identifier for the profile", "required": true, "schema": { "type": "string" @@ -3089,10 +3089,10 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BusinessProfileCreate" + "$ref": "#/components/schemas/ProfileCreate" }, "examples": { - "Update business profile with profile name fields": { + "Update profile with profile name fields": { "value": { "profile_name": "shoe_business" } @@ -3104,11 +3104,11 @@ }, "responses": { "200": { - "description": "Business Profile Updated", + "description": "Profile Updated", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BusinessProfileResponse" + "$ref": "#/components/schemas/ProfileResponse" } } } @@ -3125,11 +3125,11 @@ }, "delete": { "tags": [ - "Business Profile" + "Profile" ], - "summary": "Business Profile - Delete", - "description": "Delete the *business profile*", - "operationId": "Delete the Business Profile", + "summary": "Profile - Delete", + "description": "Delete the *profile*", + "operationId": "Delete the Profile", "parameters": [ { "name": "account_id", @@ -3143,7 +3143,7 @@ { "name": "profile_id", "in": "path", - "description": "The unique identifier for the business profile", + "description": "The unique identifier for the profile", "required": true, "schema": { "type": "string" @@ -3152,7 +3152,7 @@ ], "responses": { "200": { - "description": "Business profiles Deleted", + "description": "Profiles Deleted", "content": { "text/plain": { "schema": { @@ -4847,8 +4847,8 @@ "Event" ], "summary": "Events - List", - "description": "List all Events associated with a Merchant Account or Business Profile.", - "operationId": "List all Events associated with a Merchant Account or Business Profile", + "description": "List all Events associated with a Merchant Account or Profile.", + "operationId": "List all Events associated with a Merchant Account or Profile", "parameters": [ { "name": "merchant_id", @@ -4916,7 +4916,7 @@ { "name": "profile_id", "in": "query", - "description": "Only include Events associated with the Business Profile identified by the specified Business Profile ID.", + "description": "Only include Events associated with the Profile identified by the specified Profile ID.", "required": false, "schema": { "type": "string", @@ -7794,694 +7794,324 @@ } ] }, - "BusinessProfileCreate": { + "CaptureMethod": { + "type": "string", + "description": "Default value if not passed is set to 'automatic' which results in Auth and Capture in one single API request. Pass 'manual' or 'manual_multiple' in case you want do a separate Auth and Capture by first authorizing and placing a hold on your customer's funds so that you can use the Payments/Capture endpoint later to capture the authorized amount. Pass 'manual' if you want to only capture the amount later once or 'manual_multiple' if you want to capture the funds multiple times later. Both 'manual' and 'manual_multiple' are only supported by a specific list of processors", + "enum": [ + "automatic", + "manual", + "manual_multiple", + "scheduled" + ] + }, + "CaptureResponse": { "type": "object", + "required": [ + "capture_id", + "status", + "amount", + "connector", + "authorized_attempt_id", + "capture_sequence" + ], "properties": { - "profile_name": { - "type": "string", - "description": "The name of business profile", - "nullable": true, - "maxLength": 64 - }, - "return_url": { + "capture_id": { "type": "string", - "description": "The URL to redirect after the completion of the operation", - "example": "https://www.example.com/success", - "nullable": true, - "maxLength": 255 - }, - "enable_payment_response_hash": { - "type": "boolean", - "description": "A boolean value to indicate if payment response hash needs to be enabled", - "default": true, - "example": true, - "nullable": true + "description": "Unique identifier for the capture" }, - "payment_response_hash_key": { - "type": "string", - "description": "Refers to the hash key used for calculating the signature for webhooks and redirect response. If the value is not provided, a value is automatically generated.", - "nullable": true + "status": { + "$ref": "#/components/schemas/CaptureStatus" }, - "redirect_to_merchant_with_http_post": { - "type": "boolean", - "description": "A boolean value to indicate if redirect to merchant with http post needs to be enabled", - "default": false, - "example": true, - "nullable": true + "amount": { + "type": "integer", + "format": "int64", + "description": "The capture amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,", + "example": 6540 }, - "webhook_details": { + "currency": { "allOf": [ { - "$ref": "#/components/schemas/WebhookDetails" + "$ref": "#/components/schemas/Currency" } ], "nullable": true }, - "metadata": { - "type": "object", - "description": "Metadata is useful for storing additional, unstructured information on an object.", - "nullable": true - }, - "routing_algorithm": { - "type": "object", - "description": "The routing algorithm to be used for routing payments to desired connectors", - "nullable": true - }, - "intent_fulfillment_time": { - "type": "integer", - "format": "int32", - "description": "Will be used to determine the time till which your payment will be active once the payment session starts", - "example": 900, - "nullable": true, - "minimum": 0 - }, - "frm_routing_algorithm": { - "type": "object", - "description": "The frm routing algorithm to be used for routing payments to desired FRM's", - "nullable": true + "connector": { + "type": "string", + "description": "The connector used for the payment" }, - "payout_routing_algorithm": { - "allOf": [ - { - "$ref": "#/components/schemas/RoutingAlgorithm" - } - ], - "nullable": true + "authorized_attempt_id": { + "type": "string", + "description": "Unique identifier for the parent attempt on which this capture is made" }, - "applepay_verified_domains": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Verified Apple Pay domains for a particular profile", + "connector_capture_id": { + "type": "string", + "description": "A unique identifier for this capture provided by the connector", "nullable": true }, - "session_expiry": { + "capture_sequence": { "type": "integer", "format": "int32", - "description": "Client Secret Default expiry for all payments created under this business profile", - "example": 900, - "nullable": true, - "minimum": 0 + "description": "Sequence number of this capture, in the series of captures made for the parent attempt" }, - "payment_link_config": { - "allOf": [ - { - "$ref": "#/components/schemas/BusinessPaymentLinkConfig" - } - ], + "error_message": { + "type": "string", + "description": "If there was an error while calling the connector the error message is received here", "nullable": true }, - "authentication_connector_details": { - "allOf": [ - { - "$ref": "#/components/schemas/AuthenticationConnectorDetails" - } - ], + "error_code": { + "type": "string", + "description": "If there was an error while calling the connectors the code is received here", "nullable": true }, - "use_billing_as_payment_method_billing": { - "type": "boolean", - "description": "Whether to use the billing details passed when creating the intent as payment method billing", + "error_reason": { + "type": "string", + "description": "If there was an error while calling the connectors the reason is received here", "nullable": true }, - "collect_shipping_details_from_wallet_connector": { - "type": "boolean", - "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", - "default": false, - "example": false, + "reference_id": { + "type": "string", + "description": "Reference to the capture at connector side", "nullable": true + } + } + }, + "CaptureStatus": { + "type": "string", + "enum": [ + "started", + "charged", + "pending", + "failed" + ] + }, + "Card": { + "type": "object", + "required": [ + "card_number", + "card_exp_month", + "card_exp_year", + "card_holder_name", + "card_cvc" + ], + "properties": { + "card_number": { + "type": "string", + "description": "The card number", + "example": "4242424242424242" }, - "collect_billing_details_from_wallet_connector": { - "type": "boolean", - "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", - "default": false, - "example": false, - "nullable": true + "card_exp_month": { + "type": "string", + "description": "The card's expiry month", + "example": "24" }, - "always_collect_shipping_details_from_wallet_connector": { - "type": "boolean", - "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", - "default": false, - "example": false, - "nullable": true + "card_exp_year": { + "type": "string", + "description": "The card's expiry year", + "example": "24" }, - "always_collect_billing_details_from_wallet_connector": { - "type": "boolean", - "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", - "default": false, - "example": false, - "nullable": true + "card_holder_name": { + "type": "string", + "description": "The card holder's name", + "example": "John Test" }, - "is_connector_agnostic_mit_enabled": { - "type": "boolean", - "description": "Indicates if the MIT (merchant initiated transaction) payments can be made connector\nagnostic, i.e., MITs may be processed through different connector than CIT (customer\ninitiated transaction) based on the routing rules.\nIf set to `false`, MIT will go through the same connector as the CIT.", + "card_cvc": { + "type": "string", + "description": "The CVC number for the card", + "example": "242" + }, + "card_issuer": { + "type": "string", + "description": "The name of the issuer of card", + "example": "chase", "nullable": true }, - "payout_link_config": { + "card_network": { "allOf": [ { - "$ref": "#/components/schemas/BusinessPayoutLinkConfig" + "$ref": "#/components/schemas/CardNetwork" } ], "nullable": true }, - "outgoing_webhook_custom_http_headers": { - "type": "object", - "description": "These key-value pairs are sent as additional custom headers in the outgoing webhook request. It is recommended not to use more than four key-value pairs.", + "card_type": { + "type": "string", + "example": "CREDIT", "nullable": true }, - "tax_connector_id": { + "card_issuing_country": { "type": "string", - "description": "Merchant Connector id to be stored for tax_calculator connector", + "example": "INDIA", "nullable": true }, - "is_tax_connector_enabled": { - "type": "boolean", - "description": "Indicates if tax_calculator connector is enabled or not.\nIf set to `true` tax_connector_id will be checked." + "bank_code": { + "type": "string", + "example": "JP_AMEX", + "nullable": true }, - "is_network_tokenization_enabled": { - "type": "boolean", - "description": "Indicates if is_network_tokenization_enabled is enabled or not.\nIf set to `true` is_network_tokenization_enabled will be checked." + "nick_name": { + "type": "string", + "description": "The card holder's nick name", + "example": "John Test", + "nullable": true } - }, - "additionalProperties": false + } }, - "BusinessProfileResponse": { + "CardDetail": { "type": "object", "required": [ - "merchant_id", - "profile_id", - "profile_name", - "enable_payment_response_hash", - "redirect_to_merchant_with_http_post", - "is_tax_connector_enabled", - "is_network_tokenization_enabled" + "card_number", + "card_exp_month", + "card_exp_year", + "card_holder_name" ], "properties": { - "merchant_id": { + "card_number": { "type": "string", - "description": "The identifier for Merchant Account", - "example": "y3oqhf46pyzuxjbcn2giaqnb44", - "maxLength": 64 + "description": "Card Number", + "example": "4111111145551142" }, - "profile_id": { + "card_exp_month": { "type": "string", - "description": "The identifier for business profile. This must be used for creating merchant accounts, payments and payouts", - "example": "pro_abcdefghijklmnopqrstuvwxyz", - "maxLength": 64 + "description": "Card Expiry Month", + "example": "10" }, - "profile_name": { + "card_exp_year": { "type": "string", - "description": "Name of the business profile", - "maxLength": 64 + "description": "Card Expiry Year", + "example": "25" }, - "return_url": { + "card_holder_name": { "type": "string", - "description": "The URL to redirect after the completion of the operation", - "example": "https://www.example.com/success", - "nullable": true, - "maxLength": 255 - }, - "enable_payment_response_hash": { - "type": "boolean", - "description": "A boolean value to indicate if payment response hash needs to be enabled", - "default": true, - "example": true + "description": "Card Holder Name", + "example": "John Doe" }, - "payment_response_hash_key": { + "nick_name": { "type": "string", - "description": "Refers to the hash key used for calculating the signature for webhooks and redirect response. If the value is not provided, a value is automatically generated.", - "nullable": true - }, - "redirect_to_merchant_with_http_post": { - "type": "boolean", - "description": "A boolean value to indicate if redirect to merchant with http post needs to be enabled", - "default": false, - "example": true - }, - "webhook_details": { - "allOf": [ - { - "$ref": "#/components/schemas/WebhookDetails" - } - ], - "nullable": true - }, - "metadata": { - "type": "object", - "description": "Metadata is useful for storing additional, unstructured information on an object.", - "nullable": true - }, - "routing_algorithm": { - "type": "object", - "description": "The routing algorithm to be used for routing payments to desired connectors", - "nullable": true - }, - "intent_fulfillment_time": { - "type": "integer", - "format": "int64", - "description": "Will be used to determine the time till which your payment will be active once the payment session starts", - "example": 900, + "description": "Card Holder's Nick Name", + "example": "John Doe", "nullable": true }, - "frm_routing_algorithm": { - "type": "object", - "description": "The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'", + "card_issuing_country": { + "type": "string", + "description": "Card Issuing Country", "nullable": true }, - "payout_routing_algorithm": { + "card_network": { "allOf": [ { - "$ref": "#/components/schemas/RoutingAlgorithm" + "$ref": "#/components/schemas/CardNetwork" } ], "nullable": true }, - "applepay_verified_domains": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Verified Apple Pay domains for a particular profile", + "card_issuer": { + "type": "string", + "description": "Issuer Bank for Card", "nullable": true }, - "session_expiry": { - "type": "integer", - "format": "int64", - "description": "Client Secret Default expiry for all payments created under this business profile", - "example": 900, + "card_type": { + "type": "string", + "description": "Card Type", "nullable": true - }, - "payment_link_config": { - "allOf": [ - { - "$ref": "#/components/schemas/BusinessPaymentLinkConfig" - } - ], + } + }, + "additionalProperties": false + }, + "CardDetailFromLocker": { + "type": "object", + "required": [ + "saved_to_locker" + ], + "properties": { + "scheme": { + "type": "string", "nullable": true }, - "authentication_connector_details": { - "allOf": [ - { - "$ref": "#/components/schemas/AuthenticationConnectorDetails" - } - ], + "issuer_country": { + "type": "string", "nullable": true }, - "use_billing_as_payment_method_billing": { - "type": "boolean", + "last4_digits": { + "type": "string", "nullable": true }, - "extended_card_info_config": { - "allOf": [ - { - "$ref": "#/components/schemas/ExtendedCardInfoConfig" - } - ], + "expiry_month": { + "type": "string", "nullable": true }, - "collect_shipping_details_from_wallet_connector": { - "type": "boolean", - "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", - "default": false, - "example": false, + "expiry_year": { + "type": "string", "nullable": true }, - "collect_billing_details_from_wallet_connector": { - "type": "boolean", - "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", - "default": false, - "example": false, + "card_token": { + "type": "string", "nullable": true }, - "always_collect_shipping_details_from_wallet_connector": { - "type": "boolean", - "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", - "default": false, - "example": false, + "card_holder_name": { + "type": "string", "nullable": true }, - "always_collect_billing_details_from_wallet_connector": { - "type": "boolean", - "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", - "default": false, - "example": false, + "card_fingerprint": { + "type": "string", "nullable": true }, - "is_connector_agnostic_mit_enabled": { - "type": "boolean", - "description": "Indicates if the MIT (merchant initiated transaction) payments can be made connector\nagnostic, i.e., MITs may be processed through different connector than CIT (customer\ninitiated transaction) based on the routing rules.\nIf set to `false`, MIT will go through the same connector as the CIT.", + "nick_name": { + "type": "string", "nullable": true }, - "payout_link_config": { + "card_network": { "allOf": [ { - "$ref": "#/components/schemas/BusinessPayoutLinkConfig" + "$ref": "#/components/schemas/CardNetwork" } ], "nullable": true }, - "outgoing_webhook_custom_http_headers": { - "type": "object", - "description": "These key-value pairs are sent as additional custom headers in the outgoing webhook request.", + "card_isin": { + "type": "string", "nullable": true }, - "tax_connector_id": { + "card_issuer": { "type": "string", - "description": "Merchant Connector id to be stored for tax_calculator connector", "nullable": true }, - "is_tax_connector_enabled": { - "type": "boolean", - "description": "Indicates if tax_calculator connector is enabled or not.\nIf set to `true` tax_connector_id will be checked." + "card_type": { + "type": "string", + "nullable": true }, - "is_network_tokenization_enabled": { - "type": "boolean", - "description": "Indicates if is_network_tokenization_enabled is enabled or not.\nIf set to `true` is_network_tokenization_enabled will be checked.", - "default": false, - "example": false + "saved_to_locker": { + "type": "boolean" } } }, - "CaptureMethod": { - "type": "string", - "description": "Default value if not passed is set to 'automatic' which results in Auth and Capture in one single API request. Pass 'manual' or 'manual_multiple' in case you want do a separate Auth and Capture by first authorizing and placing a hold on your customer's funds so that you can use the Payments/Capture endpoint later to capture the authorized amount. Pass 'manual' if you want to only capture the amount later once or 'manual_multiple' if you want to capture the funds multiple times later. Both 'manual' and 'manual_multiple' are only supported by a specific list of processors", - "enum": [ - "automatic", - "manual", - "manual_multiple", - "scheduled" - ] - }, - "CaptureResponse": { + "CardDetailUpdate": { "type": "object", "required": [ - "capture_id", - "status", - "amount", - "connector", - "authorized_attempt_id", - "capture_sequence" + "card_exp_month", + "card_exp_year", + "card_holder_name" ], "properties": { - "capture_id": { - "type": "string", - "description": "Unique identifier for the capture" - }, - "status": { - "$ref": "#/components/schemas/CaptureStatus" - }, - "amount": { - "type": "integer", - "format": "int64", - "description": "The capture amount. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,", - "example": 6540 - }, - "currency": { - "allOf": [ - { - "$ref": "#/components/schemas/Currency" - } - ], - "nullable": true - }, - "connector": { + "card_exp_month": { "type": "string", - "description": "The connector used for the payment" + "description": "Card Expiry Month", + "example": "10" }, - "authorized_attempt_id": { + "card_exp_year": { "type": "string", - "description": "Unique identifier for the parent attempt on which this capture is made" + "description": "Card Expiry Year", + "example": "25" }, - "connector_capture_id": { + "card_holder_name": { "type": "string", - "description": "A unique identifier for this capture provided by the connector", - "nullable": true - }, - "capture_sequence": { - "type": "integer", - "format": "int32", - "description": "Sequence number of this capture, in the series of captures made for the parent attempt" + "description": "Card Holder Name", + "example": "John Doe" }, - "error_message": { + "nick_name": { "type": "string", - "description": "If there was an error while calling the connector the error message is received here", - "nullable": true - }, - "error_code": { - "type": "string", - "description": "If there was an error while calling the connectors the code is received here", - "nullable": true - }, - "error_reason": { - "type": "string", - "description": "If there was an error while calling the connectors the reason is received here", - "nullable": true - }, - "reference_id": { - "type": "string", - "description": "Reference to the capture at connector side", - "nullable": true - } - } - }, - "CaptureStatus": { - "type": "string", - "enum": [ - "started", - "charged", - "pending", - "failed" - ] - }, - "Card": { - "type": "object", - "required": [ - "card_number", - "card_exp_month", - "card_exp_year", - "card_holder_name", - "card_cvc" - ], - "properties": { - "card_number": { - "type": "string", - "description": "The card number", - "example": "4242424242424242" - }, - "card_exp_month": { - "type": "string", - "description": "The card's expiry month", - "example": "24" - }, - "card_exp_year": { - "type": "string", - "description": "The card's expiry year", - "example": "24" - }, - "card_holder_name": { - "type": "string", - "description": "The card holder's name", - "example": "John Test" - }, - "card_cvc": { - "type": "string", - "description": "The CVC number for the card", - "example": "242" - }, - "card_issuer": { - "type": "string", - "description": "The name of the issuer of card", - "example": "chase", - "nullable": true - }, - "card_network": { - "allOf": [ - { - "$ref": "#/components/schemas/CardNetwork" - } - ], - "nullable": true - }, - "card_type": { - "type": "string", - "example": "CREDIT", - "nullable": true - }, - "card_issuing_country": { - "type": "string", - "example": "INDIA", - "nullable": true - }, - "bank_code": { - "type": "string", - "example": "JP_AMEX", - "nullable": true - }, - "nick_name": { - "type": "string", - "description": "The card holder's nick name", - "example": "John Test", - "nullable": true - } - } - }, - "CardDetail": { - "type": "object", - "required": [ - "card_number", - "card_exp_month", - "card_exp_year", - "card_holder_name" - ], - "properties": { - "card_number": { - "type": "string", - "description": "Card Number", - "example": "4111111145551142" - }, - "card_exp_month": { - "type": "string", - "description": "Card Expiry Month", - "example": "10" - }, - "card_exp_year": { - "type": "string", - "description": "Card Expiry Year", - "example": "25" - }, - "card_holder_name": { - "type": "string", - "description": "Card Holder Name", - "example": "John Doe" - }, - "nick_name": { - "type": "string", - "description": "Card Holder's Nick Name", - "example": "John Doe", - "nullable": true - }, - "card_issuing_country": { - "type": "string", - "description": "Card Issuing Country", - "nullable": true - }, - "card_network": { - "allOf": [ - { - "$ref": "#/components/schemas/CardNetwork" - } - ], - "nullable": true - }, - "card_issuer": { - "type": "string", - "description": "Issuer Bank for Card", - "nullable": true - }, - "card_type": { - "type": "string", - "description": "Card Type", - "nullable": true - } - }, - "additionalProperties": false - }, - "CardDetailFromLocker": { - "type": "object", - "required": [ - "saved_to_locker" - ], - "properties": { - "scheme": { - "type": "string", - "nullable": true - }, - "issuer_country": { - "type": "string", - "nullable": true - }, - "last4_digits": { - "type": "string", - "nullable": true - }, - "expiry_month": { - "type": "string", - "nullable": true - }, - "expiry_year": { - "type": "string", - "nullable": true - }, - "card_token": { - "type": "string", - "nullable": true - }, - "card_holder_name": { - "type": "string", - "nullable": true - }, - "card_fingerprint": { - "type": "string", - "nullable": true - }, - "nick_name": { - "type": "string", - "nullable": true - }, - "card_network": { - "allOf": [ - { - "$ref": "#/components/schemas/CardNetwork" - } - ], - "nullable": true - }, - "card_isin": { - "type": "string", - "nullable": true - }, - "card_issuer": { - "type": "string", - "nullable": true - }, - "card_type": { - "type": "string", - "nullable": true - }, - "saved_to_locker": { - "type": "boolean" - } - } - }, - "CardDetailUpdate": { - "type": "object", - "required": [ - "card_exp_month", - "card_exp_year", - "card_holder_name" - ], - "properties": { - "card_exp_month": { - "type": "string", - "description": "Card Expiry Month", - "example": "10" - }, - "card_exp_year": { - "type": "string", - "description": "Card Expiry Year", - "example": "25" - }, - "card_holder_name": { - "type": "string", - "description": "Card Holder Name", - "example": "John Doe" - }, - "nick_name": { - "type": "string", - "description": "Card Holder's Nick Name", - "example": "John Doe", + "description": "Card Holder's Nick Name", + "example": "John Doe", "nullable": true } }, @@ -12715,7 +12345,7 @@ }, "default_profile": { "type": "string", - "description": "The default business profile that must be used for creating merchant accounts and payments", + "description": "The default profile that must be used for creating merchant accounts and payments", "nullable": true, "maxLength": 64 }, @@ -12846,7 +12476,7 @@ }, "default_profile": { "type": "string", - "description": "The default business profile that must be used for creating merchant accounts and payments", + "description": "The default profile that must be used for creating merchant accounts and payments", "nullable": true, "maxLength": 64 }, @@ -12883,7 +12513,7 @@ }, "profile_id": { "type": "string", - "description": "Identifier for the business profile, if not provided default will be chosen from merchant account", + "description": "Identifier for the profile, if not provided default will be chosen from merchant account", "nullable": true, "maxLength": 64 }, @@ -13118,7 +12748,7 @@ }, "connector_label": { "type": "string", - "description": "A unique label to identify the connector account created under a business profile", + "description": "A unique label to identify the connector account created under a profile", "example": "stripe_US_travel", "nullable": true }, @@ -13129,7 +12759,7 @@ }, "profile_id": { "type": "string", - "description": "Identifier for the business profile, if not provided default will be chosen from merchant account", + "description": "Identifier for the profile, if not provided default will be chosen from merchant account", "maxLength": 64 }, "payment_methods_enabled": { @@ -13269,7 +12899,7 @@ }, "connector_label": { "type": "string", - "description": "A unique label to identify the connector account created under a business profile", + "description": "A unique label to identify the connector account created under a profile", "example": "stripe_US_travel", "nullable": true }, @@ -13280,7 +12910,7 @@ }, "profile_id": { "type": "string", - "description": "Identifier for the business profile, if not provided default will be chosen from merchant account", + "description": "Identifier for the profile, if not provided default will be chosen from merchant account", "maxLength": 64 }, "connector_account_details": { @@ -20998,7 +20628,180 @@ "accommodation" ] }, - "ProfileDefaultRoutingConfig": { + "ProfileCreate": { + "type": "object", + "properties": { + "profile_name": { + "type": "string", + "description": "The name of profile", + "nullable": true, + "maxLength": 64 + }, + "return_url": { + "type": "string", + "description": "The URL to redirect after the completion of the operation", + "example": "https://www.example.com/success", + "nullable": true, + "maxLength": 255 + }, + "enable_payment_response_hash": { + "type": "boolean", + "description": "A boolean value to indicate if payment response hash needs to be enabled", + "default": true, + "example": true, + "nullable": true + }, + "payment_response_hash_key": { + "type": "string", + "description": "Refers to the hash key used for calculating the signature for webhooks and redirect response. If the value is not provided, a value is automatically generated.", + "nullable": true + }, + "redirect_to_merchant_with_http_post": { + "type": "boolean", + "description": "A boolean value to indicate if redirect to merchant with http post needs to be enabled", + "default": false, + "example": true, + "nullable": true + }, + "webhook_details": { + "allOf": [ + { + "$ref": "#/components/schemas/WebhookDetails" + } + ], + "nullable": true + }, + "metadata": { + "type": "object", + "description": "Metadata is useful for storing additional, unstructured information on an object.", + "nullable": true + }, + "routing_algorithm": { + "type": "object", + "description": "The routing algorithm to be used for routing payments to desired connectors", + "nullable": true + }, + "intent_fulfillment_time": { + "type": "integer", + "format": "int32", + "description": "Will be used to determine the time till which your payment will be active once the payment session starts", + "example": 900, + "nullable": true, + "minimum": 0 + }, + "frm_routing_algorithm": { + "type": "object", + "description": "The frm routing algorithm to be used for routing payments to desired FRM's", + "nullable": true + }, + "payout_routing_algorithm": { + "allOf": [ + { + "$ref": "#/components/schemas/RoutingAlgorithm" + } + ], + "nullable": true + }, + "applepay_verified_domains": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Verified Apple Pay domains for a particular profile", + "nullable": true + }, + "session_expiry": { + "type": "integer", + "format": "int32", + "description": "Client Secret Default expiry for all payments created under this profile", + "example": 900, + "nullable": true, + "minimum": 0 + }, + "payment_link_config": { + "allOf": [ + { + "$ref": "#/components/schemas/BusinessPaymentLinkConfig" + } + ], + "nullable": true + }, + "authentication_connector_details": { + "allOf": [ + { + "$ref": "#/components/schemas/AuthenticationConnectorDetails" + } + ], + "nullable": true + }, + "use_billing_as_payment_method_billing": { + "type": "boolean", + "description": "Whether to use the billing details passed when creating the intent as payment method billing", + "nullable": true + }, + "collect_shipping_details_from_wallet_connector": { + "type": "boolean", + "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "collect_billing_details_from_wallet_connector": { + "type": "boolean", + "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "always_collect_shipping_details_from_wallet_connector": { + "type": "boolean", + "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "always_collect_billing_details_from_wallet_connector": { + "type": "boolean", + "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "is_connector_agnostic_mit_enabled": { + "type": "boolean", + "description": "Indicates if the MIT (merchant initiated transaction) payments can be made connector\nagnostic, i.e., MITs may be processed through different connector than CIT (customer\ninitiated transaction) based on the routing rules.\nIf set to `false`, MIT will go through the same connector as the CIT.", + "nullable": true + }, + "payout_link_config": { + "allOf": [ + { + "$ref": "#/components/schemas/BusinessPayoutLinkConfig" + } + ], + "nullable": true + }, + "outgoing_webhook_custom_http_headers": { + "type": "object", + "description": "These key-value pairs are sent as additional custom headers in the outgoing webhook request. It is recommended not to use more than four key-value pairs.", + "nullable": true + }, + "tax_connector_id": { + "type": "string", + "description": "Merchant Connector id to be stored for tax_calculator connector", + "nullable": true + }, + "is_tax_connector_enabled": { + "type": "boolean", + "description": "Indicates if tax_calculator connector is enabled or not.\nIf set to `true` tax_connector_id will be checked." + }, + "is_network_tokenization_enabled": { + "type": "boolean", + "description": "Indicates if is_network_tokenization_enabled is enabled or not.\nIf set to `true` is_network_tokenization_enabled will be checked." + } + }, + "additionalProperties": false + }, + "ProfileDefaultRoutingConfig": { "type": "object", "required": [ "profile_id", @@ -21016,6 +20819,203 @@ } } }, + "ProfileResponse": { + "type": "object", + "required": [ + "merchant_id", + "profile_id", + "profile_name", + "enable_payment_response_hash", + "redirect_to_merchant_with_http_post", + "is_tax_connector_enabled", + "is_network_tokenization_enabled" + ], + "properties": { + "merchant_id": { + "type": "string", + "description": "The identifier for Merchant Account", + "example": "y3oqhf46pyzuxjbcn2giaqnb44", + "maxLength": 64 + }, + "profile_id": { + "type": "string", + "description": "The identifier for profile. This must be used for creating merchant accounts, payments and payouts", + "example": "pro_abcdefghijklmnopqrstuvwxyz", + "maxLength": 64 + }, + "profile_name": { + "type": "string", + "description": "Name of the profile", + "maxLength": 64 + }, + "return_url": { + "type": "string", + "description": "The URL to redirect after the completion of the operation", + "example": "https://www.example.com/success", + "nullable": true, + "maxLength": 255 + }, + "enable_payment_response_hash": { + "type": "boolean", + "description": "A boolean value to indicate if payment response hash needs to be enabled", + "default": true, + "example": true + }, + "payment_response_hash_key": { + "type": "string", + "description": "Refers to the hash key used for calculating the signature for webhooks and redirect response. If the value is not provided, a value is automatically generated.", + "nullable": true + }, + "redirect_to_merchant_with_http_post": { + "type": "boolean", + "description": "A boolean value to indicate if redirect to merchant with http post needs to be enabled", + "default": false, + "example": true + }, + "webhook_details": { + "allOf": [ + { + "$ref": "#/components/schemas/WebhookDetails" + } + ], + "nullable": true + }, + "metadata": { + "type": "object", + "description": "Metadata is useful for storing additional, unstructured information on an object.", + "nullable": true + }, + "routing_algorithm": { + "type": "object", + "description": "The routing algorithm to be used for routing payments to desired connectors", + "nullable": true + }, + "intent_fulfillment_time": { + "type": "integer", + "format": "int64", + "description": "Will be used to determine the time till which your payment will be active once the payment session starts", + "example": 900, + "nullable": true + }, + "frm_routing_algorithm": { + "type": "object", + "description": "The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'", + "nullable": true + }, + "payout_routing_algorithm": { + "allOf": [ + { + "$ref": "#/components/schemas/RoutingAlgorithm" + } + ], + "nullable": true + }, + "applepay_verified_domains": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Verified Apple Pay domains for a particular profile", + "nullable": true + }, + "session_expiry": { + "type": "integer", + "format": "int64", + "description": "Client Secret Default expiry for all payments created under this profile", + "example": 900, + "nullable": true + }, + "payment_link_config": { + "allOf": [ + { + "$ref": "#/components/schemas/BusinessPaymentLinkConfig" + } + ], + "nullable": true + }, + "authentication_connector_details": { + "allOf": [ + { + "$ref": "#/components/schemas/AuthenticationConnectorDetails" + } + ], + "nullable": true + }, + "use_billing_as_payment_method_billing": { + "type": "boolean", + "nullable": true + }, + "extended_card_info_config": { + "allOf": [ + { + "$ref": "#/components/schemas/ExtendedCardInfoConfig" + } + ], + "nullable": true + }, + "collect_shipping_details_from_wallet_connector": { + "type": "boolean", + "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "collect_billing_details_from_wallet_connector": { + "type": "boolean", + "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector only if it is required field for connector (Eg. Apple Pay, Google Pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "always_collect_shipping_details_from_wallet_connector": { + "type": "boolean", + "description": "A boolean value to indicate if customer shipping details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "always_collect_billing_details_from_wallet_connector": { + "type": "boolean", + "description": "A boolean value to indicate if customer billing details needs to be collected from wallet\nconnector irrespective of connector required fields (Eg. Apple pay, Google pay etc)", + "default": false, + "example": false, + "nullable": true + }, + "is_connector_agnostic_mit_enabled": { + "type": "boolean", + "description": "Indicates if the MIT (merchant initiated transaction) payments can be made connector\nagnostic, i.e., MITs may be processed through different connector than CIT (customer\ninitiated transaction) based on the routing rules.\nIf set to `false`, MIT will go through the same connector as the CIT.", + "nullable": true + }, + "payout_link_config": { + "allOf": [ + { + "$ref": "#/components/schemas/BusinessPayoutLinkConfig" + } + ], + "nullable": true + }, + "outgoing_webhook_custom_http_headers": { + "type": "object", + "description": "These key-value pairs are sent as additional custom headers in the outgoing webhook request.", + "nullable": true + }, + "tax_connector_id": { + "type": "string", + "description": "Merchant Connector id to be stored for tax_calculator connector", + "nullable": true + }, + "is_tax_connector_enabled": { + "type": "boolean", + "description": "Indicates if tax_calculator connector is enabled or not.\nIf set to `true` tax_connector_id will be checked." + }, + "is_network_tokenization_enabled": { + "type": "boolean", + "description": "Indicates if is_network_tokenization_enabled is enabled or not.\nIf set to `true` is_network_tokenization_enabled will be checked.", + "default": false, + "example": false + } + } + }, "ProgramConnectorSelection": { "type": "object", "description": "The program, having a default connector selection and\na bunch of rules. Also can hold arbitrary metadata.", @@ -23953,8 +23953,8 @@ "description": "Create and manage merchant accounts" }, { - "name": "Business Profile", - "description": "Create and manage business profiles" + "name": "Profile", + "description": "Create and manage profiles" }, { "name": "Merchant Connector Account", diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs index 3b9a8e1c9834..5a9beb565d4f 100644 --- a/crates/api_models/src/admin.rs +++ b/crates/api_models/src/admin.rs @@ -210,6 +210,15 @@ impl MerchantAccountCreate { .transpose() } + pub fn get_metadata_as_secret( + &self, + ) -> CustomResult, errors::ParsingError> { + self.metadata + .as_ref() + .map(|metadata| metadata.encode_to_value().map(Secret::new)) + .transpose() + } + pub fn get_primary_details_as_value( &self, ) -> CustomResult { @@ -304,7 +313,7 @@ pub struct MerchantAccountUpdate { #[schema(value_type = Option,example = json!({"type": "single", "data": "signifyd"}))] pub frm_routing_algorithm: Option, - /// The default business profile that must be used for creating merchant accounts and payments + /// The default profile that must be used for creating merchant accounts and payments #[schema(max_length = 64, value_type = Option)] pub default_profile: Option, @@ -493,7 +502,7 @@ pub struct MerchantAccountResponse { /// A boolean value to indicate if the merchant has recon service is enabled or not, by default value is false pub is_recon_enabled: bool, - /// The default business profile that must be used for creating merchant accounts and payments + /// The default profile that must be used for creating merchant accounts and payments #[schema(max_length = 64, value_type = Option)] pub default_profile: Option, @@ -665,7 +674,7 @@ pub struct MerchantConnectorCreate { #[schema(example = "stripe_US_travel")] pub connector_label: Option, - /// Identifier for the business profile, if not provided default will be chosen from merchant account + /// Identifier for the profile, if not provided default will be chosen from merchant account #[schema(max_length = 64, value_type = String)] pub profile_id: id_type::ProfileId, @@ -785,7 +794,7 @@ pub struct MerchantConnectorCreate { #[schema(example = "stripe_US_travel")] pub connector_label: Option, - /// Identifier for the business profile, if not provided default will be chosen from merchant account + /// Identifier for the profile, if not provided default will be chosen from merchant account #[schema(max_length = 64, value_type = Option)] pub profile_id: Option, @@ -1013,7 +1022,7 @@ pub struct MerchantConnectorResponse { #[schema(value_type = Connector, example = "stripe")] pub connector_name: String, - /// A unique label to identify the connector account created under a business profile + /// A unique label to identify the connector account created under a profile #[schema(example = "stripe_US_travel")] pub connector_label: Option, @@ -1021,7 +1030,7 @@ pub struct MerchantConnectorResponse { #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)] pub id: id_type::MerchantConnectorAccountId, - /// Identifier for the business profile, if not provided default will be chosen from merchant account + /// Identifier for the profile, if not provided default will be chosen from merchant account #[schema(max_length = 64, value_type = String)] pub profile_id: id_type::ProfileId, @@ -1117,7 +1126,7 @@ pub struct MerchantConnectorResponse { #[schema(value_type = Connector, example = "stripe")] pub connector_name: String, - /// A unique label to identify the connector account created under a business profile + /// A unique label to identify the connector account created under a profile #[schema(example = "stripe_US_travel")] pub connector_label: Option, @@ -1125,7 +1134,7 @@ pub struct MerchantConnectorResponse { #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)] pub merchant_connector_id: id_type::MerchantConnectorAccountId, - /// Identifier for the business profile, if not provided default will be chosen from merchant account + /// Identifier for the profile, if not provided default will be chosen from merchant account #[schema(max_length = 64, value_type = String)] pub profile_id: id_type::ProfileId, @@ -1235,7 +1244,7 @@ pub struct MerchantConnectorListResponse { #[schema(value_type = Connector, example = "stripe")] pub connector_name: String, - /// A unique label to identify the connector account created under a business profile + /// A unique label to identify the connector account created under a profile #[schema(example = "stripe_US_travel")] pub connector_label: Option, @@ -1243,7 +1252,7 @@ pub struct MerchantConnectorListResponse { #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)] pub merchant_connector_id: id_type::MerchantConnectorAccountId, - /// Identifier for the business profile, if not provided default will be chosen from merchant account + /// Identifier for the profile, if not provided default will be chosen from merchant account #[schema(max_length = 64, value_type = String)] pub profile_id: id_type::ProfileId, @@ -1341,7 +1350,7 @@ pub struct MerchantConnectorListResponse { #[schema(value_type = Connector, example = "stripe")] pub connector_name: String, - /// A unique label to identify the connector account created under a business profile + /// A unique label to identify the connector account created under a profile #[schema(example = "stripe_US_travel")] pub connector_label: Option, @@ -1349,7 +1358,7 @@ pub struct MerchantConnectorListResponse { #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)] pub id: id_type::MerchantConnectorAccountId, - /// Identifier for the business profile, if not provided default will be chosen from merchant account + /// Identifier for the profile, if not provided default will be chosen from merchant account #[schema(max_length = 64, value_type = String)] pub profile_id: id_type::ProfileId, @@ -1806,8 +1815,8 @@ pub struct MerchantConnectorDetails { #[cfg(feature = "v1")] #[derive(Clone, Debug, Deserialize, ToSchema, Default, Serialize)] #[serde(deny_unknown_fields)] -pub struct BusinessProfileCreate { - /// The name of business profile +pub struct ProfileCreate { + /// The name of profile #[schema(max_length = 64)] pub profile_name: Option, @@ -1853,11 +1862,11 @@ pub struct BusinessProfileCreate { /// Verified Apple Pay domains for a particular profile pub applepay_verified_domains: Option>, - /// Client Secret Default expiry for all payments created under this business profile + /// Client Secret Default expiry for all payments created under this profile #[schema(example = 900)] pub session_expiry: Option, - /// Default Payment Link config for all payment links created under this business profile + /// Default Payment Link config for all payment links created under this profile pub payment_link_config: Option, /// External 3DS authentication details @@ -1924,8 +1933,8 @@ pub struct OrderFulfillmentTime(i64); #[cfg(feature = "v2")] #[derive(Clone, Debug, Deserialize, ToSchema, Default, Serialize)] #[serde(deny_unknown_fields)] -pub struct BusinessProfileCreate { - /// The name of business profile +pub struct ProfileCreate { + /// The name of profile #[schema(max_length = 64)] pub profile_name: String, @@ -1962,11 +1971,11 @@ pub struct BusinessProfileCreate { /// Verified Apple Pay domains for a particular profile pub applepay_verified_domains: Option>, - /// Client Secret Default expiry for all payments created under this business profile + /// Client Secret Default expiry for all payments created under this profile #[schema(example = 900)] pub session_expiry: Option, - /// Default Payment Link config for all payment links created under this business profile + /// Default Payment Link config for all payment links created under this profile pub payment_link_config: Option, /// External 3DS authentication details @@ -2026,16 +2035,16 @@ pub struct BusinessProfileCreate { #[cfg(feature = "v1")] #[derive(Clone, Debug, ToSchema, Serialize)] -pub struct BusinessProfileResponse { +pub struct ProfileResponse { /// The identifier for Merchant Account #[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)] pub merchant_id: id_type::MerchantId, - /// The identifier for business profile. This must be used for creating merchant accounts, payments and payouts + /// The identifier for profile. This must be used for creating merchant accounts, payments and payouts #[schema(max_length = 64, value_type = String, example = "pro_abcdefghijklmnopqrstuvwxyz")] pub profile_id: id_type::ProfileId, - /// Name of the business profile + /// Name of the profile #[schema(max_length = 64)] pub profile_name: String, @@ -2081,11 +2090,11 @@ pub struct BusinessProfileResponse { /// Verified Apple Pay domains for a particular profile pub applepay_verified_domains: Option>, - /// Client Secret Default expiry for all payments created under this business profile + /// Client Secret Default expiry for all payments created under this profile #[schema(example = 900)] pub session_expiry: Option, - /// Default Payment Link config for all payment links created under this business profile + /// Default Payment Link config for all payment links created under this profile #[schema(value_type = Option)] pub payment_link_config: Option, @@ -2148,16 +2157,16 @@ pub struct BusinessProfileResponse { #[cfg(feature = "v2")] #[derive(Clone, Debug, ToSchema, Serialize)] -pub struct BusinessProfileResponse { +pub struct ProfileResponse { /// The identifier for Merchant Account #[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)] pub merchant_id: id_type::MerchantId, - /// The identifier for business profile. This must be used for creating merchant accounts, payments and payouts + /// The identifier for profile. This must be used for creating merchant accounts, payments and payouts #[schema(max_length = 64, value_type = String, example = "pro_abcdefghijklmnopqrstuvwxyz")] pub id: id_type::ProfileId, - /// Name of the business profile + /// Name of the profile #[schema(max_length = 64)] pub profile_name: String, @@ -2186,11 +2195,11 @@ pub struct BusinessProfileResponse { /// Verified Apple Pay domains for a particular profile pub applepay_verified_domains: Option>, - /// Client Secret Default expiry for all payments created under this business profile + /// Client Secret Default expiry for all payments created under this profile #[schema(example = 900)] pub session_expiry: Option, - /// Default Payment Link config for all payment links created under this business profile + /// Default Payment Link config for all payment links created under this profile #[schema(value_type = Option)] pub payment_link_config: Option, @@ -2262,8 +2271,8 @@ pub struct BusinessProfileResponse { #[cfg(feature = "v1")] #[derive(Clone, Debug, Deserialize, ToSchema, Serialize)] #[serde(deny_unknown_fields)] -pub struct BusinessProfileUpdate { - /// The name of business profile +pub struct ProfileUpdate { + /// The name of profile #[schema(max_length = 64)] pub profile_name: Option, @@ -2309,11 +2318,11 @@ pub struct BusinessProfileUpdate { /// Verified Apple Pay domains for a particular profile pub applepay_verified_domains: Option>, - /// Client Secret Default expiry for all payments created under this business profile + /// Client Secret Default expiry for all payments created under this profile #[schema(example = 900)] pub session_expiry: Option, - /// Default Payment Link config for all payment links created under this business profile + /// Default Payment Link config for all payment links created under this profile pub payment_link_config: Option, /// External 3DS authentication details @@ -2378,8 +2387,8 @@ pub struct BusinessProfileUpdate { #[cfg(feature = "v2")] #[derive(Clone, Debug, Deserialize, ToSchema, Serialize)] #[serde(deny_unknown_fields)] -pub struct BusinessProfileUpdate { - /// The name of business profile +pub struct ProfileUpdate { + /// The name of profile #[schema(max_length = 64)] pub profile_name: Option, @@ -2416,11 +2425,11 @@ pub struct BusinessProfileUpdate { /// Verified Apple Pay domains for a particular profile pub applepay_verified_domains: Option>, - /// Client Secret Default expiry for all payments created under this business profile + /// Client Secret Default expiry for all payments created under this profile #[schema(example = 900)] pub session_expiry: Option, - /// Default Payment Link config for all payment links created under this business profile + /// Default Payment Link config for all payment links created under this profile pub payment_link_config: Option, /// External 3DS authentication details diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs index 41e958cb3f43..b10f8e32dba3 100644 --- a/crates/api_models/src/events.rs +++ b/crates/api_models/src/events.rs @@ -75,9 +75,9 @@ impl_api_event_type!( MandateId, DisputeListConstraints, RetrieveApiKeyResponse, - BusinessProfileResponse, - BusinessProfileUpdate, - BusinessProfileCreate, + ProfileResponse, + ProfileUpdate, + ProfileCreate, RevokeApiKeyResponse, ToggleKVResponse, ToggleKVRequest, diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs index 0051d0a8631f..4edc2ba2432e 100644 --- a/crates/diesel_models/src/business_profile.rs +++ b/crates/diesel_models/src/business_profile.rs @@ -18,7 +18,7 @@ use crate::schema_v2::business_profile; #[cfg(feature = "v1")] #[derive(Clone, Debug, Identifiable, Queryable, Selectable, router_derive::DebugAsDisplay)] #[diesel(table_name = business_profile, primary_key(profile_id), check_for_backend(diesel::pg::Pg))] -pub struct BusinessProfile { +pub struct Profile { pub profile_id: common_utils::id_type::ProfileId, pub merchant_id: common_utils::id_type::MerchantId, pub profile_name: String, @@ -60,7 +60,7 @@ pub struct BusinessProfile { #[cfg(feature = "v1")] #[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)] #[diesel(table_name = business_profile, primary_key(profile_id))] -pub struct BusinessProfileNew { +pub struct ProfileNew { pub profile_id: common_utils::id_type::ProfileId, pub merchant_id: common_utils::id_type::MerchantId, pub profile_name: String, @@ -101,7 +101,7 @@ pub struct BusinessProfileNew { #[cfg(feature = "v1")] #[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)] #[diesel(table_name = business_profile)] -pub struct BusinessProfileUpdateInternal { +pub struct ProfileUpdateInternal { pub profile_name: Option, pub modified_at: time::PrimitiveDateTime, pub return_url: Option, @@ -137,8 +137,8 @@ pub struct BusinessProfileUpdateInternal { } #[cfg(feature = "v1")] -impl BusinessProfileUpdateInternal { - pub fn apply_changeset(self, source: BusinessProfile) -> BusinessProfile { +impl ProfileUpdateInternal { + pub fn apply_changeset(self, source: Profile) -> Profile { let Self { profile_name, modified_at, @@ -172,7 +172,7 @@ impl BusinessProfileUpdateInternal { dynamic_routing_algorithm, is_network_tokenization_enabled, } = self; - BusinessProfile { + Profile { profile_id: source.profile_id, merchant_id: source.merchant_id, profile_name: profile_name.unwrap_or(source.profile_name), @@ -240,7 +240,7 @@ impl BusinessProfileUpdateInternal { #[cfg(feature = "v2")] #[derive(Clone, Debug, Identifiable, Queryable, Selectable, router_derive::DebugAsDisplay)] #[diesel(table_name = business_profile, primary_key(id), check_for_backend(diesel::pg::Pg))] -pub struct BusinessProfile { +pub struct Profile { pub merchant_id: common_utils::id_type::MerchantId, pub profile_name: String, pub created_at: time::PrimitiveDateTime, @@ -281,7 +281,7 @@ pub struct BusinessProfile { pub is_network_tokenization_enabled: bool, } -impl BusinessProfile { +impl Profile { #[cfg(feature = "v1")] pub fn get_id(&self) -> &common_utils::id_type::ProfileId { &self.profile_id @@ -296,7 +296,7 @@ impl BusinessProfile { #[cfg(feature = "v2")] #[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)] #[diesel(table_name = business_profile, primary_key(profile_id))] -pub struct BusinessProfileNew { +pub struct ProfileNew { pub merchant_id: common_utils::id_type::MerchantId, pub profile_name: String, pub created_at: time::PrimitiveDateTime, @@ -339,7 +339,7 @@ pub struct BusinessProfileNew { #[cfg(feature = "v2")] #[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)] #[diesel(table_name = business_profile)] -pub struct BusinessProfileUpdateInternal { +pub struct ProfileUpdateInternal { pub profile_name: Option, pub modified_at: time::PrimitiveDateTime, pub return_url: Option, @@ -376,8 +376,8 @@ pub struct BusinessProfileUpdateInternal { } #[cfg(feature = "v2")] -impl BusinessProfileUpdateInternal { - pub fn apply_changeset(self, source: BusinessProfile) -> BusinessProfile { +impl ProfileUpdateInternal { + pub fn apply_changeset(self, source: Profile) -> Profile { let Self { profile_name, modified_at, @@ -412,7 +412,7 @@ impl BusinessProfileUpdateInternal { default_fallback_routing, is_network_tokenization_enabled, } = self; - BusinessProfile { + Profile { id: source.id, merchant_id: source.merchant_id, profile_name: profile_name.unwrap_or(source.profile_name), @@ -475,58 +475,6 @@ impl BusinessProfileUpdateInternal { } } -// This is being used only in the `BusinessProfileInterface` implementation for `MockDb`. -// This can be removed once the `BusinessProfileInterface` trait has been updated to use the domain -// model instead. -#[cfg(feature = "v2")] -impl From for BusinessProfile { - fn from(new: BusinessProfileNew) -> Self { - Self { - id: new.id, - merchant_id: new.merchant_id, - profile_name: new.profile_name, - created_at: new.created_at, - modified_at: new.modified_at, - return_url: new.return_url, - enable_payment_response_hash: new.enable_payment_response_hash, - payment_response_hash_key: new.payment_response_hash_key, - redirect_to_merchant_with_http_post: new.redirect_to_merchant_with_http_post, - webhook_details: new.webhook_details, - metadata: new.metadata, - is_recon_enabled: new.is_recon_enabled, - applepay_verified_domains: new.applepay_verified_domains, - payment_link_config: new.payment_link_config, - session_expiry: new.session_expiry, - authentication_connector_details: new.authentication_connector_details, - payout_link_config: new.payout_link_config, - is_connector_agnostic_mit_enabled: new.is_connector_agnostic_mit_enabled, - is_extended_card_info_enabled: new.is_extended_card_info_enabled, - extended_card_info_config: new.extended_card_info_config, - use_billing_as_payment_method_billing: new.use_billing_as_payment_method_billing, - collect_shipping_details_from_wallet_connector: new - .collect_shipping_details_from_wallet_connector, - collect_billing_details_from_wallet_connector: new - .collect_billing_details_from_wallet_connector, - outgoing_webhook_custom_http_headers: new.outgoing_webhook_custom_http_headers, - tax_connector_id: new.tax_connector_id, - is_tax_connector_enabled: new.is_tax_connector_enabled, - routing_algorithm_id: new.routing_algorithm_id, - always_collect_billing_details_from_wallet_connector: new - .always_collect_billing_details_from_wallet_connector, - always_collect_shipping_details_from_wallet_connector: new - .always_collect_shipping_details_from_wallet_connector, - order_fulfillment_time: new.order_fulfillment_time, - order_fulfillment_time_origin: new.order_fulfillment_time_origin, - frm_routing_algorithm_id: new.frm_routing_algorithm_id, - payout_routing_algorithm_id: new.payout_routing_algorithm_id, - default_fallback_routing: new.default_fallback_routing, - version: new.version, - dynamic_routing_algorithm: None, - is_network_tokenization_enabled: new.is_network_tokenization_enabled, - } - } -} - #[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression)] #[diesel(sql_type = diesel::sql_types::Jsonb)] pub struct AuthenticationConnectorDetails { diff --git a/crates/diesel_models/src/query/business_profile.rs b/crates/diesel_models/src/query/business_profile.rs index da95626935d1..3617155fbbec 100644 --- a/crates/diesel_models/src/query/business_profile.rs +++ b/crates/diesel_models/src/query/business_profile.rs @@ -6,21 +6,21 @@ use crate::schema::business_profile::dsl::{self, profile_id as dsl_identifier}; #[cfg(feature = "v2")] use crate::schema_v2::business_profile::dsl::{self, id as dsl_identifier}; use crate::{ - business_profile::{BusinessProfile, BusinessProfileNew, BusinessProfileUpdateInternal}, + business_profile::{Profile, ProfileNew, ProfileUpdateInternal}, errors, PgPooledConn, StorageResult, }; -impl BusinessProfileNew { - pub async fn insert(self, conn: &PgPooledConn) -> StorageResult { +impl ProfileNew { + pub async fn insert(self, conn: &PgPooledConn) -> StorageResult { generics::generic_insert(conn, self).await } } -impl BusinessProfile { +impl Profile { pub async fn update_by_profile_id( self, conn: &PgPooledConn, - business_profile: BusinessProfileUpdateInternal, + business_profile: ProfileUpdateInternal, ) -> StorageResult { match generics::generic_update_by_id::<::Table, _, _, _>( conn, @@ -76,7 +76,7 @@ impl BusinessProfile { .await } - pub async fn list_business_profile_by_merchant_id( + pub async fn list_profile_by_merchant_id( conn: &PgPooledConn, merchant_id: &common_utils::id_type::MerchantId, ) -> StorageResult> { diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs index 159c894f17b6..156ca4d2feb9 100644 --- a/crates/hyperswitch_domain_models/src/business_profile.rs +++ b/crates/hyperswitch_domain_models/src/business_profile.rs @@ -8,7 +8,7 @@ use common_utils::{ }; use diesel_models::business_profile::{ AuthenticationConnectorDetails, BusinessPaymentLinkConfig, BusinessPayoutLinkConfig, - BusinessProfileUpdateInternal, WebhookDetails, + ProfileUpdateInternal, WebhookDetails, }; use error_stack::ResultExt; use masking::{PeekInterface, Secret}; @@ -20,7 +20,7 @@ use crate::{ #[cfg(feature = "v1")] #[derive(Clone, Debug)] -pub struct BusinessProfile { +pub struct Profile { profile_id: common_utils::id_type::ProfileId, pub merchant_id: common_utils::id_type::MerchantId, pub profile_name: String, @@ -59,7 +59,7 @@ pub struct BusinessProfile { } #[cfg(feature = "v1")] -pub struct BusinessProfileSetter { +pub struct ProfileSetter { pub profile_id: common_utils::id_type::ProfileId, pub merchant_id: common_utils::id_type::MerchantId, pub profile_name: String, @@ -97,8 +97,8 @@ pub struct BusinessProfileSetter { } #[cfg(feature = "v1")] -impl From for BusinessProfile { - fn from(value: BusinessProfileSetter) -> Self { +impl From for Profile { + fn from(value: ProfileSetter) -> Self { Self { profile_id: value.profile_id, merchant_id: value.merchant_id, @@ -143,7 +143,7 @@ impl From for BusinessProfile { } } -impl BusinessProfile { +impl Profile { #[cfg(feature = "v1")] pub fn get_id(&self) -> &common_utils::id_type::ProfileId { &self.profile_id @@ -157,7 +157,7 @@ impl BusinessProfile { #[cfg(feature = "v1")] #[derive(Debug)] -pub struct BusinessProfileGeneralUpdate { +pub struct ProfileGeneralUpdate { pub profile_name: Option, pub return_url: Option, pub enable_payment_response_hash: Option, @@ -190,8 +190,8 @@ pub struct BusinessProfileGeneralUpdate { #[cfg(feature = "v1")] #[derive(Debug)] -pub enum BusinessProfileUpdate { - Update(Box), +pub enum ProfileUpdate { + Update(Box), RoutingAlgorithmUpdate { routing_algorithm: Option, payout_routing_algorithm: Option, @@ -211,13 +211,13 @@ pub enum BusinessProfileUpdate { } #[cfg(feature = "v1")] -impl From for BusinessProfileUpdateInternal { - fn from(business_profile_update: BusinessProfileUpdate) -> Self { +impl From for ProfileUpdateInternal { + fn from(profile_update: ProfileUpdate) -> Self { let now = date_time::now(); - match business_profile_update { - BusinessProfileUpdate::Update(update) => { - let BusinessProfileGeneralUpdate { + match profile_update { + ProfileUpdate::Update(update) => { + let ProfileGeneralUpdate { profile_name, return_url, enable_payment_response_hash, @@ -283,7 +283,7 @@ impl From for BusinessProfileUpdateInternal { is_network_tokenization_enabled, } } - BusinessProfileUpdate::RoutingAlgorithmUpdate { + ProfileUpdate::RoutingAlgorithmUpdate { routing_algorithm, payout_routing_algorithm, } => Self { @@ -319,7 +319,7 @@ impl From for BusinessProfileUpdateInternal { dynamic_routing_algorithm: None, is_network_tokenization_enabled: None, }, - BusinessProfileUpdate::DynamicRoutingAlgorithmUpdate { + ProfileUpdate::DynamicRoutingAlgorithmUpdate { dynamic_routing_algorithm, } => Self { profile_name: None, @@ -354,7 +354,7 @@ impl From for BusinessProfileUpdateInternal { dynamic_routing_algorithm, is_network_tokenization_enabled: None, }, - BusinessProfileUpdate::ExtendedCardInfoUpdate { + ProfileUpdate::ExtendedCardInfoUpdate { is_extended_card_info_enabled, } => Self { profile_name: None, @@ -389,7 +389,7 @@ impl From for BusinessProfileUpdateInternal { dynamic_routing_algorithm: None, is_network_tokenization_enabled: None, }, - BusinessProfileUpdate::ConnectorAgnosticMitUpdate { + ProfileUpdate::ConnectorAgnosticMitUpdate { is_connector_agnostic_mit_enabled, } => Self { profile_name: None, @@ -424,7 +424,7 @@ impl From for BusinessProfileUpdateInternal { dynamic_routing_algorithm: None, is_network_tokenization_enabled: None, }, - BusinessProfileUpdate::NetworkTokenizationUpdate { + ProfileUpdate::NetworkTokenizationUpdate { is_network_tokenization_enabled, } => Self { profile_name: None, @@ -465,12 +465,12 @@ impl From for BusinessProfileUpdateInternal { #[cfg(feature = "v1")] #[async_trait::async_trait] -impl super::behaviour::Conversion for BusinessProfile { - type DstType = diesel_models::business_profile::BusinessProfile; - type NewDstType = diesel_models::business_profile::BusinessProfileNew; +impl super::behaviour::Conversion for Profile { + type DstType = diesel_models::business_profile::Profile; + type NewDstType = diesel_models::business_profile::ProfileNew; async fn convert(self) -> CustomResult { - Ok(diesel_models::business_profile::BusinessProfile { + Ok(diesel_models::business_profile::Profile { profile_id: self.profile_id, merchant_id: self.merchant_id, profile_name: self.profile_name, @@ -587,7 +587,7 @@ impl super::behaviour::Conversion for BusinessProfile { } async fn construct_new(self) -> CustomResult { - Ok(diesel_models::business_profile::BusinessProfileNew { + Ok(diesel_models::business_profile::ProfileNew { profile_id: self.profile_id, merchant_id: self.merchant_id, profile_name: self.profile_name, @@ -634,7 +634,7 @@ impl super::behaviour::Conversion for BusinessProfile { #[cfg(feature = "v2")] #[derive(Clone, Debug)] -pub struct BusinessProfile { +pub struct Profile { id: common_utils::id_type::ProfileId, pub merchant_id: common_utils::id_type::MerchantId, pub profile_name: String, @@ -674,7 +674,7 @@ pub struct BusinessProfile { } #[cfg(feature = "v2")] -pub struct BusinessProfileSetter { +pub struct ProfileSetter { pub id: common_utils::id_type::ProfileId, pub merchant_id: common_utils::id_type::MerchantId, pub profile_name: String, @@ -713,8 +713,8 @@ pub struct BusinessProfileSetter { } #[cfg(feature = "v2")] -impl From for BusinessProfile { - fn from(value: BusinessProfileSetter) -> Self { +impl From for Profile { + fn from(value: ProfileSetter) -> Self { Self { id: value.id, merchant_id: value.merchant_id, @@ -760,7 +760,7 @@ impl From for BusinessProfile { } } -impl BusinessProfile { +impl Profile { pub fn get_is_tax_connector_enabled(&self) -> bool { let is_tax_connector_enabled = self.is_tax_connector_enabled; match &self.tax_connector_id { @@ -782,7 +782,7 @@ impl BusinessProfile { #[cfg(feature = "v2")] #[derive(Debug)] -pub struct BusinessProfileGeneralUpdate { +pub struct ProfileGeneralUpdate { pub profile_name: Option, pub return_url: Option, pub enable_payment_response_hash: Option, @@ -810,8 +810,8 @@ pub struct BusinessProfileGeneralUpdate { #[cfg(feature = "v2")] #[derive(Debug)] -pub enum BusinessProfileUpdate { - Update(Box), +pub enum ProfileUpdate { + Update(Box), RoutingAlgorithmUpdate { routing_algorithm_id: Option, payout_routing_algorithm_id: Option, @@ -831,13 +831,13 @@ pub enum BusinessProfileUpdate { } #[cfg(feature = "v2")] -impl From for BusinessProfileUpdateInternal { - fn from(business_profile_update: BusinessProfileUpdate) -> Self { +impl From for ProfileUpdateInternal { + fn from(profile_update: ProfileUpdate) -> Self { let now = date_time::now(); - match business_profile_update { - BusinessProfileUpdate::Update(update) => { - let BusinessProfileGeneralUpdate { + match profile_update { + ProfileUpdate::Update(update) => { + let ProfileGeneralUpdate { profile_name, return_url, enable_payment_response_hash, @@ -898,7 +898,7 @@ impl From for BusinessProfileUpdateInternal { is_network_tokenization_enabled, } } - BusinessProfileUpdate::RoutingAlgorithmUpdate { + ProfileUpdate::RoutingAlgorithmUpdate { routing_algorithm_id, payout_routing_algorithm_id, } => Self { @@ -935,7 +935,7 @@ impl From for BusinessProfileUpdateInternal { is_tax_connector_enabled: None, is_network_tokenization_enabled: None, }, - BusinessProfileUpdate::ExtendedCardInfoUpdate { + ProfileUpdate::ExtendedCardInfoUpdate { is_extended_card_info_enabled, } => Self { profile_name: None, @@ -971,7 +971,7 @@ impl From for BusinessProfileUpdateInternal { is_tax_connector_enabled: None, is_network_tokenization_enabled: None, }, - BusinessProfileUpdate::ConnectorAgnosticMitUpdate { + ProfileUpdate::ConnectorAgnosticMitUpdate { is_connector_agnostic_mit_enabled, } => Self { profile_name: None, @@ -1007,7 +1007,7 @@ impl From for BusinessProfileUpdateInternal { is_tax_connector_enabled: None, is_network_tokenization_enabled: None, }, - BusinessProfileUpdate::DefaultRoutingFallbackUpdate { + ProfileUpdate::DefaultRoutingFallbackUpdate { default_fallback_routing, } => Self { profile_name: None, @@ -1043,7 +1043,7 @@ impl From for BusinessProfileUpdateInternal { is_tax_connector_enabled: None, is_network_tokenization_enabled: None, }, - BusinessProfileUpdate::NetworkTokenizationUpdate { + ProfileUpdate::NetworkTokenizationUpdate { is_network_tokenization_enabled, } => Self { profile_name: None, @@ -1085,12 +1085,12 @@ impl From for BusinessProfileUpdateInternal { #[cfg(feature = "v2")] #[async_trait::async_trait] -impl super::behaviour::Conversion for BusinessProfile { - type DstType = diesel_models::business_profile::BusinessProfile; - type NewDstType = diesel_models::business_profile::BusinessProfileNew; +impl super::behaviour::Conversion for Profile { + type DstType = diesel_models::business_profile::Profile; + type NewDstType = diesel_models::business_profile::ProfileNew; async fn convert(self) -> CustomResult { - Ok(diesel_models::business_profile::BusinessProfile { + Ok(diesel_models::business_profile::Profile { id: self.id, merchant_id: self.merchant_id, profile_name: self.profile_name, @@ -1210,7 +1210,7 @@ impl super::behaviour::Conversion for BusinessProfile { } async fn construct_new(self) -> CustomResult { - Ok(diesel_models::business_profile::BusinessProfileNew { + Ok(diesel_models::business_profile::ProfileNew { id: self.id, merchant_id: self.merchant_id, profile_name: self.profile_name, diff --git a/crates/hyperswitch_domain_models/src/errors/api_error_response.rs b/crates/hyperswitch_domain_models/src/errors/api_error_response.rs index a289881e3a34..75bd7740026f 100644 --- a/crates/hyperswitch_domain_models/src/errors/api_error_response.rs +++ b/crates/hyperswitch_domain_models/src/errors/api_error_response.rs @@ -100,7 +100,7 @@ pub enum ApiErrorResponse { #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Merchant connector account does not exist in our records")] MerchantConnectorAccountNotFound { id: String }, #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Business profile with the given id '{id}' does not exist in our records")] - BusinessProfileNotFound { id: String }, + ProfileNotFound { id: String }, #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Poll with the given id '{id}' does not exist in our records")] PollNotFound { id: String }, #[error(error_type = ErrorType::ObjectNotFound, code = "HE_02", message = "Resource ID does not exist in our records")] @@ -408,7 +408,7 @@ impl ErrorSwitch for ApiErrorRespon Self::MerchantConnectorAccountNotFound {id } => { AER::NotFound(ApiError::new("HE", 2, "Merchant connector account does not exist in our records", Some(Extra {reason: Some(format!("{id} does not exist")), ..Default::default()}))) } - Self::BusinessProfileNotFound { id } => { + Self::ProfileNotFound { id } => { AER::NotFound(ApiError::new("HE", 2, format!("Business profile with the given id {id} does not exist"), None)) } Self::PollNotFound { .. } => { diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs index d1746a63dde9..0c9010421ba3 100644 --- a/crates/openapi/src/openapi.rs +++ b/crates/openapi/src/openapi.rs @@ -53,7 +53,7 @@ Never share your secret api keys. Keep them guarded and secure. ), tags( (name = "Merchant Account", description = "Create and manage merchant accounts"), - (name = "Business Profile", description = "Create and manage business profiles"), + (name = "Profile", description = "Create and manage profiles"), (name = "Merchant Connector Account", description = "Create and manage merchant connector accounts"), (name = "Payments", description = "Create and manage one-time payments, recurring payments and mandates"), (name = "Refunds", description = "Create and manage refunds for successful payments"), @@ -136,12 +136,12 @@ Never share your secret api keys. Keep them guarded and secure. routes::payment_method::payment_method_update_api, routes::payment_method::payment_method_delete_api, - // Routes for Business Profile - routes::business_profile::business_profile_create, - routes::business_profile::business_profile_list, - routes::business_profile::business_profile_retrieve, - routes::business_profile::business_profile_update, - routes::business_profile::business_profile_delete, + // Routes for Profile + routes::profile::profile_create, + routes::profile::profile_list, + routes::profile::profile_retrieve, + routes::profile::profile_update, + routes::profile::profile_delete, // Routes for disputes routes::disputes::retrieve_dispute, @@ -283,8 +283,8 @@ Never share your secret api keys. Keep them guarded and secure. api_models::admin::MerchantConnectorDetailsWrap, api_models::admin::MerchantConnectorDetails, api_models::admin::MerchantConnectorWebhookDetails, - api_models::admin::BusinessProfileCreate, - api_models::admin::BusinessProfileResponse, + api_models::admin::ProfileCreate, + api_models::admin::ProfileResponse, api_models::admin::BusinessPaymentLinkConfig, api_models::admin::PaymentLinkConfigRequest, api_models::admin::PaymentLinkConfig, diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs index b7771dc5e0ab..ca2974d011ad 100644 --- a/crates/openapi/src/openapi_v2.rs +++ b/crates/openapi/src/openapi_v2.rs @@ -53,7 +53,7 @@ Never share your secret api keys. Keep them guarded and secure. ), tags( (name = "Merchant Account", description = "Create and manage merchant accounts"), - (name = "Business Profile", description = "Create and manage business profiles"), + (name = "Profile", description = "Create and manage profiles"), (name = "Merchant Connector Account", description = "Create and manage merchant connector accounts"), (name = "Payments", description = "Create and manage one-time payments, recurring payments and mandates"), (name = "Refunds", description = "Create and manage refunds for successful payments"), @@ -85,20 +85,20 @@ Never share your secret api keys. Keep them guarded and secure. routes::merchant_account::merchant_account_create, routes::merchant_account::merchant_account_retrieve, routes::merchant_account::merchant_account_update, - routes::merchant_account::business_profiles_list, + routes::merchant_account::profiles_list, - // Routes for business profile - routes::business_profile::business_profile_create, - routes::business_profile::business_profile_retrieve, - routes::business_profile::business_profile_update, - routes::business_profile::connector_list, + // Routes for profile + routes::profile::profile_create, + routes::profile::profile_retrieve, + routes::profile::profile_update, + routes::profile::connector_list, - // Routes for routing under business profile - routes::business_profile::routing_link_config, - routes::business_profile::routing_unlink_config, - routes::business_profile::routing_update_default_config, - routes::business_profile::routing_retrieve_default_config, - routes::business_profile::routing_retrieve_linked_config, + // Routes for routing under profile + routes::profile::routing_link_config, + routes::profile::routing_unlink_config, + routes::profile::routing_update_default_config, + routes::profile::routing_retrieve_default_config, + routes::profile::routing_retrieve_linked_config, // Routes for routing routes::routing::routing_create_config, @@ -209,8 +209,8 @@ Never share your secret api keys. Keep them guarded and secure. api_models::admin::MerchantConnectorDetailsWrap, api_models::admin::MerchantConnectorDetails, api_models::admin::MerchantConnectorWebhookDetails, - api_models::admin::BusinessProfileCreate, - api_models::admin::BusinessProfileResponse, + api_models::admin::ProfileCreate, + api_models::admin::ProfileResponse, api_models::admin::BusinessPaymentLinkConfig, api_models::admin::PaymentLinkConfigRequest, api_models::admin::PaymentLinkConfig, diff --git a/crates/openapi/src/routes.rs b/crates/openapi/src/routes.rs index 406c88e2e3f1..453f7f557d34 100644 --- a/crates/openapi/src/routes.rs +++ b/crates/openapi/src/routes.rs @@ -2,7 +2,6 @@ pub mod api_keys; pub mod blocklist; -pub mod business_profile; pub mod customers; pub mod disputes; pub mod gsm; @@ -15,6 +14,7 @@ pub mod payment_method; pub mod payments; pub mod payouts; pub mod poll; +pub mod profile; pub mod refunds; pub mod routing; pub mod webhook_events; diff --git a/crates/openapi/src/routes/disputes.rs b/crates/openapi/src/routes/disputes.rs index c5875d67a9a9..977f0b775f8b 100644 --- a/crates/openapi/src/routes/disputes.rs +++ b/crates/openapi/src/routes/disputes.rs @@ -43,7 +43,7 @@ pub async fn retrieve_dispute() {} )] pub async fn retrieve_disputes_list() {} -/// Disputes - List Disputes for The Given Business Profiles +/// Disputes - List Disputes for The Given Profiles /// Lists all the Disputes for a merchant #[utoipa::path( get, @@ -65,7 +65,7 @@ pub async fn retrieve_disputes_list() {} (status = 401, description = "Unauthorized request") ), tag = "Disputes", - operation_id = "List Disputes for The given Business Profiles", + operation_id = "List Disputes for The given Profiles", security(("api_key" = [])) )] pub async fn retrieve_disputes_list_profile() {} diff --git a/crates/openapi/src/routes/merchant_account.rs b/crates/openapi/src/routes/merchant_account.rs index 16533c6a61cc..b92285245a43 100644 --- a/crates/openapi/src/routes/merchant_account.rs +++ b/crates/openapi/src/routes/merchant_account.rs @@ -270,20 +270,40 @@ pub async fn delete_merchant_account() {} )] pub async fn merchant_account_kv_status() {} +/// Merchant Connector - List +/// +/// List Merchant Connector Details for the merchant +#[utoipa::path( + get, + path = "/accounts/{account_id}/profile/connectors", + params( + ("account_id" = String, Path, description = "The unique identifier for the merchant account"), + ), + responses( + (status = 200, description = "Merchant Connector list retrieved successfully", body = Vec), + (status = 404, description = "Merchant Connector does not exist in records"), + (status = 401, description = "Unauthorized request") + ), + tag = "Merchant Connector Account", + operation_id = "List all Merchant Connectors for The given Profile", + security(("admin_api_key" = [])) +)] +pub async fn payment_connector_list_profile() {} + #[cfg(feature = "v2")] -/// Business Profile - List +/// Profile - List /// -/// List business profiles for an Merchant +/// List profiles for an Merchant #[utoipa::path( get, path = "/v2/merchant_accounts/{account_id}/profiles", params (("account_id" = String, Path, description = "The unique identifier for the Merchant")), responses( - (status = 200, description = "Business profile list retrieved successfully", body = Vec), + (status = 200, description = "profile list retrieved successfully", body = Vec), (status = 400, description = "Invalid data") ), tag = "Merchant Account", - operation_id = "List Business Profiles", + operation_id = "List Profiles", security(("admin_api_key" = [])) )] -pub async fn business_profiles_list() {} +pub async fn profiles_list() {} diff --git a/crates/openapi/src/routes/merchant_connector_account.rs b/crates/openapi/src/routes/merchant_connector_account.rs index a7c91ce128c5..a9cabde8af4c 100644 --- a/crates/openapi/src/routes/merchant_connector_account.rs +++ b/crates/openapi/src/routes/merchant_connector_account.rs @@ -22,7 +22,7 @@ ) ), ( - "Create a merchant connector account under a specific business profile" = ( + "Create a merchant connector account under a specific profile" = ( value = json!({ "connector_type": "payment_processor", "connector_name": "adyen", @@ -85,7 +85,7 @@ pub async fn connector_create() {} ) ), ( - "Create a merchant connector account under a specific business profile" = ( + "Create a merchant connector account under a specific profile" = ( value = json!({ "connector_type": "payment_processor", "connector_name": "adyen", diff --git a/crates/openapi/src/routes/payments.rs b/crates/openapi/src/routes/payments.rs index 1ed8c541bfd8..a3fe0cd941c5 100644 --- a/crates/openapi/src/routes/payments.rs +++ b/crates/openapi/src/routes/payments.rs @@ -459,7 +459,7 @@ pub fn payments_cancel() {} )] pub fn payments_list() {} -/// Business Profile level Payments - List +/// Profile level Payments - List /// /// To list the payments #[utoipa::path( diff --git a/crates/openapi/src/routes/business_profile.rs b/crates/openapi/src/routes/profile.rs similarity index 65% rename from crates/openapi/src/routes/business_profile.rs rename to crates/openapi/src/routes/profile.rs index 89003da08ee4..f726c76db84b 100644 --- a/crates/openapi/src/routes/business_profile.rs +++ b/crates/openapi/src/routes/profile.rs @@ -1,7 +1,9 @@ +// ******************************************** V1 profile routes ******************************************** // + #[cfg(feature = "v1")] -/// Business Profile - Create +/// Profile - Create /// -/// Creates a new *business profile* for a merchant +/// Creates a new *profile* for a merchant #[utoipa::path( post, path = "/account/{account_id}/business_profile", @@ -9,15 +11,15 @@ ("account_id" = String, Path, description = "The unique identifier for the merchant account") ), request_body( - content = BusinessProfileCreate, + content = ProfileCreate, examples( ( - "Create a business profile with minimal fields" = ( + "Create a profile with minimal fields" = ( value = json!({}) ) ), ( - "Create a business profile with profile name" = ( + "Create a profile with profile name" = ( value = json!({ "profile_name": "shoe_business" }) @@ -26,78 +28,31 @@ ) ), responses( - (status = 200, description = "Business Account Created", body = BusinessProfileResponse), + (status = 200, description = "Profile Created", body = ProfileResponse), (status = 400, description = "Invalid data") ), - tag = "Business Profile", - operation_id = "Create A Business Profile", + tag = "Profile", + operation_id = "Create A Profile", security(("admin_api_key" = [])) )] -pub async fn business_profile_create() {} - -#[cfg(feature = "v2")] -/// Business Profile - Create -/// -/// Creates a new *business profile* for a merchant -#[utoipa::path( - post, - path = "/v2/profiles", - request_body( - content = BusinessProfileCreate, - examples( - ( - "Create a business profile with profile name" = ( - value = json!({ - "profile_name": "shoe_business" - }) - ) - ) - ) - ), - responses( - (status = 200, description = "Business Account Created", body = BusinessProfileResponse), - (status = 400, description = "Invalid data") - ), - tag = "Business Profile", - operation_id = "Create A Business Profile", - security(("admin_api_key" = [])) -)] -pub async fn business_profile_create() {} - -/// Business Profile - List -/// -/// Lists all the *business profiles* under a merchant -#[utoipa::path( - get, - path = "/account/{account_id}/business_profile", - params ( - ("account_id" = String, Path, description = "Merchant Identifier"), - ), - responses( - (status = 200, description = "Business profiles Retrieved", body = Vec) - ), - tag = "Business Profile", - operation_id = "List Business Profiles", - security(("api_key" = [])) -)] -pub async fn business_profile_list() {} +pub async fn profile_create() {} #[cfg(feature = "v1")] -/// Business Profile - Update +/// Profile - Update /// -/// Update the *business profile* +/// Update the *profile* #[utoipa::path( post, path = "/account/{account_id}/business_profile/{profile_id}", params( ("account_id" = String, Path, description = "The unique identifier for the merchant account"), - ("profile_id" = String, Path, description = "The unique identifier for the business profile") + ("profile_id" = String, Path, description = "The unique identifier for the profile") ), request_body( - content = BusinessProfileCreate, + content = ProfileCreate, examples( ( - "Update business profile with profile name fields" = ( + "Update profile with profile name fields" = ( value = json!({ "profile_name" : "shoe_business" }) @@ -105,133 +60,142 @@ pub async fn business_profile_list() {} ) )), responses( - (status = 200, description = "Business Profile Updated", body = BusinessProfileResponse), + (status = 200, description = "Profile Updated", body = ProfileResponse), (status = 400, description = "Invalid data") ), - tag = "Business Profile", - operation_id = "Update a Business Profile", + tag = "Profile", + operation_id = "Update a Profile", security(("admin_api_key" = [])) )] -pub async fn business_profile_update() {} +pub async fn profile_update() {} -#[cfg(feature = "v2")] -/// Business Profile - Update +#[cfg(feature = "v1")] +/// Profile - Retrieve /// -/// Update the *business profile* +/// Retrieve existing *profile* #[utoipa::path( - put, - path = "/v2/profiles/{profile_id}", + get, + path = "/account/{account_id}/business_profile/{profile_id}", params( - ("profile_id" = String, Path, description = "The unique identifier for the business profile") + ("account_id" = String, Path, description = "The unique identifier for the merchant account"), + ("profile_id" = String, Path, description = "The unique identifier for the profile") ), - request_body( - content = BusinessProfileCreate, - examples( - ( - "Update business profile with profile name fields" = ( - value = json!({ - "profile_name" : "shoe_business" - }) - ) - ) - )), responses( - (status = 200, description = "Business Profile Updated", body = BusinessProfileResponse), + (status = 200, description = "Profile Updated", body = ProfileResponse), (status = 400, description = "Invalid data") ), - tag = "Business Profile", - operation_id = "Update a Business Profile", + tag = "Profile", + operation_id = "Retrieve a Profile", security(("admin_api_key" = [])) )] -pub async fn business_profile_update() {} +pub async fn profile_retrieve() {} + +// ******************************************** Common profile routes ******************************************** // -/// Business Profile - Delete +/// Profile - Delete /// -/// Delete the *business profile* +/// Delete the *profile* #[utoipa::path( delete, path = "/account/{account_id}/business_profile/{profile_id}", params( ("account_id" = String, Path, description = "The unique identifier for the merchant account"), - ("profile_id" = String, Path, description = "The unique identifier for the business profile") + ("profile_id" = String, Path, description = "The unique identifier for the profile") ), responses( - (status = 200, description = "Business profiles Deleted", body = bool), + (status = 200, description = "Profiles Deleted", body = bool), (status = 400, description = "Invalid data") ), - tag = "Business Profile", - operation_id = "Delete the Business Profile", + tag = "Profile", + operation_id = "Delete the Profile", security(("api_key" = [])) )] -pub async fn business_profile_delete() {} +pub async fn profile_delete() {} -#[cfg(feature = "v1")] -/// Business Profile - Retrieve +/// Profile - List /// -/// Retrieve existing *business profile* +/// Lists all the *profiles* under a merchant #[utoipa::path( get, - path = "/account/{account_id}/business_profile/{profile_id}", - params( - ("account_id" = String, Path, description = "The unique identifier for the merchant account"), - ("profile_id" = String, Path, description = "The unique identifier for the business profile") + path = "/account/{account_id}/business_profile", + params ( + ("account_id" = String, Path, description = "Merchant Identifier"), ), responses( - (status = 200, description = "Business Profile Updated", body = BusinessProfileResponse), - (status = 400, description = "Invalid data") + (status = 200, description = "Profiles Retrieved", body = Vec) ), - tag = "Business Profile", - operation_id = "Retrieve a Business Profile", - security(("admin_api_key" = [])) + tag = "Profile", + operation_id = "List Profiles", + security(("api_key" = [])) )] -pub async fn business_profile_retrieve() {} +pub async fn profile_list() {} + +// ******************************************** V2 profile routes ******************************************** // #[cfg(feature = "v2")] -/// Business Profile - Retrieve +/// Profile - Create /// -/// Retrieve existing *business profile* +/// Creates a new *profile* for a merchant #[utoipa::path( - get, - path = "/v2/profiles/{profile_id}", - params( - ("profile_id" = String, Path, description = "The unique identifier for the business profile") + post, + path = "/v2/profiles", + request_body( + content = ProfileCreate, + examples( + ( + "Create a profile with profile name" = ( + value = json!({ + "profile_name": "shoe_business" + }) + ) + ) + ) ), responses( - (status = 200, description = "Business Profile Updated", body = BusinessProfileResponse), + (status = 200, description = "Account Created", body = ProfileResponse), (status = 400, description = "Invalid data") ), - tag = "Business Profile", - operation_id = "Retrieve a Business Profile", + tag = "Profile", + operation_id = "Create A Profile", security(("admin_api_key" = [])) )] -pub async fn business_profile_retrieve() {} +pub async fn profile_create() {} #[cfg(feature = "v2")] -/// Business Profile - Retrieve Active Routing Algorithm +/// Profile - Update /// -/// Retrieve active routing algorithm under the business profile +/// Update the *profile* #[utoipa::path( - get, - path = "/v2/profiles/{profile_id}/routing_algorithm", + put, + path = "/v2/profiles/{profile_id}", params( - ("profile_id" = String, Path, description = "The unique identifier for the business profile"), - ("limit" = Option, Query, description = "The number of records of the algorithms to be returned"), - ("offset" = Option, Query, description = "The record offset of the algorithm from which to start gathering the results")), + ("profile_id" = String, Path, description = "The unique identifier for the profile") + ), + request_body( + content = ProfileCreate, + examples( + ( + "Update profile with profile name fields" = ( + value = json!({ + "profile_name" : "shoe_business" + }) + ) + ) + )), responses( - (status = 200, description = "Successfully retrieved active config", body = LinkedRoutingConfigRetrieveResponse), - (status = 500, description = "Internal server error"), - (status = 404, description = "Resource missing"), - (status = 403, description = "Forbidden") + (status = 200, description = "Profile Updated", body = ProfileResponse), + (status = 400, description = "Invalid data") ), - tag = "Business Profile", - operation_id = "Retrieve the active routing algorithm under the business profile", - security(("api_key" = []), ("jwt_key" = [])) + tag = "Profile", + operation_id = "Update a Profile", + security(("admin_api_key" = [])) )] -pub async fn routing_retrieve_linked_config() {} +pub async fn profile_update() {} + #[cfg(feature = "v2")] -/// Business Profile - Activate routing algorithm +/// Profile - Activate routing algorithm /// -/// Activates a routing algorithm under a business profile +/// Activates a routing algorithm under a profile #[utoipa::path( patch, path = "/v2/profiles/{profile_id}/activate_routing_algorithm", @@ -244,7 +208,7 @@ pub async fn routing_retrieve_linked_config() {} ) ))), params( - ("profile_id" = String, Path, description = "The unique identifier for the business profile"), + ("profile_id" = String, Path, description = "The unique identifier for the profile"), ), responses( (status = 200, description = "Routing Algorithm is activated", body = RoutingDictionaryRecord), @@ -252,21 +216,21 @@ pub async fn routing_retrieve_linked_config() {} (status = 404, description = "Resource missing"), (status = 400, description = "Bad request") ), - tag = "Business Profile", - operation_id = "Activates a routing algorithm under a business profile", + tag = "Profile", + operation_id = "Activates a routing algorithm under a profile", security(("api_key" = []), ("jwt_key" = [])) )] pub async fn routing_link_config() {} #[cfg(feature = "v2")] -/// Business Profile - Deactivate routing algorithm +/// Profile - Deactivate routing algorithm /// -/// Deactivates a routing algorithm under a business profile +/// Deactivates a routing algorithm under a profile #[utoipa::path( patch, path = "/v2/profiles/{profile_id}/deactivate_routing_algorithm", params( - ("profile_id" = String, Path, description = "The unique identifier for the business profile"), + ("profile_id" = String, Path, description = "The unique identifier for the profile"), ), responses( (status = 200, description = "Successfully deactivated routing config", body = RoutingDictionaryRecord), @@ -275,22 +239,22 @@ pub async fn routing_link_config() {} (status = 403, description = "Malformed request"), (status = 422, description = "Unprocessable request") ), - tag = "Business Profile", - operation_id = " Deactivates a routing algorithm under a business profile", + tag = "Profile", + operation_id = " Deactivates a routing algorithm under a profile", security(("api_key" = []), ("jwt_key" = [])) )] pub async fn routing_unlink_config() {} #[cfg(feature = "v2")] -/// Business Profile - Update Default Fallback Routing Algorithm +/// Profile - Update Default Fallback Routing Algorithm /// -/// Update the default fallback routing algorithm for the business profile +/// Update the default fallback routing algorithm for the profile #[utoipa::path( - post, + patch, path = "/v2/profiles/{profile_id}/fallback_routing", request_body = Vec, params( - ("profile_id" = String, Path, description = "The unique identifier for the business profile"), + ("profile_id" = String, Path, description = "The unique identifier for the profile"), ), responses( (status = 200, description = "Successfully updated the default fallback routing algorithm", body = Vec), @@ -298,28 +262,71 @@ pub async fn routing_unlink_config() {} (status = 400, description = "Malformed request"), (status = 422, description = "Unprocessable request") ), - tag = "Business Profile", - operation_id = "Update the default fallback routing algorithm for the business profile", + tag = "Profile", + operation_id = "Update the default fallback routing algorithm for the profile", security(("api_key" = []), ("jwt_key" = [])) )] pub async fn routing_update_default_config() {} #[cfg(feature = "v2")] -/// Business Profile - Retrieve Default Fallback Routing Algorithm +/// Profile - Retrieve +/// +/// Retrieve existing *profile* +#[utoipa::path( + get, + path = "/v2/profiles/{profile_id}", + params( + ("profile_id" = String, Path, description = "The unique identifier for the profile") + ), + responses( + (status = 200, description = "Profile Updated", body = ProfileResponse), + (status = 400, description = "Invalid data") + ), + tag = "Profile", + operation_id = "Retrieve a Profile", + security(("admin_api_key" = [])) +)] +pub async fn profile_retrieve() {} + +#[cfg(feature = "v2")] +/// Profile - Retrieve Active Routing Algorithm +/// +/// Retrieve active routing algorithm under the profile +#[utoipa::path( + get, + path = "/v2/profiles/{profile_id}/routing_algorithm", + params( + ("profile_id" = String, Path, description = "The unique identifier for the profile"), + ("limit" = Option, Query, description = "The number of records of the algorithms to be returned"), + ("offset" = Option, Query, description = "The record offset of the algorithm from which to start gathering the results")), + responses( + (status = 200, description = "Successfully retrieved active config", body = LinkedRoutingConfigRetrieveResponse), + (status = 500, description = "Internal server error"), + (status = 404, description = "Resource missing"), + (status = 403, description = "Forbidden") + ), + tag = "Profile", + operation_id = "Retrieve the active routing algorithm under the profile", + security(("api_key" = []), ("jwt_key" = [])) +)] +pub async fn routing_retrieve_linked_config() {} + +#[cfg(feature = "v2")] +/// Profile - Retrieve Default Fallback Routing Algorithm /// -/// Retrieve the default fallback routing algorithm for the business profile +/// Retrieve the default fallback routing algorithm for the profile #[utoipa::path( get, path = "/v2/profiles/{profile_id}/fallback_routing", params( - ("profile_id" = String, Path, description = "The unique identifier for the business profile"), + ("profile_id" = String, Path, description = "The unique identifier for the profile"), ), responses( (status = 200, description = "Successfully retrieved default fallback routing algorithm", body = Vec), (status = 500, description = "Internal server error") ), - tag = "Business Profile", - operation_id = "Retrieve the default fallback routing algorithm for the business profile", + tag = "Profile", + operation_id = "Retrieve the default fallback routing algorithm for the profile", security(("api_key" = []), ("jwt_key" = [])) )] pub async fn routing_retrieve_default_config() {} diff --git a/crates/openapi/src/routes/webhook_events.rs b/crates/openapi/src/routes/webhook_events.rs index c754f59e517a..d6bfa55f3985 100644 --- a/crates/openapi/src/routes/webhook_events.rs +++ b/crates/openapi/src/routes/webhook_events.rs @@ -1,6 +1,6 @@ /// Events - List /// -/// List all Events associated with a Merchant Account or Business Profile. +/// List all Events associated with a Merchant Account or Profile. #[utoipa::path( get, path = "/events/{merchant_id}", @@ -43,14 +43,14 @@ ( "profile_id" = Option, Query, - description = "Only include Events associated with the Business Profile identified by the specified Business Profile ID." + description = "Only include Events associated with the Profile identified by the specified Profile ID." ), ), responses( (status = 200, description = "List of Events retrieved successfully", body = Vec), ), tag = "Event", - operation_id = "List all Events associated with a Merchant Account or Business Profile", + operation_id = "List all Events associated with a Merchant Account or Profile", security(("admin_api_key" = [])) )] pub fn list_initial_webhook_delivery_attempts() {} diff --git a/crates/router/src/compatibility/stripe/errors.rs b/crates/router/src/compatibility/stripe/errors.rs index 547b6e1e54a6..efe0ac157e01 100644 --- a/crates/router/src/compatibility/stripe/errors.rs +++ b/crates/router/src/compatibility/stripe/errors.rs @@ -611,7 +611,7 @@ impl From for StripeErrorCode { object: "authentication".to_owned(), id, }, - errors::ApiErrorResponse::BusinessProfileNotFound { id } => Self::ResourceMissing { + errors::ApiErrorResponse::ProfileNotFound { id } => Self::ResourceMissing { object: "business_profile".to_owned(), id, }, diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs index 95b02f0cdb36..4000add34eb8 100644 --- a/crates/router/src/core/admin.rs +++ b/crates/router/src/core/admin.rs @@ -404,8 +404,8 @@ impl MerchantAccountCreateBridge for api::MerchantAccountCreate { let mut domain_merchant_account = domain::MerchantAccount::from(merchant_account); - CreateBusinessProfile::new(self.primary_business_details.clone()) - .create_business_profiles(state, &mut domain_merchant_account, &key_store) + CreateProfile::new(self.primary_business_details.clone()) + .create_profiles(state, &mut domain_merchant_account, &key_store) .await?; Ok(domain_merchant_account) @@ -470,21 +470,21 @@ impl CreateOrValidateOrganization { } #[cfg(all(feature = "v1", feature = "olap"))] -enum CreateBusinessProfile { - /// Create business profiles from primary business details - /// If there is only one business profile created, then set this profile as default +enum CreateProfile { + /// Create profiles from primary business details + /// If there is only one profile created, then set this profile as default CreateFromPrimaryBusinessDetails { primary_business_details: Vec, }, - /// Create a default business profile, set this as default profile - CreateDefaultBusinessProfile, + /// Create a default profile, set this as default profile + CreateDefaultProfile, } #[cfg(all(feature = "v1", feature = "olap"))] -impl CreateBusinessProfile { - /// Create a new business profile action from the given information - /// If primary business details exist, then create business profiles from them - /// If primary business details are empty, then create default business profile +impl CreateProfile { + /// Create a new profile action from the given information + /// If primary business details exist, then create profiles from them + /// If primary business details are empty, then create default profile fn new(primary_business_details: Option>) -> Self { match primary_business_details { Some(primary_business_details) if !primary_business_details.is_empty() => { @@ -492,11 +492,11 @@ impl CreateBusinessProfile { primary_business_details, } } - _ => Self::CreateDefaultBusinessProfile, + _ => Self::CreateDefaultProfile, } } - async fn create_business_profiles( + async fn create_profiles( &self, state: &SessionState, merchant_account: &mut domain::MerchantAccount, @@ -506,7 +506,7 @@ impl CreateBusinessProfile { Self::CreateFromPrimaryBusinessDetails { primary_business_details, } => { - let business_profiles = Self::create_business_profiles_for_each_business_details( + let business_profiles = Self::create_profiles_for_each_business_details( state, merchant_account.clone(), primary_business_details, @@ -521,7 +521,7 @@ impl CreateBusinessProfile { .map(|business_profile| business_profile.get_id().to_owned()) } } - Self::CreateDefaultBusinessProfile => { + Self::CreateDefaultProfile => { let business_profile = self .create_default_business_profile(state, merchant_account.clone(), key_store) .await?; @@ -533,16 +533,16 @@ impl CreateBusinessProfile { Ok(()) } - /// Create default business profile + /// Create default profile async fn create_default_business_profile( &self, state: &SessionState, merchant_account: domain::MerchantAccount, key_store: &domain::MerchantKeyStore, - ) -> RouterResult { + ) -> RouterResult { let business_profile = create_and_insert_business_profile( state, - api_models::admin::BusinessProfileCreate::default(), + api_models::admin::ProfileCreate::default(), merchant_account.clone(), key_store, ) @@ -551,40 +551,38 @@ impl CreateBusinessProfile { Ok(business_profile) } - /// Create business profile for each primary_business_details, + /// Create profile for each primary_business_details, /// If there is no default profile in merchant account and only one primary_business_detail - /// is available, then create a default business profile. - async fn create_business_profiles_for_each_business_details( + /// is available, then create a default profile. + async fn create_profiles_for_each_business_details( state: &SessionState, merchant_account: domain::MerchantAccount, primary_business_details: &Vec, key_store: &domain::MerchantKeyStore, - ) -> RouterResult> { + ) -> RouterResult> { let mut business_profiles_vector = Vec::with_capacity(primary_business_details.len()); // This must ideally be run in a transaction, - // if there is an error in inserting some business profile, because of unique constraints + // if there is an error in inserting some profile, because of unique constraints // the whole query must be rolled back for business_profile in primary_business_details { let profile_name = format!("{}_{}", business_profile.country, business_profile.business); - let business_profile_create_request = api_models::admin::BusinessProfileCreate { + let profile_create_request = api_models::admin::ProfileCreate { profile_name: Some(profile_name), ..Default::default() }; create_and_insert_business_profile( state, - business_profile_create_request, + profile_create_request, merchant_account.clone(), key_store, ) .await - .map_err(|business_profile_insert_error| { - crate::logger::warn!( - "Business profile already exists {business_profile_insert_error:?}" - ); + .map_err(|profile_insert_error| { + crate::logger::warn!("Profile already exists {profile_insert_error:?}"); }) .map(|business_profile| business_profiles_vector.push(business_profile)) .ok(); @@ -606,6 +604,12 @@ impl MerchantAccountCreateBridge for api::MerchantAccountCreate { let publishable_key = create_merchant_publishable_key(); let db = &*state.store; + let metadata = self.get_metadata_as_secret().change_context( + errors::ApiErrorResponse::InvalidDataValue { + field_name: "metadata", + }, + )?; + let merchant_details = self.get_merchant_details_as_secret().change_context( errors::ApiErrorResponse::InvalidDataValue { field_name: "merchant_details", @@ -653,7 +657,7 @@ impl MerchantAccountCreateBridge for api::MerchantAccountCreate { }) .await?, publishable_key, - metadata: self.metadata, + metadata, storage_scheme: MerchantStorageScheme::PostgresOnly, created_at: date_time::now(), modified_at: date_time::now(), @@ -751,8 +755,8 @@ pub async fn get_merchant_account( #[cfg(feature = "v1")] /// For backwards compatibility, whenever new business labels are passed in -/// primary_business_details, create a business profile -pub async fn create_business_profile_from_business_labels( +/// primary_business_details, create a profile +pub async fn create_profile_from_business_labels( state: &SessionState, db: &dyn StorageInterface, key_store: &domain::MerchantKeyStore, @@ -783,27 +787,25 @@ pub async fn create_business_profile_from_business_labels( for business_profile in business_profiles_to_create { let profile_name = format!("{}_{}", business_profile.country, business_profile.business); - let business_profile_create_request = admin_types::BusinessProfileCreate { + let profile_create_request = admin_types::ProfileCreate { profile_name: Some(profile_name), ..Default::default() }; - let business_profile_create_result = create_and_insert_business_profile( + let profile_create_result = create_and_insert_business_profile( state, - business_profile_create_request, + profile_create_request, merchant_account.clone(), key_store, ) .await - .map_err(|business_profile_insert_error| { + .map_err(|profile_insert_error| { // If there is any duplicate error, we need not take any action - crate::logger::warn!( - "Business profile already exists {business_profile_insert_error:?}" - ); + crate::logger::warn!("Profile already exists {profile_insert_error:?}"); }); - // If a business_profile is created, then unset the default profile - if business_profile_create_result.is_ok() && merchant_account.default_profile.is_some() { + // If a profile is created, then unset the default profile + if profile_create_result.is_ok() && merchant_account.default_profile.is_some() { let unset_default_profile = domain::MerchantAccountUpdate::UnsetDefaultProfile; db.update_merchant( key_manager_state, @@ -896,11 +898,11 @@ impl MerchantAccountUpdateBridge for api::MerchantAccountUpdate { #[cfg(any(feature = "v1", feature = "v2"))] // In order to support backwards compatibility, if a business_labels are passed in the update - // call, then create new business_profiles with the profile_name as business_label + // call, then create new profiles with the profile_name as business_label self.primary_business_details .clone() .async_map(|primary_business_details| async { - let _ = create_business_profile_from_business_labels( + let _ = create_profile_from_business_labels( state, db, key_store, @@ -1912,7 +1914,7 @@ struct DefaultFallbackRoutingConfigUpdate<'a> { routable_connector: &'a Option, merchant_connector_id: &'a id_type::MerchantConnectorAccountId, store: &'a dyn StorageInterface, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, key_store: hyperswitch_domain_models::merchant_key_store::MerchantKeyStore, key_manager_state: &'a KeyManagerState, } @@ -1921,7 +1923,7 @@ impl<'a> DefaultFallbackRoutingConfigUpdate<'a> { async fn retrieve_and_update_default_fallback_routing_algorithm_if_routable_connector_exists( &self, ) -> RouterResult<()> { - let profile_wrapper = BusinessProfileWrapper::new(self.business_profile.clone()); + let profile_wrapper = ProfileWrapper::new(self.business_profile.clone()); let default_routing_config_for_profile = &mut profile_wrapper.get_default_fallback_list_of_connector_under_profile()?; if let Some(routable_connector_val) = self.routable_connector { @@ -2317,7 +2319,7 @@ trait MerchantConnectorAccountCreateBridge { self, state: &SessionState, key_store: domain::MerchantKeyStore, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_manager_state: &KeyManagerState, ) -> RouterResult; @@ -2327,7 +2329,7 @@ trait MerchantConnectorAccountCreateBridge { db: &dyn StorageInterface, key_manager_state: &KeyManagerState, key_store: &domain::MerchantKeyStore, - ) -> RouterResult; + ) -> RouterResult; } #[cfg(all(feature = "v2", feature = "olap",))] @@ -2337,7 +2339,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { self, state: &SessionState, key_store: domain::MerchantKeyStore, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_manager_state: &KeyManagerState, ) -> RouterResult { // If connector label is not passed in the request, generate one @@ -2462,9 +2464,9 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { db: &dyn StorageInterface, key_manager_state: &KeyManagerState, key_store: &domain::MerchantKeyStore, - ) -> RouterResult { + ) -> RouterResult { let profile_id = self.profile_id; - // Check whether this business profile belongs to the merchant + // Check whether this profile belongs to the merchant let business_profile = core_utils::validate_and_get_business_profile( db, @@ -2474,8 +2476,8 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile") - .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { + .get_required_value("Profile") + .change_context(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; @@ -2490,7 +2492,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { self, state: &SessionState, key_store: domain::MerchantKeyStore, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_manager_state: &KeyManagerState, ) -> RouterResult { // If connector label is not passed in the request, generate one @@ -2634,7 +2636,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { db: &dyn StorageInterface, key_manager_state: &KeyManagerState, key_store: &domain::MerchantKeyStore, - ) -> RouterResult { + ) -> RouterResult { match self.profile_id.or(merchant_account.default_profile.clone()) { Some(profile_id) => { // Check whether this business profile belongs to the merchant @@ -2647,12 +2649,10 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile") - .change_context( - errors::ApiErrorResponse::BusinessProfileNotFound { - id: profile_id.get_string_repr().to_owned(), - }, - )?; + .get_required_value("Profile") + .change_context(errors::ApiErrorResponse::ProfileNotFound { + id: profile_id.get_string_repr().to_owned(), + })?; Ok(business_profile) } @@ -2667,9 +2667,9 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate { merchant_account.get_id(), ) .await - .to_not_found_response( - errors::ApiErrorResponse::BusinessProfileNotFound { id: profile_name }, - )?; + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { + id: profile_name, + })?; Ok(business_profile) } @@ -3354,17 +3354,13 @@ pub fn get_frm_config_as_secret( #[cfg(feature = "v1")] pub async fn create_and_insert_business_profile( state: &SessionState, - request: api::BusinessProfileCreate, + request: api::ProfileCreate, merchant_account: domain::MerchantAccount, key_store: &domain::MerchantKeyStore, -) -> RouterResult { - let business_profile_new = admin::create_business_profile_from_merchant_account( - state, - merchant_account, - request, - key_store, - ) - .await?; +) -> RouterResult { + let business_profile_new = + admin::create_profile_from_merchant_account(state, merchant_account, request, key_store) + .await?; let profile_name = business_profile_new.profile_name.clone(); @@ -3382,14 +3378,14 @@ pub async fn create_and_insert_business_profile( #[cfg(feature = "olap")] #[async_trait::async_trait] -trait BusinessProfileCreateBridge { +trait ProfileCreateBridge { #[cfg(feature = "v1")] async fn create_domain_model_from_request( self, state: &SessionState, merchant_account: &domain::MerchantAccount, key: &domain::MerchantKeyStore, - ) -> RouterResult; + ) -> RouterResult; #[cfg(feature = "v2")] async fn create_domain_model_from_request( @@ -3397,19 +3393,19 @@ trait BusinessProfileCreateBridge { state: &SessionState, key: &domain::MerchantKeyStore, merchant_id: &id_type::MerchantId, - ) -> RouterResult; + ) -> RouterResult; } #[cfg(feature = "olap")] #[async_trait::async_trait] -impl BusinessProfileCreateBridge for api::BusinessProfileCreate { +impl ProfileCreateBridge for api::ProfileCreate { #[cfg(feature = "v1")] async fn create_domain_model_from_request( self, state: &SessionState, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, - ) -> RouterResult { + ) -> RouterResult { use common_utils::ext_traits::AsyncExt; if let Some(session_expiry) = &self.session_expiry { @@ -3464,76 +3460,74 @@ impl BusinessProfileCreateBridge for api::BusinessProfileCreate { }) .transpose()?; - Ok(domain::BusinessProfile::from( - domain::BusinessProfileSetter { - profile_id, - merchant_id: merchant_account.get_id().clone(), - profile_name, - created_at: current_time, - modified_at: current_time, - return_url: self - .return_url - .map(|return_url| return_url.to_string()) - .or(merchant_account.return_url.clone()), - enable_payment_response_hash: self - .enable_payment_response_hash - .unwrap_or(merchant_account.enable_payment_response_hash), - payment_response_hash_key: Some(payment_response_hash_key), - redirect_to_merchant_with_http_post: self - .redirect_to_merchant_with_http_post - .unwrap_or(merchant_account.redirect_to_merchant_with_http_post), - webhook_details: webhook_details.or(merchant_account.webhook_details.clone()), - metadata: self.metadata, - routing_algorithm: None, - intent_fulfillment_time: self - .intent_fulfillment_time - .map(i64::from) - .or(merchant_account.intent_fulfillment_time) - .or(Some(common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME)), - frm_routing_algorithm: self - .frm_routing_algorithm - .or(merchant_account.frm_routing_algorithm.clone()), - #[cfg(feature = "payouts")] - payout_routing_algorithm: self - .payout_routing_algorithm - .or(merchant_account.payout_routing_algorithm.clone()), - #[cfg(not(feature = "payouts"))] - payout_routing_algorithm: None, - is_recon_enabled: merchant_account.is_recon_enabled, - applepay_verified_domains: self.applepay_verified_domains, - payment_link_config, - session_expiry: self - .session_expiry - .map(i64::from) - .or(Some(common_utils::consts::DEFAULT_SESSION_EXPIRY)), - authentication_connector_details: self - .authentication_connector_details - .map(ForeignInto::foreign_into), - payout_link_config, - is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled, - is_extended_card_info_enabled: None, - extended_card_info_config: None, - use_billing_as_payment_method_billing: self - .use_billing_as_payment_method_billing - .or(Some(true)), - collect_shipping_details_from_wallet_connector: self - .collect_shipping_details_from_wallet_connector - .or(Some(false)), - collect_billing_details_from_wallet_connector: self - .collect_billing_details_from_wallet_connector - .or(Some(false)), - outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers - .map(Into::into), - tax_connector_id: self.tax_connector_id, - is_tax_connector_enabled: self.is_tax_connector_enabled, - always_collect_billing_details_from_wallet_connector: self - .always_collect_billing_details_from_wallet_connector, - always_collect_shipping_details_from_wallet_connector: self - .always_collect_shipping_details_from_wallet_connector, - dynamic_routing_algorithm: None, - is_network_tokenization_enabled: self.is_network_tokenization_enabled, - }, - )) + Ok(domain::Profile::from(domain::ProfileSetter { + profile_id, + merchant_id: merchant_account.get_id().clone(), + profile_name, + created_at: current_time, + modified_at: current_time, + return_url: self + .return_url + .map(|return_url| return_url.to_string()) + .or(merchant_account.return_url.clone()), + enable_payment_response_hash: self + .enable_payment_response_hash + .unwrap_or(merchant_account.enable_payment_response_hash), + payment_response_hash_key: Some(payment_response_hash_key), + redirect_to_merchant_with_http_post: self + .redirect_to_merchant_with_http_post + .unwrap_or(merchant_account.redirect_to_merchant_with_http_post), + webhook_details: webhook_details.or(merchant_account.webhook_details.clone()), + metadata: self.metadata, + routing_algorithm: None, + intent_fulfillment_time: self + .intent_fulfillment_time + .map(i64::from) + .or(merchant_account.intent_fulfillment_time) + .or(Some(common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME)), + frm_routing_algorithm: self + .frm_routing_algorithm + .or(merchant_account.frm_routing_algorithm.clone()), + #[cfg(feature = "payouts")] + payout_routing_algorithm: self + .payout_routing_algorithm + .or(merchant_account.payout_routing_algorithm.clone()), + #[cfg(not(feature = "payouts"))] + payout_routing_algorithm: None, + is_recon_enabled: merchant_account.is_recon_enabled, + applepay_verified_domains: self.applepay_verified_domains, + payment_link_config, + session_expiry: self + .session_expiry + .map(i64::from) + .or(Some(common_utils::consts::DEFAULT_SESSION_EXPIRY)), + authentication_connector_details: self + .authentication_connector_details + .map(ForeignInto::foreign_into), + payout_link_config, + is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled, + is_extended_card_info_enabled: None, + extended_card_info_config: None, + use_billing_as_payment_method_billing: self + .use_billing_as_payment_method_billing + .or(Some(true)), + collect_shipping_details_from_wallet_connector: self + .collect_shipping_details_from_wallet_connector + .or(Some(false)), + collect_billing_details_from_wallet_connector: self + .collect_billing_details_from_wallet_connector + .or(Some(false)), + outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers + .map(Into::into), + tax_connector_id: self.tax_connector_id, + is_tax_connector_enabled: self.is_tax_connector_enabled, + always_collect_billing_details_from_wallet_connector: self + .always_collect_billing_details_from_wallet_connector, + always_collect_shipping_details_from_wallet_connector: self + .always_collect_shipping_details_from_wallet_connector, + dynamic_routing_algorithm: None, + is_network_tokenization_enabled: self.is_network_tokenization_enabled, + })) } #[cfg(feature = "v2")] @@ -3542,7 +3536,7 @@ impl BusinessProfileCreateBridge for api::BusinessProfileCreate { state: &SessionState, key_store: &domain::MerchantKeyStore, merchant_id: &id_type::MerchantId, - ) -> RouterResult { + ) -> RouterResult { if let Some(session_expiry) = &self.session_expiry { helpers::validate_session_expiry(session_expiry.to_owned())?; } @@ -3581,74 +3575,72 @@ impl BusinessProfileCreateBridge for api::BusinessProfileCreate { }) .transpose()?; - Ok(domain::BusinessProfile::from( - domain::BusinessProfileSetter { - id: profile_id, - merchant_id: merchant_id.clone(), - profile_name, - created_at: current_time, - modified_at: current_time, - return_url: self.return_url.map(|return_url| return_url.to_string()), - enable_payment_response_hash: self.enable_payment_response_hash.unwrap_or(true), - payment_response_hash_key: Some(payment_response_hash_key), - redirect_to_merchant_with_http_post: self - .redirect_to_merchant_with_http_post - .unwrap_or(true), - webhook_details, - metadata: self.metadata, - is_recon_enabled: false, - applepay_verified_domains: self.applepay_verified_domains, - payment_link_config, - session_expiry: self - .session_expiry - .map(i64::from) - .or(Some(common_utils::consts::DEFAULT_SESSION_EXPIRY)), - authentication_connector_details: self - .authentication_connector_details - .map(ForeignInto::foreign_into), - payout_link_config, - is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled, - is_extended_card_info_enabled: None, - extended_card_info_config: None, - use_billing_as_payment_method_billing: self - .use_billing_as_payment_method_billing - .or(Some(true)), - collect_shipping_details_from_wallet_connector: self - .collect_shipping_details_from_wallet_connector_if_required - .or(Some(false)), - collect_billing_details_from_wallet_connector: self - .collect_billing_details_from_wallet_connector_if_required - .or(Some(false)), - outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers - .map(Into::into), - always_collect_billing_details_from_wallet_connector: self - .always_collect_billing_details_from_wallet_connector, - always_collect_shipping_details_from_wallet_connector: self - .always_collect_shipping_details_from_wallet_connector, - routing_algorithm_id: None, - frm_routing_algorithm_id: None, - payout_routing_algorithm_id: None, - order_fulfillment_time: self - .order_fulfillment_time - .map(|order_fulfillment_time| order_fulfillment_time.into_inner()) - .or(Some(common_utils::consts::DEFAULT_ORDER_FULFILLMENT_TIME)), - order_fulfillment_time_origin: self.order_fulfillment_time_origin, - default_fallback_routing: None, - tax_connector_id: self.tax_connector_id, - is_tax_connector_enabled: self.is_tax_connector_enabled, - is_network_tokenization_enabled: self.is_network_tokenization_enabled, - }, - )) + Ok(domain::Profile::from(domain::ProfileSetter { + id: profile_id, + merchant_id: merchant_id.clone(), + profile_name, + created_at: current_time, + modified_at: current_time, + return_url: self.return_url.map(|return_url| return_url.to_string()), + enable_payment_response_hash: self.enable_payment_response_hash.unwrap_or(true), + payment_response_hash_key: Some(payment_response_hash_key), + redirect_to_merchant_with_http_post: self + .redirect_to_merchant_with_http_post + .unwrap_or(true), + webhook_details, + metadata: self.metadata, + is_recon_enabled: false, + applepay_verified_domains: self.applepay_verified_domains, + payment_link_config, + session_expiry: self + .session_expiry + .map(i64::from) + .or(Some(common_utils::consts::DEFAULT_SESSION_EXPIRY)), + authentication_connector_details: self + .authentication_connector_details + .map(ForeignInto::foreign_into), + payout_link_config, + is_connector_agnostic_mit_enabled: self.is_connector_agnostic_mit_enabled, + is_extended_card_info_enabled: None, + extended_card_info_config: None, + use_billing_as_payment_method_billing: self + .use_billing_as_payment_method_billing + .or(Some(true)), + collect_shipping_details_from_wallet_connector: self + .collect_shipping_details_from_wallet_connector_if_required + .or(Some(false)), + collect_billing_details_from_wallet_connector: self + .collect_billing_details_from_wallet_connector_if_required + .or(Some(false)), + outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers + .map(Into::into), + always_collect_billing_details_from_wallet_connector: self + .always_collect_billing_details_from_wallet_connector, + always_collect_shipping_details_from_wallet_connector: self + .always_collect_shipping_details_from_wallet_connector, + routing_algorithm_id: None, + frm_routing_algorithm_id: None, + payout_routing_algorithm_id: None, + order_fulfillment_time: self + .order_fulfillment_time + .map(|order_fulfillment_time| order_fulfillment_time.into_inner()) + .or(Some(common_utils::consts::DEFAULT_ORDER_FULFILLMENT_TIME)), + order_fulfillment_time_origin: self.order_fulfillment_time_origin, + default_fallback_routing: None, + tax_connector_id: self.tax_connector_id, + is_tax_connector_enabled: self.is_tax_connector_enabled, + is_network_tokenization_enabled: self.is_network_tokenization_enabled, + })) } } #[cfg(feature = "olap")] -pub async fn create_business_profile( +pub async fn create_profile( state: SessionState, - request: api::BusinessProfileCreate, + request: api::ProfileCreate, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, -) -> RouterResponse { +) -> RouterResponse { let db = state.store.as_ref(); let key_manager_state = &(&state).into(); @@ -3689,17 +3681,18 @@ pub async fn create_business_profile( } Ok(service_api::ApplicationResponse::Json( - api_models::admin::BusinessProfileResponse::foreign_try_from(business_profile) + api_models::admin::ProfileResponse::foreign_try_from(business_profile) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to parse business profile details")?, )) } -pub async fn list_business_profile( +#[cfg(feature = "olap")] +pub async fn list_profile( state: SessionState, merchant_id: id_type::MerchantId, profile_id_list: Option>, -) -> RouterResponse> { +) -> RouterResponse> { let db = state.store.as_ref(); let key_store = db .get_merchant_key_store_by_merchant_id( @@ -3710,54 +3703,53 @@ pub async fn list_business_profile( .await .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?; let profiles = db - .list_business_profile_by_merchant_id(&(&state).into(), &key_store, &merchant_id) + .list_profile_by_merchant_id(&(&state).into(), &key_store, &merchant_id) .await .to_not_found_response(errors::ApiErrorResponse::InternalServerError)? .clone(); let profiles = core_utils::filter_objects_based_on_profile_id_list(profile_id_list, profiles); let mut business_profiles = Vec::new(); for profile in profiles { - let business_profile = - api_models::admin::BusinessProfileResponse::foreign_try_from(profile) - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Failed to parse business profile details")?; + let business_profile = api_models::admin::ProfileResponse::foreign_try_from(profile) + .change_context(errors::ApiErrorResponse::InternalServerError) + .attach_printable("Failed to parse business profile details")?; business_profiles.push(business_profile); } Ok(service_api::ApplicationResponse::Json(business_profiles)) } -pub async fn retrieve_business_profile( +pub async fn retrieve_profile( state: SessionState, profile_id: id_type::ProfileId, key_store: domain::MerchantKeyStore, -) -> RouterResponse { +) -> RouterResponse { let db = state.store.as_ref(); let business_profile = db .find_business_profile_by_profile_id(&(&state).into(), &key_store, &profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; Ok(service_api::ApplicationResponse::Json( - api_models::admin::BusinessProfileResponse::foreign_try_from(business_profile) + api_models::admin::ProfileResponse::foreign_try_from(business_profile) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to parse business profile details")?, )) } -pub async fn delete_business_profile( +pub async fn delete_profile( state: SessionState, profile_id: id_type::ProfileId, merchant_id: &id_type::MerchantId, ) -> RouterResponse { let db = state.store.as_ref(); let delete_result = db - .delete_business_profile_by_profile_id_merchant_id(&profile_id, merchant_id) + .delete_profile_by_profile_id_merchant_id(&profile_id, merchant_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; @@ -3766,22 +3758,22 @@ pub async fn delete_business_profile( #[cfg(feature = "olap")] #[async_trait::async_trait] -trait BusinessProfileUpdateBridge { - async fn get_update_business_profile_object( +trait ProfileUpdateBridge { + async fn get_update_profile_object( self, state: &SessionState, key_store: &domain::MerchantKeyStore, - ) -> RouterResult; + ) -> RouterResult; } #[cfg(all(feature = "olap", feature = "v1"))] #[async_trait::async_trait] -impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate { - async fn get_update_business_profile_object( +impl ProfileUpdateBridge for api::ProfileUpdate { + async fn get_update_profile_object( self, state: &SessionState, key_store: &domain::MerchantKeyStore, - ) -> RouterResult { + ) -> RouterResult { if let Some(session_expiry) = &self.session_expiry { helpers::validate_session_expiry(session_expiry.to_owned())?; } @@ -3842,8 +3834,8 @@ impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate { }) .transpose()?; - Ok(domain::BusinessProfileUpdate::Update(Box::new( - domain::BusinessProfileGeneralUpdate { + Ok(domain::ProfileUpdate::Update(Box::new( + domain::ProfileGeneralUpdate { profile_name: self.profile_name, return_url: self.return_url.map(|return_url| return_url.to_string()), enable_payment_response_hash: self.enable_payment_response_hash, @@ -3889,12 +3881,12 @@ impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate { #[cfg(all(feature = "olap", feature = "v2"))] #[async_trait::async_trait] -impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate { - async fn get_update_business_profile_object( +impl ProfileUpdateBridge for api::ProfileUpdate { + async fn get_update_profile_object( self, state: &SessionState, key_store: &domain::MerchantKeyStore, - ) -> RouterResult { + ) -> RouterResult { if let Some(session_expiry) = &self.session_expiry { helpers::validate_session_expiry(session_expiry.to_owned())?; } @@ -3941,8 +3933,8 @@ impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate { }) .transpose()?; - Ok(domain::BusinessProfileUpdate::Update(Box::new( - domain::BusinessProfileGeneralUpdate { + Ok(domain::ProfileUpdate::Update(Box::new( + domain::ProfileGeneralUpdate { profile_name: self.profile_name, return_url: self.return_url.map(|return_url| return_url.to_string()), enable_payment_response_hash: self.enable_payment_response_hash, @@ -3981,40 +3973,40 @@ impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate { } #[cfg(feature = "olap")] -pub async fn update_business_profile( +pub async fn update_profile( state: SessionState, profile_id: &id_type::ProfileId, key_store: domain::MerchantKeyStore, - request: api::BusinessProfileUpdate, -) -> RouterResponse { + request: api::ProfileUpdate, +) -> RouterResponse { let db = state.store.as_ref(); let key_manager_state = &(&state).into(); let business_profile = db .find_business_profile_by_profile_id(key_manager_state, &key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; - let business_profile_update = request - .get_update_business_profile_object(&state, &key_store) + let profile_update = request + .get_update_profile_object(&state, &key_store) .await?; let updated_business_profile = db - .update_business_profile_by_profile_id( + .update_profile_by_profile_id( key_manager_state, &key_store, business_profile, - business_profile_update, + profile_update, ) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; Ok(service_api::ApplicationResponse::Json( - api_models::admin::BusinessProfileResponse::foreign_try_from(updated_business_profile) + api_models::admin::ProfileResponse::foreign_try_from(updated_business_profile) .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to parse business profile details")?, )) @@ -4022,13 +4014,13 @@ pub async fn update_business_profile( #[cfg(feature = "v2")] #[derive(Clone, Debug)] -pub struct BusinessProfileWrapper { - pub profile: domain::BusinessProfile, +pub struct ProfileWrapper { + pub profile: domain::Profile, } #[cfg(feature = "v2")] -impl BusinessProfileWrapper { - pub fn new(profile: domain::BusinessProfile) -> Self { +impl ProfileWrapper { + pub fn new(profile: domain::Profile) -> Self { Self { profile } } fn get_routing_config_cache_key(self) -> storage_impl::redis::cache::CacheKind<'static> { @@ -4046,7 +4038,7 @@ impl BusinessProfileWrapper { ) } - pub async fn update_business_profile_and_invalidate_routing_config_for_active_algorithm_id_update( + pub async fn update_profile_and_invalidate_routing_config_for_active_algorithm_id_update( self, db: &dyn StorageInterface, key_manager_state: &KeyManagerState, @@ -4062,18 +4054,18 @@ impl BusinessProfileWrapper { storage::enums::TransactionType::Payout => (None, Some(algorithm_id)), }; - let business_profile_update = domain::BusinessProfileUpdate::RoutingAlgorithmUpdate { + let profile_update = domain::ProfileUpdate::RoutingAlgorithmUpdate { routing_algorithm_id, payout_routing_algorithm_id, }; let profile = self.profile; - db.update_business_profile_by_profile_id( + db.update_profile_by_profile_id( key_manager_state, merchant_key_store, profile, - business_profile_update, + profile_update, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) @@ -4141,15 +4133,15 @@ impl BusinessProfileWrapper { .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to convert routing ref to value")?, ); - let business_profile_update = domain::BusinessProfileUpdate::DefaultRoutingFallbackUpdate { + let profile_update = domain::ProfileUpdate::DefaultRoutingFallbackUpdate { default_fallback_routing: Some(default_fallback_routing), }; - db.update_business_profile_by_profile_id( + db.update_profile_by_profile_id( key_manager_state, merchant_key_store, self.profile, - business_profile_update, + profile_update, ) .await .change_context(errors::ApiErrorResponse::InternalServerError) @@ -4180,7 +4172,7 @@ pub async fn extended_card_info_toggle( let business_profile = db .find_business_profile_by_profile_id(key_manager_state, &key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; @@ -4189,18 +4181,18 @@ pub async fn extended_card_info_toggle( .is_extended_card_info_enabled .is_some_and(|existing_config| existing_config != ext_card_info_choice.enabled) { - let business_profile_update = domain::BusinessProfileUpdate::ExtendedCardInfoUpdate { + let profile_update = domain::ProfileUpdate::ExtendedCardInfoUpdate { is_extended_card_info_enabled: Some(ext_card_info_choice.enabled), }; - db.update_business_profile_by_profile_id( + db.update_profile_by_profile_id( key_manager_state, &key_store, business_profile, - business_profile_update, + profile_update, ) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; } @@ -4230,7 +4222,7 @@ pub async fn connector_agnostic_mit_toggle( let business_profile = db .find_business_profile_by_profile_id(key_manager_state, &key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; @@ -4243,18 +4235,18 @@ pub async fn connector_agnostic_mit_toggle( if business_profile.is_connector_agnostic_mit_enabled != Some(connector_agnostic_mit_choice.enabled) { - let business_profile_update = domain::BusinessProfileUpdate::ConnectorAgnosticMitUpdate { + let profile_update = domain::ProfileUpdate::ConnectorAgnosticMitUpdate { is_connector_agnostic_mit_enabled: Some(connector_agnostic_mit_choice.enabled), }; - db.update_business_profile_by_profile_id( + db.update_profile_by_profile_id( key_manager_state, &key_store, business_profile, - business_profile_update, + profile_update, ) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; } diff --git a/crates/router/src/core/authentication.rs b/crates/router/src/core/authentication.rs index f77296d7bc1f..6f1746b5277c 100644 --- a/crates/router/src/core/authentication.rs +++ b/crates/router/src/core/authentication.rs @@ -80,7 +80,7 @@ pub async fn perform_authentication( pub async fn perform_post_authentication( state: &SessionState, key_store: &domain::MerchantKeyStore, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, authentication_id: String, ) -> CustomResult { let (authentication_connector, three_ds_connector_account) = @@ -121,7 +121,7 @@ pub async fn perform_pre_authentication( key_store: &domain::MerchantKeyStore, card_number: cards::CardNumber, token: String, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, acquirer_details: Option, payment_id: Option, ) -> CustomResult { diff --git a/crates/router/src/core/authentication/transformers.rs b/crates/router/src/core/authentication/transformers.rs index 4a1298bb7bf1..3372d9b355ee 100644 --- a/crates/router/src/core/authentication/transformers.rs +++ b/crates/router/src/core/authentication/transformers.rs @@ -75,7 +75,7 @@ pub fn construct_authentication_router_data( pub fn construct_post_authentication_router_data( authentication_connector: String, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, merchant_connector_account: payments_helpers::MerchantConnectorAccountType, authentication_data: &storage::Authentication, ) -> RouterResult { diff --git a/crates/router/src/core/authentication/utils.rs b/crates/router/src/core/authentication/utils.rs index b3ef8e2d9cc2..e1e5dc9f6248 100644 --- a/crates/router/src/core/authentication/utils.rs +++ b/crates/router/src/core/authentication/utils.rs @@ -266,7 +266,7 @@ where pub async fn get_authentication_connector_data( state: &SessionState, key_store: &domain::MerchantKeyStore, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult<( common_enums::AuthenticationConnectors, payments::helpers::MerchantConnectorAccountType, diff --git a/crates/router/src/core/mandate/helpers.rs b/crates/router/src/core/mandate/helpers.rs index 28ee784f6feb..b85bf6361f3d 100644 --- a/crates/router/src/core/mandate/helpers.rs +++ b/crates/router/src/core/mandate/helpers.rs @@ -33,7 +33,7 @@ pub async fn get_profile_id_for_mandate( let profile_id = pi.profile_id .clone() - .ok_or(errors::ApiErrorResponse::BusinessProfileNotFound { + .ok_or(errors::ApiErrorResponse::ProfileNotFound { id: pi .profile_id .map(|profile_id| profile_id.get_string_repr().to_owned()) diff --git a/crates/router/src/core/payment_link.rs b/crates/router/src/core/payment_link.rs index 0065e5a32b96..100e7abc85eb 100644 --- a/crates/router/src/core/payment_link.rs +++ b/crates/router/src/core/payment_link.rs @@ -140,7 +140,7 @@ pub async fn form_payment_link_data( let business_profile = db .find_business_profile_by_profile_id(key_manager_state, &key_store, &profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; @@ -762,7 +762,7 @@ pub async fn get_payment_link_status( let business_profile = db .find_business_profile_by_profile_id(key_manager_state, &key_store, &profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs index fa7ddfce997f..8e3d2799fd41 100644 --- a/crates/router/src/core/payment_methods.rs +++ b/crates/router/src/core/payment_methods.rs @@ -88,7 +88,7 @@ pub async fn retrieve_payment_method( payment_intent: &PaymentIntent, payment_attempt: &PaymentAttempt, merchant_key_store: &domain::MerchantKeyStore, - business_profile: Option<&domain::BusinessProfile>, + business_profile: Option<&domain::Profile>, ) -> RouterResult<(Option, Option)> { match pm_data { pm_opt @ Some(pm @ domain::PaymentMethodData::Card(_)) => { @@ -507,7 +507,7 @@ pub async fn retrieve_payment_method_with_token( _storage_scheme: common_enums::enums::MerchantStorageScheme, _mandate_id: Option, _payment_method_info: Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> RouterResult { todo!() } @@ -528,7 +528,7 @@ pub async fn retrieve_payment_method_with_token( storage_scheme: common_enums::enums::MerchantStorageScheme, mandate_id: Option, payment_method_info: Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult { let token = match token_data { storage::PaymentTokenData::TemporaryGeneric(generic_token) => { diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index 79d1226f13a9..d8ad8dbead46 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -89,7 +89,7 @@ use crate::{ services, types::{ api::{self, routing as routing_types, PaymentMethodCreateExt}, - domain::{self, BusinessProfile}, + domain::{self, Profile}, storage::{self, enums, PaymentMethodListContext, PaymentTokenData}, transformers::ForeignTryFrom, }, @@ -3836,7 +3836,7 @@ pub async fn list_payment_methods( fn should_collect_shipping_or_billing_details_from_wallet_connector( payment_method: &api_enums::PaymentMethod, payment_experience_optional: Option<&api_enums::PaymentExperience>, - business_profile: Option<&BusinessProfile>, + business_profile: Option<&Profile>, mut required_fields_hs: HashMap, ) -> HashMap { match (payment_method, payment_experience_optional) { @@ -3908,7 +3908,7 @@ pub async fn call_surcharge_decision_management( state: routes::SessionState, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, - business_profile: &BusinessProfile, + business_profile: &Profile, payment_attempt: &storage::PaymentAttempt, payment_intent: storage::PaymentIntent, billing_address: Option, @@ -3967,7 +3967,7 @@ pub async fn call_surcharge_decision_management_for_saved_card( state: &routes::SessionState, merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, - business_profile: &BusinessProfile, + business_profile: &Profile, payment_attempt: &storage::PaymentAttempt, payment_intent: storage::PaymentIntent, customer_payment_method_response: &mut api::CustomerPaymentMethodsListResponse, @@ -4713,7 +4713,7 @@ async fn perform_surcharge_ops( state: &routes::SessionState, merchant_account: domain::MerchantAccount, key_store: domain::MerchantKeyStore, - business_profile: Option, + business_profile: Option, response: &mut api::CustomerPaymentMethodsListResponse, ) -> Result<(), error_stack::Report> { let payment_attempt = payment_intent @@ -4758,7 +4758,7 @@ pub async fn perform_surcharge_ops( _state: &routes::SessionState, _merchant_account: domain::MerchantAccount, _key_store: domain::MerchantKeyStore, - _business_profile: Option, + _business_profile: Option, _response: &mut api::CustomerPaymentMethodsListResponse, ) -> Result<(), error_stack::Report> { todo!() diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index b8255cfcfe51..85ae86413731 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -645,7 +645,7 @@ where pub async fn call_decision_manager( state: &SessionState, merchant_account: &domain::MerchantAccount, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, payment_data: &D, ) -> RouterResult> where @@ -694,7 +694,7 @@ where pub async fn call_decision_manager( state: &SessionState, merchant_account: &domain::MerchantAccount, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, payment_data: &D, ) -> RouterResult> where @@ -790,7 +790,7 @@ pub fn get_connector_data( pub async fn call_surcharge_decision_management_for_session_flow( state: &SessionState, _merchant_account: &domain::MerchantAccount, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, payment_attempt: &storage::PaymentAttempt, payment_intent: &storage::PaymentIntent, billing_address: Option, @@ -1095,7 +1095,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize { .store .find_business_profile_by_profile_id(key_manager_state, &merchant_key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; Ok(router_types::RedirectPaymentFlowResponse { @@ -1232,7 +1232,7 @@ impl PaymentRedirectFlow for PaymentRedirectSync { .store .find_business_profile_by_profile_id(key_manager_state, &merchant_key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; Ok(router_types::RedirectPaymentFlowResponse { @@ -1467,7 +1467,7 @@ impl PaymentRedirectFlow for PaymentAuthenticateCompleteAuthorize { .store .find_business_profile_by_profile_id(key_manager_state, &merchant_key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; Ok(router_types::AuthenticatePaymentFlowResponse { @@ -1527,7 +1527,7 @@ pub async fn call_connector_service( schedule_time: Option, header_payload: HeaderPayload, frm_suggestion: Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, is_retry_payment: bool, ) -> RouterResult<( RouterData, @@ -1899,7 +1899,7 @@ pub async fn call_multiple_connectors_service( mut payment_data: D, customer: &Option, session_surcharge_details: Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, header_payload: HeaderPayload, ) -> RouterResult where @@ -2612,7 +2612,7 @@ pub async fn get_connector_tokenization_action_when_confirm_true( merchant_connector_account: &helpers::MerchantConnectorAccountType, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult<(D, TokenizationAction)> where F: Send + Clone, @@ -2742,7 +2742,7 @@ pub async fn tokenize_in_router_when_confirm_false_or_external_authentication, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult where F: Send + Clone, @@ -3352,7 +3352,7 @@ pub async fn get_connector_choice( state: &SessionState, req: &Req, merchant_account: &domain::MerchantAccount, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_store: &domain::MerchantKeyStore, payment_data: &mut D, eligible_connectors: Option>, @@ -3431,7 +3431,7 @@ where pub async fn connector_selection( state: &SessionState, merchant_account: &domain::MerchantAccount, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_store: &domain::MerchantKeyStore, payment_data: &mut D, request_straight_through: Option, @@ -3504,7 +3504,7 @@ where pub async fn decide_connector( state: SessionState, merchant_account: &domain::MerchantAccount, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_store: &domain::MerchantKeyStore, payment_data: &mut D, request_straight_through: Option, @@ -3524,7 +3524,7 @@ where pub async fn decide_connector( state: SessionState, merchant_account: &domain::MerchantAccount, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_store: &domain::MerchantKeyStore, payment_data: &mut D, request_straight_through: Option, @@ -4393,7 +4393,7 @@ where pub async fn route_connector_v1_for_payments( state: &SessionState, merchant_account: &domain::MerchantAccount, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_store: &domain::MerchantKeyStore, payment_data: &mut D, transaction_data: core_routing::PaymentsDslInput<'_>, @@ -4471,7 +4471,7 @@ where pub async fn route_connector_v1_for_payouts( state: &SessionState, merchant_account: &domain::MerchantAccount, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_store: &domain::MerchantKeyStore, transaction_data: &payouts::PayoutData, routing_data: &mut storage::RoutingData, @@ -4486,7 +4486,7 @@ pub async fn route_connector_v1_for_payouts( pub async fn route_connector_v1_for_payouts( state: &SessionState, merchant_account: &domain::MerchantAccount, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_store: &domain::MerchantKeyStore, transaction_data: &payouts::PayoutData, routing_data: &mut storage::RoutingData, @@ -4690,7 +4690,7 @@ pub async fn payment_external_authentication( .store .find_business_profile_by_profile_id(key_manager_state, &key_store, profile_id) .await - .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { + .change_context(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; diff --git a/crates/router/src/core/payments/flows.rs b/crates/router/src/core/payments/flows.rs index 984b24ab785c..245e8ae629bc 100644 --- a/crates/router/src/core/payments/flows.rs +++ b/crates/router/src/core/payments/flows.rs @@ -71,7 +71,7 @@ pub trait Feature { connector: &api::ConnectorData, call_connector_action: payments::CallConnectorAction, connector_request: Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, header_payload: api_models::payments::HeaderPayload, ) -> RouterResult where diff --git a/crates/router/src/core/payments/flows/approve_flow.rs b/crates/router/src/core/payments/flows/approve_flow.rs index e425abce3365..4ede7c50854a 100644 --- a/crates/router/src/core/payments/flows/approve_flow.rs +++ b/crates/router/src/core/payments/flows/approve_flow.rs @@ -64,7 +64,7 @@ impl Feature _connector: &api::ConnectorData, _call_connector_action: payments::CallConnectorAction, _connector_request: Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, _header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { Err(ApiErrorResponse::NotImplemented { diff --git a/crates/router/src/core/payments/flows/authorize_flow.rs b/crates/router/src/core/payments/flows/authorize_flow.rs index 0a55cefb4273..f4bf869daa69 100644 --- a/crates/router/src/core/payments/flows/authorize_flow.rs +++ b/crates/router/src/core/payments/flows/authorize_flow.rs @@ -97,7 +97,7 @@ impl Feature for types::PaymentsAu connector: &api::ConnectorData, call_connector_action: payments::CallConnectorAction, connector_request: Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, _header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { let connector_integration: services::BoxedPaymentConnectorIntegrationInterface< diff --git a/crates/router/src/core/payments/flows/cancel_flow.rs b/crates/router/src/core/payments/flows/cancel_flow.rs index a56c49611a69..fb6ed6f3ac77 100644 --- a/crates/router/src/core/payments/flows/cancel_flow.rs +++ b/crates/router/src/core/payments/flows/cancel_flow.rs @@ -64,7 +64,7 @@ impl Feature connector: &api::ConnectorData, call_connector_action: payments::CallConnectorAction, connector_request: Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, _header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { metrics::PAYMENT_CANCEL_COUNT.add( diff --git a/crates/router/src/core/payments/flows/capture_flow.rs b/crates/router/src/core/payments/flows/capture_flow.rs index cb37a75813bf..d7fea5d20e33 100644 --- a/crates/router/src/core/payments/flows/capture_flow.rs +++ b/crates/router/src/core/payments/flows/capture_flow.rs @@ -64,7 +64,7 @@ impl Feature connector: &api::ConnectorData, call_connector_action: payments::CallConnectorAction, connector_request: Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, _header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { let connector_integration: services::BoxedPaymentConnectorIntegrationInterface< diff --git a/crates/router/src/core/payments/flows/complete_authorize_flow.rs b/crates/router/src/core/payments/flows/complete_authorize_flow.rs index 212fb4bc240b..35038695f0ca 100644 --- a/crates/router/src/core/payments/flows/complete_authorize_flow.rs +++ b/crates/router/src/core/payments/flows/complete_authorize_flow.rs @@ -78,7 +78,7 @@ impl Feature connector: &api::ConnectorData, call_connector_action: payments::CallConnectorAction, connector_request: Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, _header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { let connector_integration: services::BoxedPaymentConnectorIntegrationInterface< diff --git a/crates/router/src/core/payments/flows/incremental_authorization_flow.rs b/crates/router/src/core/payments/flows/incremental_authorization_flow.rs index 226852e4a3c0..6452d2791350 100644 --- a/crates/router/src/core/payments/flows/incremental_authorization_flow.rs +++ b/crates/router/src/core/payments/flows/incremental_authorization_flow.rs @@ -71,7 +71,7 @@ impl Feature, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, _header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { let connector_integration: services::BoxedPaymentConnectorIntegrationInterface< diff --git a/crates/router/src/core/payments/flows/psync_flow.rs b/crates/router/src/core/payments/flows/psync_flow.rs index 428d170633ea..9c06cc7fd1a3 100644 --- a/crates/router/src/core/payments/flows/psync_flow.rs +++ b/crates/router/src/core/payments/flows/psync_flow.rs @@ -67,7 +67,7 @@ impl Feature connector: &api::ConnectorData, call_connector_action: payments::CallConnectorAction, connector_request: Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, _header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { let connector_integration: services::BoxedPaymentConnectorIntegrationInterface< diff --git a/crates/router/src/core/payments/flows/reject_flow.rs b/crates/router/src/core/payments/flows/reject_flow.rs index d2e65c8a638f..d6e61f3c1caa 100644 --- a/crates/router/src/core/payments/flows/reject_flow.rs +++ b/crates/router/src/core/payments/flows/reject_flow.rs @@ -63,7 +63,7 @@ impl Feature _connector: &api::ConnectorData, _call_connector_action: payments::CallConnectorAction, _connector_request: Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, _header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { Err(ApiErrorResponse::NotImplemented { diff --git a/crates/router/src/core/payments/flows/session_flow.rs b/crates/router/src/core/payments/flows/session_flow.rs index 54d8dc230c73..9dfd4482885c 100644 --- a/crates/router/src/core/payments/flows/session_flow.rs +++ b/crates/router/src/core/payments/flows/session_flow.rs @@ -77,7 +77,7 @@ impl Feature for types::PaymentsSessio connector: &api::ConnectorData, call_connector_action: payments::CallConnectorAction, _connector_request: Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { metrics::SESSION_TOKEN_CREATED.add( @@ -169,7 +169,7 @@ async fn create_applepay_session_token( state: &routes::SessionState, router_data: &types::PaymentsSessionRouterData, connector: &api::ConnectorData, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { let delayed_response = is_session_response_delayed(state, connector); @@ -638,7 +638,7 @@ fn create_gpay_session_token( state: &routes::SessionState, router_data: &types::PaymentsSessionRouterData, connector: &api::ConnectorData, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult { let connector_metadata = router_data.connector_meta_data.clone(); let delayed_response = is_session_response_delayed(state, connector); @@ -825,7 +825,7 @@ where connector: &api::ConnectorData, _confirm: Option, call_connector_action: payments::CallConnectorAction, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, header_payload: api_models::payments::HeaderPayload, ) -> RouterResult; } @@ -834,7 +834,7 @@ fn create_paypal_sdk_session_token( _state: &routes::SessionState, router_data: &types::PaymentsSessionRouterData, connector: &api::ConnectorData, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> RouterResult { let connector_metadata = router_data.connector_meta_data.clone(); @@ -874,7 +874,7 @@ impl RouterDataSession for types::PaymentsSessionRouterData { connector: &api::ConnectorData, _confirm: Option, call_connector_action: payments::CallConnectorAction, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { match connector.get_token { diff --git a/crates/router/src/core/payments/flows/session_update_flow.rs b/crates/router/src/core/payments/flows/session_update_flow.rs index c12667e19a21..3ada522a61f0 100644 --- a/crates/router/src/core/payments/flows/session_update_flow.rs +++ b/crates/router/src/core/payments/flows/session_update_flow.rs @@ -72,7 +72,7 @@ impl Feature connector: &api::ConnectorData, call_connector_action: payments::CallConnectorAction, connector_request: Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, _header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { let connector_integration: services::BoxedPaymentConnectorIntegrationInterface< diff --git a/crates/router/src/core/payments/flows/setup_mandate_flow.rs b/crates/router/src/core/payments/flows/setup_mandate_flow.rs index c412fd2b37fa..f9a5458840ea 100644 --- a/crates/router/src/core/payments/flows/setup_mandate_flow.rs +++ b/crates/router/src/core/payments/flows/setup_mandate_flow.rs @@ -69,7 +69,7 @@ impl Feature for types::Setup connector: &api::ConnectorData, call_connector_action: payments::CallConnectorAction, connector_request: Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, _header_payload: api_models::payments::HeaderPayload, ) -> RouterResult { let connector_integration: services::BoxedPaymentConnectorIntegrationInterface< diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index 81d9130db85e..e9dca13dc804 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -1809,7 +1809,7 @@ pub async fn retrieve_card_with_permanent_token( _storage_scheme: enums::MerchantStorageScheme, mandate_id: Option, payment_method_info: Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult { let customer_id = payment_intent .customer_id @@ -2121,7 +2121,7 @@ pub async fn make_pm_data<'a, F: Clone, R, D>( _merchant_key_store: &domain::MerchantKeyStore, _customer: &Option, _storage_scheme: common_enums::enums::MerchantStorageScheme, - _business_profile: Option<&domain::BusinessProfile>, + _business_profile: Option<&domain::Profile>, ) -> RouterResult<( BoxedOperation<'a, F, R, D>, Option, @@ -2141,7 +2141,7 @@ pub async fn make_pm_data<'a, F: Clone, R, D>( merchant_key_store: &domain::MerchantKeyStore, customer: &Option, storage_scheme: common_enums::enums::MerchantStorageScheme, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult<( BoxedOperation<'a, F, R, D>, Option, @@ -2250,7 +2250,7 @@ pub async fn store_in_vault_and_generate_ppmt( payment_attempt: &PaymentAttempt, payment_method: enums::PaymentMethod, merchant_key_store: &domain::MerchantKeyStore, - business_profile: Option<&domain::BusinessProfile>, + business_profile: Option<&domain::Profile>, ) -> RouterResult { let router_token = vault::Vault::store_payment_method_data_in_locker( state, @@ -2292,7 +2292,7 @@ pub async fn store_payment_method_data_in_vault( payment_method: enums::PaymentMethod, payment_method_data: &domain::PaymentMethodData, merchant_key_store: &domain::MerchantKeyStore, - business_profile: Option<&domain::BusinessProfile>, + business_profile: Option<&domain::Profile>, ) -> RouterResult> { if should_store_payment_method_data_in_vault( &state.conf.temp_locker_enable_config, @@ -2710,7 +2710,7 @@ pub(super) fn validate_payment_list_request_for_joins( pub fn get_handle_response_url( payment_id: id_type::PaymentId, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, response: &api::PaymentsResponse, connector: String, ) -> RouterResult { @@ -2731,7 +2731,7 @@ pub fn get_handle_response_url( } pub fn make_merchant_url_with_response( - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, redirection_response: api::PgRedirectResponse, request_return_url: Option<&String>, client_secret: Option<&masking::Secret>, @@ -2840,7 +2840,7 @@ pub fn make_pg_redirect_response( pub fn make_url_with_signature( redirect_url: &str, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult { let mut url = url::Url::parse(redirect_url) .change_context(errors::ApiErrorResponse::InternalServerError) @@ -4546,7 +4546,7 @@ pub async fn get_apple_pay_retryable_connectors( key_store: &domain::MerchantKeyStore, pre_routing_connector_data_list: &[api::ConnectorData], merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, ) -> CustomResult>, errors::ApiErrorResponse> where F: Send + Clone, @@ -4632,7 +4632,7 @@ where .attach_printable("Failed to get merchant default fallback connectors config")?; #[cfg(feature = "v2")] - let fallback_connetors_list = core_admin::BusinessProfileWrapper::new(business_profile) + let fallback_connetors_list = core_admin::ProfileWrapper::new(business_profile) .get_default_fallback_list_of_connector_under_profile() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to get merchant default fallback connectors config")?; @@ -5187,7 +5187,7 @@ pub async fn get_payment_method_details_from_payment_token( payment_intent: &PaymentIntent, key_store: &domain::MerchantKeyStore, storage_scheme: enums::MerchantStorageScheme, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult> { let hyperswitch_token = if let Some(token) = payment_attempt.payment_token.clone() { let redis_conn = state @@ -5342,7 +5342,7 @@ pub enum PaymentExternalAuthenticationFlow { pub async fn get_payment_external_authentication_flow_during_confirm( state: &SessionState, key_store: &domain::MerchantKeyStore, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, payment_data: &mut PaymentData, connector_call_type: &api::ConnectorCallType, mandate_type: Option, diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs index 4a38fac8522b..5199583eb5db 100644 --- a/crates/router/src/core/payments/operations.rs +++ b/crates/router/src/core/payments/operations.rs @@ -109,7 +109,7 @@ pub struct GetTrackerResponse<'a, F: Clone, R, D> { pub operation: BoxedOperation<'a, F, R, D>, pub customer_details: Option, pub payment_data: D, - pub business_profile: domain::BusinessProfile, + pub business_profile: domain::Profile, pub mandate_type: Option, } @@ -148,7 +148,7 @@ pub trait Domain: Send + Sync { storage_scheme: enums::MerchantStorageScheme, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult<( BoxedOperation<'a, F, R, D>, Option, @@ -190,7 +190,7 @@ pub trait Domain: Send + Sync { _payment_data: &mut D, _should_continue_confirm_transaction: &mut bool, _connector_call_type: &ConnectorCallType, - _merchant_account: &domain::BusinessProfile, + _merchant_account: &domain::Profile, _key_store: &domain::MerchantKeyStore, _mandate_type: Option, ) -> CustomResult<(), errors::ApiErrorResponse> { @@ -203,7 +203,7 @@ pub trait Domain: Send + Sync { _state: &SessionState, _payment_data: &mut D, _connector_call_type: &ConnectorCallType, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, _key_store: &domain::MerchantKeyStore, _merchant_account: &domain::MerchantAccount, ) -> CustomResult<(), errors::ApiErrorResponse> { @@ -225,7 +225,7 @@ pub trait Domain: Send + Sync { &'a self, _state: &SessionState, _payment_id: &common_utils::id_type::PaymentId, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, _payment_method_data: Option<&domain::PaymentMethodData>, ) -> CustomResult<(), errors::ApiErrorResponse> { Ok(()) @@ -274,7 +274,7 @@ pub trait PostUpdateTracker: Send { _merchant_account: &domain::MerchantAccount, _key_store: &domain::MerchantKeyStore, _payment_data: &mut D, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> CustomResult<(), errors::ApiErrorResponse> where F: 'b + Clone + Send + Sync, @@ -371,7 +371,7 @@ where _storage_scheme: enums::MerchantStorageScheme, _merchant_key_store: &domain::MerchantKeyStore, _customer: &Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> RouterResult<( BoxedOperation<'a, F, api::PaymentsRetrieveRequest, D>, Option, @@ -465,7 +465,7 @@ where _storage_scheme: enums::MerchantStorageScheme, _merchant_key_store: &domain::MerchantKeyStore, _customer: &Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> RouterResult<( BoxedOperation<'a, F, api::PaymentsCaptureRequest, D>, Option, @@ -570,7 +570,7 @@ where _storage_scheme: enums::MerchantStorageScheme, _merchant_key_store: &domain::MerchantKeyStore, _customer: &Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> RouterResult<( BoxedOperation<'a, F, api::PaymentsCancelRequest, D>, Option, @@ -634,7 +634,7 @@ where _storage_scheme: enums::MerchantStorageScheme, _merchant_key_store: &domain::MerchantKeyStore, _customer: &Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> RouterResult<( BoxedOperation<'a, F, api::PaymentsRejectRequest, D>, Option, diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs index 9c5b632eff0a..c57f4c34458a 100644 --- a/crates/router/src/core/payments/operations/payment_approve.rs +++ b/crates/router/src/core/payments/operations/payment_approve.rs @@ -85,7 +85,7 @@ impl GetTracker, api::PaymentsCaptureRequest> .store .find_business_profile_by_profile_id(key_manager_state, key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs index d0a896bc204d..f21ccb2c5e11 100644 --- a/crates/router/src/core/payments/operations/payment_cancel.rs +++ b/crates/router/src/core/payments/operations/payment_cancel.rs @@ -154,7 +154,7 @@ impl GetTracker, api::PaymentsCancelRequest> let business_profile = db .find_business_profile_by_profile_id(key_manager_state, key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs index 1b1b29e9160c..710d6dd7cec9 100644 --- a/crates/router/src/core/payments/operations/payment_capture.rs +++ b/crates/router/src/core/payments/operations/payment_capture.rs @@ -205,7 +205,7 @@ impl GetTracker, api::PaymentsCaptu let business_profile = db .find_business_profile_by_profile_id(key_manager_state, key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs index 0032aa2f6b36..99d8df2dfe98 100644 --- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs +++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs @@ -293,7 +293,7 @@ impl GetTracker, api::PaymentsRequest> for Co let business_profile = db .find_business_profile_by_profile_id(key_manager_state, key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; @@ -400,7 +400,7 @@ impl Domain> for Comple storage_scheme: storage_enums::MerchantStorageScheme, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult<( CompleteAuthorizeOperation<'a, F>, Option, diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs index 850563807531..c75cc29ce516 100644 --- a/crates/router/src/core/payments/operations/payment_confirm.rs +++ b/crates/router/src/core/payments/operations/payment_confirm.rs @@ -164,7 +164,7 @@ impl GetTracker, api::PaymentsRequest> for Pa ) .map(|business_profile_result| { business_profile_result.to_not_found_response( - errors::ApiErrorResponse::BusinessProfileNotFound { + errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), }, ) @@ -776,7 +776,7 @@ impl Domain> for Paymen storage_scheme: storage_enums::MerchantStorageScheme, key_store: &domain::MerchantKeyStore, customer: &Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult<( PaymentConfirmOperation<'a, F>, Option, @@ -861,7 +861,7 @@ impl Domain> for Paymen payment_data: &mut PaymentData, should_continue_confirm_transaction: &mut bool, connector_call_type: &ConnectorCallType, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_store: &domain::MerchantKeyStore, mandate_type: Option, ) -> CustomResult<(), errors::ApiErrorResponse> { @@ -965,7 +965,7 @@ impl Domain> for Paymen &'a self, state: &SessionState, payment_id: &common_utils::id_type::PaymentId, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, payment_method_data: Option<&domain::PaymentMethodData>, ) -> CustomResult<(), errors::ApiErrorResponse> { if let (Some(true), Some(domain::PaymentMethodData::Card(card)), Some(merchant_config)) = ( diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs index a9cd1ae4d84d..0731def9453d 100644 --- a/crates/router/src/core/payments/operations/payment_create.rs +++ b/crates/router/src/core/payments/operations/payment_create.rs @@ -133,11 +133,9 @@ impl GetTracker, api::PaymentsRequest> for Pa &profile_id, ) .await - .to_not_found_response( - errors::ApiErrorResponse::BusinessProfileNotFound { - id: profile_id.get_string_repr().to_owned(), - }, - )? + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { + id: profile_id.get_string_repr().to_owned(), + })? }; let customer_acceptance = request.customer_acceptance.clone().map(From::from); @@ -595,7 +593,7 @@ impl Domain> for Paymen state: &SessionState, payment_data: &mut PaymentData, _connector_call_type: &ConnectorCallType, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_store: &domain::MerchantKeyStore, merchant_account: &domain::MerchantAccount, ) -> CustomResult<(), errors::ApiErrorResponse> { @@ -702,7 +700,7 @@ impl Domain> for Paymen storage_scheme: enums::MerchantStorageScheme, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult<( PaymentCreateOperation<'a, F>, Option, diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs index 3d67dadd34d7..040eb92d4590 100644 --- a/crates/router/src/core/payments/operations/payment_reject.rs +++ b/crates/router/src/core/payments/operations/payment_reject.rs @@ -140,7 +140,7 @@ impl GetTracker, PaymentsCancelRequest> for P .store .find_business_profile_by_profile_id(key_manager_state, key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs index ae6ac330679c..90ca49c9746d 100644 --- a/crates/router/src/core/payments/operations/payment_response.rs +++ b/crates/router/src/core/payments/operations/payment_response.rs @@ -96,7 +96,7 @@ impl PostUpdateTracker, types::PaymentsAuthor merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, payment_data: &mut PaymentData, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> CustomResult<(), errors::ApiErrorResponse> where F: 'b + Clone + Send + Sync, @@ -115,7 +115,7 @@ impl PostUpdateTracker, types::PaymentsAuthor merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, payment_data: &mut PaymentData, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> CustomResult<(), errors::ApiErrorResponse> where F: 'b + Clone + Send + Sync, @@ -494,7 +494,7 @@ impl PostUpdateTracker, types::PaymentsSyncData> for merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, payment_data: &mut PaymentData, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> CustomResult<(), errors::ApiErrorResponse> where F: 'b + Clone + Send + Sync, @@ -789,7 +789,7 @@ impl PostUpdateTracker, types::SetupMandateRequestDa merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, payment_data: &mut PaymentData, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> CustomResult<(), errors::ApiErrorResponse> where F: 'b + Clone + Send + Sync, @@ -883,7 +883,7 @@ impl PostUpdateTracker, types::CompleteAuthorizeData merchant_account: &domain::MerchantAccount, key_store: &domain::MerchantKeyStore, payment_data: &mut PaymentData, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> CustomResult<(), errors::ApiErrorResponse> where F: 'b + Clone + Send + Sync, diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs index f12cd71cdb0c..0542c279a299 100644 --- a/crates/router/src/core/payments/operations/payment_session.rs +++ b/crates/router/src/core/payments/operations/payment_session.rs @@ -163,7 +163,7 @@ impl GetTracker, api::PaymentsSessionRequest> let business_profile = db .find_business_profile_by_profile_id(key_manager_state, key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; @@ -330,7 +330,7 @@ where _storage_scheme: storage_enums::MerchantStorageScheme, _merchant_key_store: &domain::MerchantKeyStore, _customer: &Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> RouterResult<( PaymentSessionOperation<'b, F>, Option, diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs index cd98d448c361..4b44933f6dd3 100644 --- a/crates/router/src/core/payments/operations/payment_start.rs +++ b/crates/router/src/core/payments/operations/payment_start.rs @@ -148,7 +148,7 @@ impl GetTracker, api::PaymentsStartRequest> f let business_profile = db .find_business_profile_by_profile_id(key_manager_state, key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; @@ -302,7 +302,7 @@ where storage_scheme: storage_enums::MerchantStorageScheme, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult<( PaymentSessionOperation<'a, F>, Option, diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs index 0760cd449fe5..d28476b67b80 100644 --- a/crates/router/src/core/payments/operations/payment_status.rs +++ b/crates/router/src/core/payments/operations/payment_status.rs @@ -93,7 +93,7 @@ impl Domain> for Paymen _storage_scheme: enums::MerchantStorageScheme, _merchant_key_store: &domain::MerchantKeyStore, _customer: &Option, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> RouterResult<( PaymentStatusOperation<'a, F, api::PaymentsRequest>, Option, @@ -408,7 +408,7 @@ async fn get_tracker_for_sync< let business_profile = db .find_business_profile_by_profile_id(key_manager_state, key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs index a1bfb47fd929..c5e7cebac34a 100644 --- a/crates/router/src/core/payments/operations/payment_update.rs +++ b/crates/router/src/core/payments/operations/payment_update.rs @@ -424,7 +424,7 @@ impl GetTracker, api::PaymentsRequest> for Pa let business_profile = db .find_business_profile_by_profile_id(key_manager_state, key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; @@ -522,7 +522,7 @@ impl Domain> for Paymen state: &SessionState, payment_data: &mut PaymentData, _connector_call_type: &ConnectorCallType, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_store: &domain::MerchantKeyStore, merchant_account: &domain::MerchantAccount, ) -> CustomResult<(), errors::ApiErrorResponse> { @@ -628,7 +628,7 @@ impl Domain> for Paymen storage_scheme: storage_enums::MerchantStorageScheme, merchant_key_store: &domain::MerchantKeyStore, customer: &Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult<( PaymentUpdateOperation<'a, F>, Option, diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs index c95fa22a039f..4e020c788b64 100644 --- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs +++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs @@ -120,7 +120,7 @@ impl .store .find_business_profile_by_profile_id(key_manager_state, key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; @@ -335,7 +335,7 @@ impl Domain, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> RouterResult<( PaymentIncrementalAuthorizationOperation<'a, F>, Option, diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs index b30d1c454673..246485c353a6 100644 --- a/crates/router/src/core/payments/operations/tax_calculation.rs +++ b/crates/router/src/core/payments/operations/tax_calculation.rs @@ -124,7 +124,7 @@ impl GetTracker, api::PaymentsDynamicTaxCalcu let business_profile = db .find_business_profile_by_profile_id(key_manager_state, key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; @@ -217,7 +217,7 @@ impl Domain, _connector_call_type: &ConnectorCallType, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, key_store: &domain::MerchantKeyStore, merchant_account: &domain::MerchantAccount, ) -> errors::CustomResult<(), errors::ApiErrorResponse> { @@ -330,7 +330,7 @@ impl Domain, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> RouterResult<( PaymentSessionUpdateOperation<'a, F>, Option, diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs index ce2456e08c4f..64a85e3358d3 100644 --- a/crates/router/src/core/payments/retry.rs +++ b/crates/router/src/core/payments/retry.rs @@ -43,7 +43,7 @@ pub async fn do_gsm_actions( validate_result: &operations::ValidateResult, schedule_time: Option, frm_suggestion: Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult> where F: Clone + Send + Sync, @@ -286,7 +286,7 @@ pub async fn do_retry( schedule_time: Option, is_step_up: bool, frm_suggestion: Option, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult> where F: Clone + Send + Sync, diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs index 5143068db961..a3123e91a142 100644 --- a/crates/router/src/core/payments/routing.rs +++ b/crates/router/src/core/payments/routing.rs @@ -283,7 +283,7 @@ pub async fn perform_static_routing_v1( state: &SessionState, merchant_id: &common_utils::id_type::MerchantId, algorithm_id: Option<&common_utils::id_type::RoutingId>, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, transaction_data: &routing::TransactionData<'_>, ) -> RoutingResult> { let algorithm_id = if let Some(id) = algorithm_id { @@ -298,7 +298,7 @@ pub async fn perform_static_routing_v1( .await .change_context(errors::RoutingError::FallbackConfigFetchFailed)?; #[cfg(feature = "v2")] - let fallback_config = admin::BusinessProfileWrapper::new(business_profile.clone()) + let fallback_config = admin::ProfileWrapper::new(business_profile.clone()) .get_default_fallback_list_of_connector_under_profile() .change_context(errors::RoutingError::FallbackConfigFetchFailed)?; @@ -721,7 +721,7 @@ pub async fn perform_fallback_routing( key_store: &domain::MerchantKeyStore, transaction_data: &routing::TransactionData<'_>, eligible_connectors: Option<&Vec>, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RoutingResult> { #[cfg(feature = "v1")] let fallback_config = routing::helpers::get_merchant_default_config( @@ -744,7 +744,7 @@ pub async fn perform_fallback_routing( .await .change_context(errors::RoutingError::FallbackConfigFetchFailed)?; #[cfg(feature = "v2")] - let fallback_config = admin::BusinessProfileWrapper::new(business_profile.clone()) + let fallback_config = admin::ProfileWrapper::new(business_profile.clone()) .get_default_fallback_list_of_connector_under_profile() .change_context(errors::RoutingError::FallbackConfigFetchFailed)?; let backend_input = match transaction_data { @@ -771,7 +771,7 @@ pub async fn perform_eligibility_analysis_with_fallback( chosen: Vec, transaction_data: &routing::TransactionData<'_>, eligible_connectors: Option>, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RoutingResult> { let mut final_selection = perform_eligibility_analysis( state, @@ -1000,7 +1000,7 @@ pub async fn perform_session_flow_routing( async fn perform_session_routing_for_pm_type( session_pm_input: &SessionRoutingPmTypeInput<'_>, transaction_type: &api_enums::TransactionType, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> RoutingResult>> { let merchant_id = &session_pm_input.key_store.merchant_id; @@ -1083,13 +1083,13 @@ async fn perform_session_routing_for_pm_type( async fn perform_session_routing_for_pm_type( session_pm_input: &SessionRoutingPmTypeInput<'_>, transaction_type: &api_enums::TransactionType, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RoutingResult>> { let merchant_id = &session_pm_input.key_store.merchant_id; let MerchantAccountRoutingAlgorithm::V1(algorithm_id) = session_pm_input.routing_algorithm; - let profile_wrapper = admin::BusinessProfileWrapper::new(business_profile.clone()); + let profile_wrapper = admin::ProfileWrapper::new(business_profile.clone()); let chosen_connectors = if let Some(ref algorithm_id) = algorithm_id { let cached_algorithm = ensure_algorithm_cached_v1( &session_pm_input.state.clone(), diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs index 46e02e6b1a88..2d81aecb30ee 100644 --- a/crates/router/src/core/payments/tokenization.rs +++ b/crates/router/src/core/payments/tokenization.rs @@ -77,7 +77,7 @@ pub async fn save_payment_method( currency: Option, billing_name: Option>, payment_method_billing_address: Option<&api::Address>, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> RouterResult<(Option, Option)> where FData: mandate::MandateBehaviour + Clone, @@ -754,7 +754,7 @@ pub async fn save_payment_method( _currency: Option, _billing_name: Option>, _payment_method_billing_address: Option<&api::Address>, - _business_profile: &domain::BusinessProfile, + _business_profile: &domain::Profile, ) -> RouterResult<(Option, Option)> where FData: mandate::MandateBehaviour + Clone, diff --git a/crates/router/src/core/payments/types.rs b/crates/router/src/core/payments/types.rs index 2257bd3e01fd..66c3eb91f519 100644 --- a/crates/router/src/core/payments/types.rs +++ b/crates/router/src/core/payments/types.rs @@ -19,7 +19,7 @@ use crate::{ core::errors::{self, RouterResult}, routes::SessionState, types::{ - domain::BusinessProfile, + domain::Profile, storage::{self, enums as storage_enums}, transformers::ForeignTryFrom, }, @@ -291,7 +291,7 @@ impl SurchargeMetadata { pub async fn persist_individual_surcharge_details_in_redis( &self, state: &SessionState, - business_profile: &BusinessProfile, + business_profile: &Profile, ) -> RouterResult<()> { if !self.is_empty_result() { let redis_conn = state diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs index c160acb50c2c..e40c0f353aa0 100644 --- a/crates/router/src/core/payouts.rs +++ b/crates/router/src/core/payouts.rs @@ -62,7 +62,7 @@ use crate::{ #[derive(Clone)] pub struct PayoutData { pub billing_address: Option, - pub business_profile: domain::BusinessProfile, + pub business_profile: domain::Profile, pub customer_details: Option, pub merchant_connector_account: Option, pub payouts: storage::Payouts, @@ -2820,7 +2820,7 @@ async fn validate_and_get_business_profile( merchant_key_store: &domain::MerchantKeyStore, profile_id: &common_utils::id_type::ProfileId, merchant_id: &common_utils::id_type::MerchantId, -) -> RouterResult { +) -> RouterResult { let db = &*state.store; let key_manager_state = &state.into(); @@ -2837,7 +2837,7 @@ async fn validate_and_get_business_profile( } else { db.find_business_profile_by_profile_id(key_manager_state, merchant_key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), }) } @@ -2846,7 +2846,7 @@ async fn validate_and_get_business_profile( #[allow(clippy::too_many_arguments)] pub async fn create_payout_link( state: &SessionState, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, customer_id: &CustomerId, merchant_id: &common_utils::id_type::MerchantId, req: &payouts::PayoutCreateRequest, diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs index ab13fa4c02d2..43412ebfd702 100644 --- a/crates/router/src/core/payouts/helpers.rs +++ b/crates/router/src/core/payouts/helpers.rs @@ -792,7 +792,7 @@ pub async fn decide_payout_connector( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile")?; + .get_required_value("Profile")?; // 2. Check routing algorithm passed in the request if let Some(routing_algorithm) = request_straight_through { diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs index 2ce75065673c..a1ba53bcd773 100644 --- a/crates/router/src/core/routing.rs +++ b/crates/router/src/core/routing.rs @@ -167,7 +167,7 @@ pub async fn create_routing_algorithm_under_profile( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile")?; + .get_required_value("Profile")?; core_utils::validate_profile_id_from_auth_layer(authentication_profile_id, &business_profile)?; @@ -269,7 +269,7 @@ pub async fn create_routing_algorithm_under_profile( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile")?; + .get_required_value("Profile")?; core_utils::validate_profile_id_from_auth_layer(authentication_profile_id, &business_profile)?; @@ -337,7 +337,7 @@ pub async fn link_routing_config_under_profile( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile")?; + .get_required_value("Profile")?; utils::when( routing_algorithm.0.algorithm_for != *transaction_type, @@ -360,8 +360,8 @@ pub async fn link_routing_config_under_profile( }) }, )?; - admin::BusinessProfileWrapper::new(business_profile) - .update_business_profile_and_invalidate_routing_config_for_active_algorithm_id_update( + admin::ProfileWrapper::new(business_profile) + .update_profile_and_invalidate_routing_config_for_active_algorithm_id_update( db, key_manager_state, &key_store, @@ -405,8 +405,8 @@ pub async fn link_routing_config( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile") - .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { + .get_required_value("Profile") + .change_context(errors::ApiErrorResponse::ProfileNotFound { id: routing_algorithm.profile_id.get_string_repr().to_owned(), })?; @@ -484,7 +484,7 @@ pub async fn link_routing_config( }, )?; routing_ref.update_algorithm_id(algorithm_id); - helpers::update_business_profile_active_algorithm_ref( + helpers::update_profile_active_algorithm_ref( db, key_manager_state, &key_store, @@ -525,7 +525,7 @@ pub async fn retrieve_routing_algorithm_from_algorithm_id( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile") + .get_required_value("Profile") .change_context(errors::ApiErrorResponse::ResourceIdNotFound)?; core_utils::validate_profile_id_from_auth_layer(authentication_profile_id, &business_profile)?; @@ -566,7 +566,7 @@ pub async fn retrieve_routing_algorithm_from_algorithm_id( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile") + .get_required_value("Profile") .change_context(errors::ApiErrorResponse::ResourceIdNotFound)?; core_utils::validate_profile_id_from_auth_layer(authentication_profile_id, &business_profile)?; @@ -599,7 +599,7 @@ pub async fn unlink_routing_config_under_profile( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile")?; + .get_required_value("Profile")?; let routing_algo_id = match transaction_type { enums::TransactionType::Payment => business_profile.routing_algorithm_id.clone(), @@ -615,8 +615,8 @@ pub async fn unlink_routing_config_under_profile( ) .await?; let response = record.0.foreign_into(); - admin::BusinessProfileWrapper::new(business_profile) - .update_business_profile_and_invalidate_routing_config_for_active_algorithm_id_update( + admin::ProfileWrapper::new(business_profile) + .update_profile_and_invalidate_routing_config_for_active_algorithm_id_update( db, key_manager_state, &key_store, @@ -701,7 +701,7 @@ pub async fn unlink_routing_config( .await .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; let response = record.foreign_into(); - helpers::update_business_profile_active_algorithm_ref( + helpers::update_profile_active_algorithm_ref( db, key_manager_state, &key_store, @@ -745,8 +745,8 @@ pub async fn update_default_fallback_routing( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile")?; - let profile_wrapper = admin::BusinessProfileWrapper::new(profile); + .get_required_value("Profile")?; + let profile_wrapper = admin::ProfileWrapper::new(profile); let default_list_of_connectors = profile_wrapper.get_default_fallback_list_of_connector_under_profile()?; @@ -873,9 +873,9 @@ pub async fn retrieve_default_fallback_algorithm_for_profile( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile")?; + .get_required_value("Profile")?; - let connectors_choice = admin::BusinessProfileWrapper::new(profile) + let connectors_choice = admin::ProfileWrapper::new(profile) .get_default_fallback_list_of_connector_under_profile()?; metrics::ROUTING_RETRIEVE_DEFAULT_CONFIG_SUCCESS_RESPONSE.add(&metrics::CONTEXT, 1, &[]); @@ -924,7 +924,7 @@ pub async fn retrieve_routing_config_under_profile( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile")?; + .get_required_value("Profile")?; let record = db .list_routing_algorithm_metadata_by_profile_id( @@ -970,17 +970,13 @@ pub async fn retrieve_linked_routing_config( ) .await? .map(|profile| vec![profile]) - .get_required_value("BusinessProfile") - .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { + .get_required_value("Profile") + .change_context(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })? } else { let business_profile = db - .list_business_profile_by_merchant_id( - key_manager_state, - &key_store, - merchant_account.get_id(), - ) + .list_profile_by_merchant_id(key_manager_state, &key_store, merchant_account.get_id()) .await .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound)?; core_utils::filter_objects_based_on_profile_id_list( @@ -1036,11 +1032,7 @@ pub async fn retrieve_default_routing_config_for_profiles( let key_manager_state = &(&state).into(); let all_profiles = db - .list_business_profile_by_merchant_id( - key_manager_state, - &key_store, - merchant_account.get_id(), - ) + .list_profile_by_merchant_id(key_manager_state, &key_store, merchant_account.get_id()) .await .to_not_found_response(errors::ApiErrorResponse::ResourceIdNotFound) .attach_printable("error retrieving all business profiles for merchant")?; @@ -1097,8 +1089,8 @@ pub async fn update_default_routing_config_for_profile( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile") - .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { + .get_required_value("Profile") + .change_context(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; let default_config = helpers::get_merchant_default_config( @@ -1176,7 +1168,7 @@ pub async fn toggle_success_based_routing( let db = state.store.as_ref(); let key_manager_state = &(&state).into(); - let business_profile: domain::BusinessProfile = core_utils::validate_and_get_business_profile( + let business_profile: domain::Profile = core_utils::validate_and_get_business_profile( db, key_manager_state, &key_store, @@ -1184,8 +1176,8 @@ pub async fn toggle_success_based_routing( merchant_account.get_id(), ) .await? - .get_required_value("BusinessProfile") - .change_context(errors::ApiErrorResponse::BusinessProfileNotFound { + .get_required_value("Profile") + .change_context(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs index f818dc05f5b6..f60a6589d5c2 100644 --- a/crates/router/src/core/routing/helpers.rs +++ b/crates/router/src/core/routing/helpers.rs @@ -182,11 +182,11 @@ pub async fn update_merchant_active_algorithm_ref( } #[cfg(feature = "v1")] -pub async fn update_business_profile_active_algorithm_ref( +pub async fn update_profile_active_algorithm_ref( db: &dyn StorageInterface, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, - current_business_profile: domain::BusinessProfile, + current_business_profile: domain::Profile, algorithm_id: routing_types::RoutingAlgorithmRef, transaction_type: &storage::enums::TransactionType, ) -> RouterResult<()> { @@ -214,12 +214,12 @@ pub async fn update_business_profile_active_algorithm_ref( storage::enums::TransactionType::Payout => (None, Some(ref_val)), }; - let business_profile_update = domain::BusinessProfileUpdate::RoutingAlgorithmUpdate { + let business_profile_update = domain::ProfileUpdate::RoutingAlgorithmUpdate { routing_algorithm, payout_routing_algorithm, }; - db.update_business_profile_by_profile_id( + db.update_profile_by_profile_id( key_manager_state, merchant_key_store, current_business_profile, @@ -241,17 +241,17 @@ pub async fn update_business_profile_active_dynamic_algorithm_ref( db: &dyn StorageInterface, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, - current_business_profile: domain::BusinessProfile, + current_business_profile: domain::Profile, dynamic_routing_algorithm: routing_types::DynamicRoutingAlgorithmRef, ) -> RouterResult<()> { let ref_val = dynamic_routing_algorithm .encode_to_value() .change_context(errors::ApiErrorResponse::InternalServerError) .attach_printable("Failed to convert dynamic routing ref to value")?; - let business_profile_update = domain::BusinessProfileUpdate::DynamicRoutingAlgorithmUpdate { + let business_profile_update = domain::ProfileUpdate::DynamicRoutingAlgorithmUpdate { dynamic_routing_algorithm: Some(ref_val), }; - db.update_business_profile_by_profile_id( + db.update_profile_by_profile_id( key_manager_state, merchant_key_store, current_business_profile, diff --git a/crates/router/src/core/user.rs b/crates/router/src/core/user.rs index 89f44aa15246..4c7974869702 100644 --- a/crates/router/src/core/user.rs +++ b/crates/router/src/core/user.rs @@ -2754,7 +2754,7 @@ pub async fn list_profiles_for_user_in_org_and_merchant_account( let profiles = match role_info.get_entity_type() { EntityType::Organization | EntityType::Merchant | EntityType::Internal => state .store - .list_business_profile_by_merchant_id( + .list_profile_by_merchant_id( key_manager_state, &key_store, &user_from_token.merchant_id, @@ -2934,7 +2934,7 @@ pub async fn switch_merchant_for_user_in_org( let profile_id = state .store - .list_business_profile_by_merchant_id( + .list_profile_by_merchant_id( key_manager_state, &merchant_key_store, &request.merchant_id, @@ -2987,11 +2987,7 @@ pub async fn switch_merchant_for_user_in_org( let profile_id = state .store - .list_business_profile_by_merchant_id( - key_manager_state, - &merchant_key_store, - &merchant_id, - ) + .list_profile_by_merchant_id(key_manager_state, &merchant_key_store, &merchant_id) .await .change_context(UserErrors::InternalServerError) .attach_printable("Failed to list business profiles by merchant_id")? @@ -3047,7 +3043,7 @@ pub async fn switch_merchant_for_user_in_org( state .store - .list_business_profile_by_merchant_id( + .list_profile_by_merchant_id( key_manager_state, &merchant_key_store, &request.merchant_id, diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs index 0e8b21f3a8a2..75630da14ceb 100644 --- a/crates/router/src/core/utils.rs +++ b/crates/router/src/core/utils.rs @@ -1195,7 +1195,7 @@ pub async fn validate_and_get_business_profile( merchant_key_store: &domain::MerchantKeyStore, profile_id: Option<&common_utils::id_type::ProfileId>, merchant_id: &common_utils::id_type::MerchantId, -) -> RouterResult> { +) -> RouterResult> { profile_id .async_map(|profile_id| async { db.find_business_profile_by_profile_id( @@ -1204,7 +1204,7 @@ pub async fn validate_and_get_business_profile( profile_id, ) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), }) }) @@ -1303,7 +1303,7 @@ pub async fn get_profile_id_from_business_details( merchant_account.get_id(), ) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_name, })?; @@ -1508,7 +1508,7 @@ impl GetProfileId for diesel_models::routing_algorithm::RoutingProfileMetadata { } } -impl GetProfileId for domain::BusinessProfile { +impl GetProfileId for domain::Profile { fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> { Some(self.get_id()) } diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs index 19d5591d1850..af531984a19e 100644 --- a/crates/router/src/core/webhooks/incoming.rs +++ b/crates/router/src/core/webhooks/incoming.rs @@ -353,7 +353,7 @@ async fn incoming_webhooks_core( .store .find_business_profile_by_profile_id(key_manager_state, &key_store, profile_id) .await - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; @@ -498,7 +498,7 @@ async fn payments_incoming_webhook_flow( state: SessionState, req_state: ReqState, merchant_account: domain::MerchantAccount, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, key_store: domain::MerchantKeyStore, webhook_details: api::IncomingWebhookDetails, source_verified: bool, @@ -636,7 +636,7 @@ async fn payments_incoming_webhook_flow( async fn payouts_incoming_webhook_flow( state: SessionState, merchant_account: domain::MerchantAccount, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, key_store: domain::MerchantKeyStore, webhook_details: api::IncomingWebhookDetails, event_type: webhooks::IncomingWebhookEvent, @@ -770,7 +770,7 @@ async fn payouts_incoming_webhook_flow( async fn refunds_incoming_webhook_flow( state: SessionState, merchant_account: domain::MerchantAccount, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, key_store: domain::MerchantKeyStore, webhook_details: api::IncomingWebhookDetails, connector_name: &str, @@ -914,7 +914,7 @@ async fn get_or_update_dispute_object( organization_id: &common_utils::id_type::OrganizationId, payment_attempt: &hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt, event_type: webhooks::IncomingWebhookEvent, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, connector_name: &str, ) -> CustomResult { let db = &*state.store; @@ -995,7 +995,7 @@ async fn external_authentication_incoming_webhook_flow( request_details: &IncomingWebhookRequestDetails<'_>, connector: &ConnectorEnum, object_ref_id: api::ObjectReferenceId, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, merchant_connector_account: domain::MerchantConnectorAccount, ) -> CustomResult { if source_verified { @@ -1161,7 +1161,7 @@ async fn external_authentication_incoming_webhook_flow( async fn mandates_incoming_webhook_flow( state: SessionState, merchant_account: domain::MerchantAccount, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, key_store: domain::MerchantKeyStore, webhook_details: api::IncomingWebhookDetails, source_verified: bool, @@ -1254,7 +1254,7 @@ async fn frm_incoming_webhook_flow( source_verified: bool, event_type: webhooks::IncomingWebhookEvent, object_ref_id: api::ObjectReferenceId, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, ) -> CustomResult { if source_verified { let payment_attempt = @@ -1360,7 +1360,7 @@ async fn frm_incoming_webhook_flow( async fn disputes_incoming_webhook_flow( state: SessionState, merchant_account: domain::MerchantAccount, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, key_store: domain::MerchantKeyStore, webhook_details: api::IncomingWebhookDetails, source_verified: bool, @@ -1433,7 +1433,7 @@ async fn bank_transfer_webhook_flow( state: SessionState, req_state: ReqState, merchant_account: domain::MerchantAccount, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, key_store: domain::MerchantKeyStore, webhook_details: api::IncomingWebhookDetails, source_verified: bool, @@ -1695,6 +1695,7 @@ async fn fetch_optional_mca_and_connector( .attach_printable( "error while fetching merchant_connector_account from connector_id", )?; + #[cfg(feature = "v2")] let mca: domain::MerchantConnectorAccount = { let _ = merchant_account; diff --git a/crates/router/src/core/webhooks/outgoing.rs b/crates/router/src/core/webhooks/outgoing.rs index 7b6f703f6f74..aa2aae928c8c 100644 --- a/crates/router/src/core/webhooks/outgoing.rs +++ b/crates/router/src/core/webhooks/outgoing.rs @@ -52,7 +52,7 @@ const OUTGOING_WEBHOOK_TIMEOUT_SECS: u64 = 5; pub(crate) async fn create_event_and_trigger_outgoing_webhook( state: SessionState, merchant_account: domain::MerchantAccount, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, merchant_key_store: &domain::MerchantKeyStore, event_type: enums::EventType, event_class: enums::EventClass, @@ -196,7 +196,7 @@ pub(crate) async fn create_event_and_trigger_outgoing_webhook( #[instrument(skip_all)] pub(crate) async fn trigger_webhook_and_raise_event( state: SessionState, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, merchant_key_store: &domain::MerchantKeyStore, event: domain::Event, request_content: OutgoingWebhookRequestContent, @@ -236,7 +236,7 @@ pub(crate) async fn trigger_webhook_and_raise_event( async fn trigger_webhook_to_merchant( state: SessionState, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, merchant_key_store: &domain::MerchantKeyStore, event: domain::Event, request_content: OutgoingWebhookRequestContent, @@ -517,7 +517,7 @@ async fn raise_webhooks_analytics_event( pub(crate) async fn add_outgoing_webhook_retry_task_to_process_tracker( db: &dyn StorageInterface, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, event: &domain::Event, ) -> CustomResult { let schedule_time = outgoing_webhook_retry::get_webhook_delivery_retry_schedule_time( @@ -581,7 +581,7 @@ pub(crate) async fn add_outgoing_webhook_retry_task_to_process_tracker( } fn get_webhook_url_from_business_profile( - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> CustomResult { let webhook_details = business_profile .webhook_details @@ -599,12 +599,12 @@ fn get_webhook_url_from_business_profile( pub(crate) fn get_outgoing_webhook_request( merchant_account: &domain::MerchantAccount, outgoing_webhook: api::OutgoingWebhook, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> CustomResult { #[inline] fn get_outgoing_webhook_request_inner( outgoing_webhook: api::OutgoingWebhook, - business_profile: &domain::BusinessProfile, + business_profile: &domain::Profile, ) -> CustomResult { let mut headers = vec![( reqwest::header::CONTENT_TYPE.to_string(), diff --git a/crates/router/src/core/webhooks/webhook_events.rs b/crates/router/src/core/webhooks/webhook_events.rs index aa2dad3674ba..34a7c69d91a0 100644 --- a/crates/router/src/core/webhooks/webhook_events.rs +++ b/crates/router/src/core/webhooks/webhook_events.rs @@ -13,9 +13,9 @@ use crate::{ const INITIAL_DELIVERY_ATTEMPTS_LIST_MAX_LIMIT: i64 = 100; #[derive(Debug)] -enum MerchantAccountOrBusinessProfile { +enum MerchantAccountOrProfile { MerchantAccount(domain::MerchantAccount), - BusinessProfile(domain::BusinessProfile), + Profile(domain::Profile), } #[instrument(skip(state))] @@ -36,14 +36,14 @@ pub async fn list_initial_delivery_attempts( let events = match constraints { api_models::webhook_events::EventListConstraintsInternal::ObjectIdFilter { object_id } => { match account { - MerchantAccountOrBusinessProfile::MerchantAccount(merchant_account) => store + MerchantAccountOrProfile::MerchantAccount(merchant_account) => store .list_initial_events_by_merchant_id_primary_object_id(key_manager_state, merchant_account.get_id(), &object_id, &key_store, ) .await, - MerchantAccountOrBusinessProfile::BusinessProfile(business_profile) => store + MerchantAccountOrProfile::Profile(business_profile) => store .list_initial_events_by_profile_id_primary_object_id(key_manager_state, business_profile.get_id(), &object_id, @@ -73,7 +73,7 @@ pub async fn list_initial_delivery_attempts( }; match account { - MerchantAccountOrBusinessProfile::MerchantAccount(merchant_account) => store + MerchantAccountOrProfile::MerchantAccount(merchant_account) => store .list_initial_events_by_merchant_id_constraints(key_manager_state, merchant_account.get_id(), created_after, @@ -83,7 +83,7 @@ pub async fn list_initial_delivery_attempts( &key_store, ) .await, - MerchantAccountOrBusinessProfile::BusinessProfile(business_profile) => store + MerchantAccountOrProfile::Profile(business_profile) => store .list_initial_events_by_profile_id_constraints(key_manager_state, business_profile.get_id(), created_after, @@ -266,7 +266,7 @@ async fn get_account_and_key_store( state: SessionState, merchant_id: common_utils::id_type::MerchantId, profile_id: Option, -) -> errors::RouterResult<(MerchantAccountOrBusinessProfile, domain::MerchantKeyStore)> { +) -> errors::RouterResult<(MerchantAccountOrProfile, domain::MerchantKeyStore)> { let store = state.store.as_ref(); let key_manager_state = &(&state).into(); let merchant_key_store = store @@ -297,12 +297,12 @@ async fn get_account_and_key_store( different than the merchant_id specified (`{merchant_id:?}`)." ) }) - .to_not_found_response(errors::ApiErrorResponse::BusinessProfileNotFound { + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { id: profile_id.get_string_repr().to_owned(), })?; Ok(( - MerchantAccountOrBusinessProfile::BusinessProfile(business_profile), + MerchantAccountOrProfile::Profile(business_profile), merchant_key_store, )) } @@ -318,7 +318,7 @@ async fn get_account_and_key_store( .to_not_found_response(errors::ApiErrorResponse::MerchantAccountNotFound)?; Ok(( - MerchantAccountOrBusinessProfile::MerchantAccount(merchant_account), + MerchantAccountOrProfile::MerchantAccount(merchant_account), merchant_key_store, )) } diff --git a/crates/router/src/db.rs b/crates/router/src/db.rs index a789af1aa2ff..81319ae4c0be 100644 --- a/crates/router/src/db.rs +++ b/crates/router/src/db.rs @@ -118,7 +118,7 @@ pub trait StorageInterface: + payment_link::PaymentLinkInterface + RedisConnInterface + RequestIdStore - + business_profile::BusinessProfileInterface + + business_profile::ProfileInterface + OrganizationInterface + routing_algorithm::RoutingAlgorithmInterface + gsm::GsmInterface diff --git a/crates/router/src/db/business_profile.rs b/crates/router/src/db/business_profile.rs index d2555f40c4f7..61abb0d6feee 100644 --- a/crates/router/src/db/business_profile.rs +++ b/crates/router/src/db/business_profile.rs @@ -17,24 +17,23 @@ use crate::{ }; #[async_trait::async_trait] -pub trait BusinessProfileInterface +pub trait ProfileInterface where - domain::BusinessProfile: - Conversion, + domain::Profile: Conversion, { async fn insert_business_profile( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, - business_profile: domain::BusinessProfile, - ) -> CustomResult; + business_profile: domain::Profile, + ) -> CustomResult; async fn find_business_profile_by_profile_id( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, profile_id: &common_utils::id_type::ProfileId, - ) -> CustomResult; + ) -> CustomResult; async fn find_business_profile_by_merchant_id_profile_id( &self, @@ -42,7 +41,7 @@ where merchant_key_store: &domain::MerchantKeyStore, merchant_id: &common_utils::id_type::MerchantId, profile_id: &common_utils::id_type::ProfileId, - ) -> CustomResult; + ) -> CustomResult; async fn find_business_profile_by_profile_name_merchant_id( &self, @@ -50,39 +49,39 @@ where merchant_key_store: &domain::MerchantKeyStore, profile_name: &str, merchant_id: &common_utils::id_type::MerchantId, - ) -> CustomResult; + ) -> CustomResult; - async fn update_business_profile_by_profile_id( + async fn update_profile_by_profile_id( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, - current_state: domain::BusinessProfile, - business_profile_update: domain::BusinessProfileUpdate, - ) -> CustomResult; + current_state: domain::Profile, + profile_update: domain::ProfileUpdate, + ) -> CustomResult; - async fn delete_business_profile_by_profile_id_merchant_id( + async fn delete_profile_by_profile_id_merchant_id( &self, profile_id: &common_utils::id_type::ProfileId, merchant_id: &common_utils::id_type::MerchantId, ) -> CustomResult; - async fn list_business_profile_by_merchant_id( + async fn list_profile_by_merchant_id( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, merchant_id: &common_utils::id_type::MerchantId, - ) -> CustomResult, errors::StorageError>; + ) -> CustomResult, errors::StorageError>; } #[async_trait::async_trait] -impl BusinessProfileInterface for Store { +impl ProfileInterface for Store { #[instrument(skip_all)] async fn insert_business_profile( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, - business_profile: domain::BusinessProfile, - ) -> CustomResult { + business_profile: domain::Profile, + ) -> CustomResult { let conn = connection::pg_connection_write(self).await?; business_profile .construct_new() @@ -106,9 +105,9 @@ impl BusinessProfileInterface for Store { key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, profile_id: &common_utils::id_type::ProfileId, - ) -> CustomResult { + ) -> CustomResult { let conn = connection::pg_connection_read(self).await?; - storage::BusinessProfile::find_by_profile_id(&conn, profile_id) + storage::Profile::find_by_profile_id(&conn, profile_id) .await .map_err(|error| report!(errors::StorageError::from(error)))? .convert( @@ -126,9 +125,9 @@ impl BusinessProfileInterface for Store { merchant_key_store: &domain::MerchantKeyStore, merchant_id: &common_utils::id_type::MerchantId, profile_id: &common_utils::id_type::ProfileId, - ) -> CustomResult { + ) -> CustomResult { let conn = connection::pg_connection_read(self).await?; - storage::BusinessProfile::find_by_merchant_id_profile_id(&conn, merchant_id, profile_id) + storage::Profile::find_by_merchant_id_profile_id(&conn, merchant_id, profile_id) .await .map_err(|error| report!(errors::StorageError::from(error)))? .convert( @@ -147,9 +146,9 @@ impl BusinessProfileInterface for Store { merchant_key_store: &domain::MerchantKeyStore, profile_name: &str, merchant_id: &common_utils::id_type::MerchantId, - ) -> CustomResult { + ) -> CustomResult { let conn = connection::pg_connection_read(self).await?; - storage::BusinessProfile::find_by_profile_name_merchant_id(&conn, profile_name, merchant_id) + storage::Profile::find_by_profile_name_merchant_id(&conn, profile_name, merchant_id) .await .map_err(|error| report!(errors::StorageError::from(error)))? .convert( @@ -162,21 +161,18 @@ impl BusinessProfileInterface for Store { } #[instrument(skip_all)] - async fn update_business_profile_by_profile_id( + async fn update_profile_by_profile_id( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, - current_state: domain::BusinessProfile, - business_profile_update: domain::BusinessProfileUpdate, - ) -> CustomResult { + current_state: domain::Profile, + profile_update: domain::ProfileUpdate, + ) -> CustomResult { let conn = connection::pg_connection_write(self).await?; Conversion::convert(current_state) .await .change_context(errors::StorageError::EncryptionError)? - .update_by_profile_id( - &conn, - storage::BusinessProfileUpdateInternal::from(business_profile_update), - ) + .update_by_profile_id(&conn, storage::ProfileUpdateInternal::from(profile_update)) .await .map_err(|error| report!(errors::StorageError::from(error)))? .convert( @@ -189,26 +185,26 @@ impl BusinessProfileInterface for Store { } #[instrument(skip_all)] - async fn delete_business_profile_by_profile_id_merchant_id( + async fn delete_profile_by_profile_id_merchant_id( &self, profile_id: &common_utils::id_type::ProfileId, merchant_id: &common_utils::id_type::MerchantId, ) -> CustomResult { let conn = connection::pg_connection_write(self).await?; - storage::BusinessProfile::delete_by_profile_id_merchant_id(&conn, profile_id, merchant_id) + storage::Profile::delete_by_profile_id_merchant_id(&conn, profile_id, merchant_id) .await .map_err(|error| report!(errors::StorageError::from(error))) } #[instrument(skip_all)] - async fn list_business_profile_by_merchant_id( + async fn list_profile_by_merchant_id( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, merchant_id: &common_utils::id_type::MerchantId, - ) -> CustomResult, errors::StorageError> { + ) -> CustomResult, errors::StorageError> { let conn = connection::pg_connection_read(self).await?; - storage::BusinessProfile::list_business_profile_by_merchant_id(&conn, merchant_id) + storage::Profile::list_profile_by_merchant_id(&conn, merchant_id) .await .map_err(|error| report!(errors::StorageError::from(error))) .async_and_then(|business_profiles| async { @@ -232,13 +228,13 @@ impl BusinessProfileInterface for Store { } #[async_trait::async_trait] -impl BusinessProfileInterface for MockDb { +impl ProfileInterface for MockDb { async fn insert_business_profile( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, - business_profile: domain::BusinessProfile, - ) -> CustomResult { + business_profile: domain::Profile, + ) -> CustomResult { let stored_business_profile = Conversion::convert(business_profile) .await .change_context(errors::StorageError::EncryptionError)?; @@ -263,7 +259,7 @@ impl BusinessProfileInterface for MockDb { key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, profile_id: &common_utils::id_type::ProfileId, - ) -> CustomResult { + ) -> CustomResult { self.business_profiles .lock() .await @@ -296,7 +292,7 @@ impl BusinessProfileInterface for MockDb { merchant_key_store: &domain::MerchantKeyStore, merchant_id: &common_utils::id_type::MerchantId, profile_id: &common_utils::id_type::ProfileId, - ) -> CustomResult { + ) -> CustomResult { self.business_profiles .lock() .await @@ -326,13 +322,13 @@ impl BusinessProfileInterface for MockDb { ) } - async fn update_business_profile_by_profile_id( + async fn update_profile_by_profile_id( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, - current_state: domain::BusinessProfile, - business_profile_update: domain::BusinessProfileUpdate, - ) -> CustomResult { + current_state: domain::Profile, + profile_update: domain::ProfileUpdate, + ) -> CustomResult { let profile_id = current_state.get_id().to_owned(); self.business_profiles .lock() @@ -340,16 +336,15 @@ impl BusinessProfileInterface for MockDb { .iter_mut() .find(|business_profile| business_profile.get_id() == current_state.get_id()) .async_map(|business_profile| async { - let business_profile_updated = - storage::BusinessProfileUpdateInternal::from(business_profile_update) - .apply_changeset( - Conversion::convert(current_state) - .await - .change_context(errors::StorageError::EncryptionError)?, - ); - *business_profile = business_profile_updated.clone(); + let profile_updated = storage::ProfileUpdateInternal::from(profile_update) + .apply_changeset( + Conversion::convert(current_state) + .await + .change_context(errors::StorageError::EncryptionError)?, + ); + *business_profile = profile_updated.clone(); - business_profile_updated + profile_updated .convert( key_manager_state, merchant_key_store.key.get_inner(), @@ -368,7 +363,7 @@ impl BusinessProfileInterface for MockDb { ) } - async fn delete_business_profile_by_profile_id_merchant_id( + async fn delete_profile_by_profile_id_merchant_id( &self, profile_id: &common_utils::id_type::ProfileId, merchant_id: &common_utils::id_type::MerchantId, @@ -387,12 +382,12 @@ impl BusinessProfileInterface for MockDb { Ok(true) } - async fn list_business_profile_by_merchant_id( + async fn list_profile_by_merchant_id( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, merchant_id: &common_utils::id_type::MerchantId, - ) -> CustomResult, errors::StorageError> { + ) -> CustomResult, errors::StorageError> { let business_profiles = self .business_profiles .lock() @@ -425,7 +420,7 @@ impl BusinessProfileInterface for MockDb { merchant_key_store: &domain::MerchantKeyStore, profile_name: &str, merchant_id: &common_utils::id_type::MerchantId, - ) -> CustomResult { + ) -> CustomResult { self.business_profiles .lock() .await diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs index 9b51946c5c4e..ff7e8145c33b 100644 --- a/crates/router/src/db/kafka_store.rs +++ b/crates/router/src/db/kafka_store.rs @@ -50,7 +50,7 @@ use crate::{ api_keys::ApiKeyInterface, authentication::AuthenticationInterface, authorization::AuthorizationInterface, - business_profile::BusinessProfileInterface, + business_profile::ProfileInterface, capture::CaptureInterface, cards_info::CardsInfoInterface, configs::ConfigInterface, @@ -2625,13 +2625,13 @@ impl MerchantKeyStoreInterface for KafkaStore { } #[async_trait::async_trait] -impl BusinessProfileInterface for KafkaStore { +impl ProfileInterface for KafkaStore { async fn insert_business_profile( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, - business_profile: domain::BusinessProfile, - ) -> CustomResult { + business_profile: domain::Profile, + ) -> CustomResult { self.diesel_store .insert_business_profile(key_manager_state, merchant_key_store, business_profile) .await @@ -2642,7 +2642,7 @@ impl BusinessProfileInterface for KafkaStore { key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, profile_id: &id_type::ProfileId, - ) -> CustomResult { + ) -> CustomResult { self.diesel_store .find_business_profile_by_profile_id(key_manager_state, merchant_key_store, profile_id) .await @@ -2654,7 +2654,7 @@ impl BusinessProfileInterface for KafkaStore { merchant_key_store: &domain::MerchantKeyStore, merchant_id: &id_type::MerchantId, profile_id: &id_type::ProfileId, - ) -> CustomResult { + ) -> CustomResult { self.diesel_store .find_business_profile_by_merchant_id_profile_id( key_manager_state, @@ -2665,15 +2665,15 @@ impl BusinessProfileInterface for KafkaStore { .await } - async fn update_business_profile_by_profile_id( + async fn update_profile_by_profile_id( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, - current_state: domain::BusinessProfile, - business_profile_update: domain::BusinessProfileUpdate, - ) -> CustomResult { + current_state: domain::Profile, + business_profile_update: domain::ProfileUpdate, + ) -> CustomResult { self.diesel_store - .update_business_profile_by_profile_id( + .update_profile_by_profile_id( key_manager_state, merchant_key_store, current_state, @@ -2682,28 +2682,24 @@ impl BusinessProfileInterface for KafkaStore { .await } - async fn delete_business_profile_by_profile_id_merchant_id( + async fn delete_profile_by_profile_id_merchant_id( &self, profile_id: &id_type::ProfileId, merchant_id: &id_type::MerchantId, ) -> CustomResult { self.diesel_store - .delete_business_profile_by_profile_id_merchant_id(profile_id, merchant_id) + .delete_profile_by_profile_id_merchant_id(profile_id, merchant_id) .await } - async fn list_business_profile_by_merchant_id( + async fn list_profile_by_merchant_id( &self, key_manager_state: &KeyManagerState, merchant_key_store: &domain::MerchantKeyStore, merchant_id: &id_type::MerchantId, - ) -> CustomResult, errors::StorageError> { + ) -> CustomResult, errors::StorageError> { self.diesel_store - .list_business_profile_by_merchant_id( - key_manager_state, - merchant_key_store, - merchant_id, - ) + .list_profile_by_merchant_id(key_manager_state, merchant_key_store, merchant_id) .await } @@ -2713,7 +2709,7 @@ impl BusinessProfileInterface for KafkaStore { merchant_key_store: &domain::MerchantKeyStore, profile_name: &str, merchant_id: &id_type::MerchantId, - ) -> CustomResult { + ) -> CustomResult { self.diesel_store .find_business_profile_by_profile_name_merchant_id( key_manager_state, diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs index caa968269374..b6ac439a5c4d 100644 --- a/crates/router/src/lib.rs +++ b/crates/router/src/lib.rs @@ -121,8 +121,8 @@ pub fn mk_app( // This is a more specific route as compared to `MerchantConnectorAccount` // so it is registered before `MerchantConnectorAccount`. server_app = server_app - .service(routes::BusinessProfileNew::server(state.clone())) - .service(routes::BusinessProfile::server(state.clone())) + .service(routes::ProfileNew::server(state.clone())) + .service(routes::Profile::server(state.clone())) } server_app = server_app .service(routes::Payments::server(state.clone())) diff --git a/crates/router/src/routes.rs b/crates/router/src/routes.rs index 482b9a1b9cc7..8baed5089e81 100644 --- a/crates/router/src/routes.rs +++ b/crates/router/src/routes.rs @@ -38,6 +38,8 @@ pub mod payouts; #[cfg(any(feature = "olap", feature = "oltp"))] pub mod pm_auth; pub mod poll; +#[cfg(feature = "olap")] +pub mod profiles; #[cfg(feature = "recon")] pub mod recon; #[cfg(feature = "v1")] @@ -64,10 +66,10 @@ pub use self::app::Forex; #[cfg(all(feature = "olap", feature = "recon", feature = "v1"))] pub use self::app::Recon; pub use self::app::{ - ApiKeys, AppState, ApplePayCertificatesMigration, BusinessProfile, BusinessProfileNew, Cache, - Cards, Configs, ConnectorOnboarding, Customers, Disputes, EphemeralKey, Files, Gsm, Health, - Mandates, MerchantAccount, MerchantConnectorAccount, PaymentLink, PaymentMethods, Payments, - Poll, Refunds, SessionState, User, Webhooks, + ApiKeys, AppState, ApplePayCertificatesMigration, Cache, Cards, Configs, ConnectorOnboarding, + Customers, Disputes, EphemeralKey, Files, Gsm, Health, Mandates, MerchantAccount, + MerchantConnectorAccount, PaymentLink, PaymentMethods, Payments, Poll, Profile, ProfileNew, + Refunds, SessionState, User, Webhooks, }; #[cfg(feature = "olap")] pub use self::app::{Blocklist, Organization, Routing, Verify, WebhookEvents}; diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rs index 8ba214f94b9a..14711bef6a0f 100644 --- a/crates/router/src/routes/admin.rs +++ b/crates/router/src/routes/admin.rs @@ -557,6 +557,7 @@ pub async fn connector_list_profile( ) .await } + /// Merchant Connector - Update /// /// To update an existing Merchant Connector. Helpful in enabling / disabling different payment methods and other settings for the connector etc. @@ -815,324 +816,6 @@ pub async fn merchant_account_toggle_all_kv( .await } -#[cfg(all(feature = "olap", feature = "v1"))] -#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileCreate))] -pub async fn business_profile_create( - state: web::Data, - req: HttpRequest, - json_payload: web::Json, - path: web::Path, -) -> HttpResponse { - let flow = Flow::BusinessProfileCreate; - let payload = json_payload.into_inner(); - let merchant_id = path.into_inner(); - - Box::pin(api::server_wrap( - flow, - state, - &req, - payload, - |state, auth_data, req, _| { - create_business_profile(state, req, auth_data.merchant_account, auth_data.key_store) - }, - auth::auth_type( - &auth::AdminApiAuthWithMerchantIdFromRoute(merchant_id.clone()), - &auth::JWTAuthMerchantFromRoute { - merchant_id, - required_permission: Permission::MerchantAccountWrite, - minimum_entity_level: EntityType::Merchant, - }, - req.headers(), - ), - api_locking::LockAction::NotApplicable, - )) - .await -} - -#[cfg(all(feature = "olap", feature = "v2"))] -#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileCreate))] -pub async fn business_profile_create( - state: web::Data, - req: HttpRequest, - json_payload: web::Json, -) -> HttpResponse { - let flow = Flow::BusinessProfileCreate; - let payload = json_payload.into_inner(); - - Box::pin(api::server_wrap( - flow, - state, - &req, - payload, - |state, auth_data, req, _| { - create_business_profile(state, req, auth_data.merchant_account, auth_data.key_store) - }, - auth::auth_type( - &auth::AdminApiAuthWithMerchantIdFromHeader, - &auth::JWTAuthMerchantFromHeader { - required_permission: Permission::MerchantAccountWrite, - minimum_entity_level: EntityType::Merchant, - }, - req.headers(), - ), - api_locking::LockAction::NotApplicable, - )) - .await -} - -#[cfg(feature = "v1")] -#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileRetrieve))] -pub async fn business_profile_retrieve( - state: web::Data, - req: HttpRequest, - path: web::Path<( - common_utils::id_type::MerchantId, - common_utils::id_type::ProfileId, - )>, -) -> HttpResponse { - let flow = Flow::BusinessProfileRetrieve; - let (merchant_id, profile_id) = path.into_inner(); - - Box::pin(api::server_wrap( - flow, - state, - &req, - profile_id, - |state, auth_data, profile_id, _| { - retrieve_business_profile(state, profile_id, auth_data.key_store) - }, - auth::auth_type( - &auth::AdminApiAuthWithMerchantIdFromRoute(merchant_id.clone()), - &auth::JWTAuthMerchantFromRoute { - merchant_id: merchant_id.clone(), - required_permission: Permission::MerchantAccountRead, - minimum_entity_level: EntityType::Profile, - }, - req.headers(), - ), - api_locking::LockAction::NotApplicable, - )) - .await -} - -#[cfg(feature = "v2")] -#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileRetrieve))] -pub async fn business_profile_retrieve( - state: web::Data, - req: HttpRequest, - path: web::Path, -) -> HttpResponse { - let flow = Flow::BusinessProfileRetrieve; - let profile_id = path.into_inner(); - - Box::pin(api::server_wrap( - flow, - state, - &req, - profile_id, - |state, auth_data, profile_id, _| { - retrieve_business_profile(state, profile_id, auth_data.key_store) - }, - auth::auth_type( - &auth::AdminApiAuthWithMerchantIdFromHeader, - &auth::JWTAuthMerchantFromHeader { - required_permission: Permission::MerchantAccountRead, - minimum_entity_level: EntityType::Merchant, - }, - req.headers(), - ), - api_locking::LockAction::NotApplicable, - )) - .await -} - -#[cfg(all(feature = "olap", feature = "v1"))] -#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileUpdate))] -pub async fn business_profile_update( - state: web::Data, - req: HttpRequest, - path: web::Path<( - common_utils::id_type::MerchantId, - common_utils::id_type::ProfileId, - )>, - json_payload: web::Json, -) -> HttpResponse { - let flow = Flow::BusinessProfileUpdate; - let (merchant_id, profile_id) = path.into_inner(); - - Box::pin(api::server_wrap( - flow, - state, - &req, - json_payload.into_inner(), - |state, auth_data, req, _| { - update_business_profile(state, &profile_id, auth_data.key_store, req) - }, - auth::auth_type( - &auth::AdminApiAuthWithMerchantIdFromRoute(merchant_id.clone()), - &auth::JWTAuthMerchantAndProfileFromRoute { - merchant_id: merchant_id.clone(), - profile_id: profile_id.clone(), - required_permission: Permission::MerchantAccountWrite, - minimum_entity_level: EntityType::Profile, - }, - req.headers(), - ), - api_locking::LockAction::NotApplicable, - )) - .await -} - -#[cfg(feature = "v2")] -#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileUpdate))] -pub async fn business_profile_update( - state: web::Data, - req: HttpRequest, - path: web::Path, - json_payload: web::Json, -) -> HttpResponse { - let flow = Flow::BusinessProfileUpdate; - let profile_id = path.into_inner(); - - Box::pin(api::server_wrap( - flow, - state, - &req, - json_payload.into_inner(), - |state, auth_data, req, _| { - update_business_profile(state, &profile_id, auth_data.key_store, req) - }, - auth::auth_type( - &auth::AdminApiAuthWithMerchantIdFromHeader, - &auth::JWTAuthMerchantFromHeader { - required_permission: Permission::MerchantAccountWrite, - minimum_entity_level: EntityType::Merchant, - }, - req.headers(), - ), - api_locking::LockAction::NotApplicable, - )) - .await -} - -#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileDelete))] -pub async fn business_profile_delete( - state: web::Data, - req: HttpRequest, - path: web::Path<( - common_utils::id_type::MerchantId, - common_utils::id_type::ProfileId, - )>, -) -> HttpResponse { - let flow = Flow::BusinessProfileDelete; - let (merchant_id, profile_id) = path.into_inner(); - - api::server_wrap( - flow, - state, - &req, - profile_id, - |state, _, profile_id, _| delete_business_profile(state, profile_id, &merchant_id), - &auth::AdminApiAuth, - api_locking::LockAction::NotApplicable, - ) - .await -} -#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileList))] -pub async fn business_profiles_list( - state: web::Data, - req: HttpRequest, - path: web::Path, -) -> HttpResponse { - let flow = Flow::BusinessProfileList; - let merchant_id = path.into_inner(); - - Box::pin(api::server_wrap( - flow, - state, - &req, - merchant_id.clone(), - |state, _auth, merchant_id, _| list_business_profile(state, merchant_id, None), - auth::auth_type( - &auth::AdminApiAuthWithMerchantIdFromHeader, - &auth::JWTAuthMerchantFromRoute { - merchant_id, - required_permission: Permission::MerchantAccountRead, - minimum_entity_level: EntityType::Merchant, - }, - req.headers(), - ), - api_locking::LockAction::NotApplicable, - )) - .await -} - -#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileList))] -pub async fn business_profiles_list_at_profile_level( - state: web::Data, - req: HttpRequest, - path: web::Path, -) -> HttpResponse { - let flow = Flow::BusinessProfileList; - let merchant_id = path.into_inner(); - - Box::pin(api::server_wrap( - flow, - state, - &req, - merchant_id.clone(), - |state, auth, merchant_id, _| { - list_business_profile( - state, - merchant_id, - auth.profile_id.map(|profile_id| vec![profile_id]), - ) - }, - auth::auth_type( - &auth::AdminApiAuthWithMerchantIdFromHeader, - &auth::JWTAuthMerchantFromRoute { - merchant_id, - required_permission: Permission::MerchantAccountRead, - minimum_entity_level: EntityType::Profile, - }, - req.headers(), - ), - api_locking::LockAction::NotApplicable, - )) - .await -} - -#[instrument(skip_all, fields(flow = ?Flow::ToggleConnectorAgnosticMit))] -pub async fn toggle_connector_agnostic_mit( - state: web::Data, - req: HttpRequest, - path: web::Path<( - common_utils::id_type::MerchantId, - common_utils::id_type::ProfileId, - )>, - json_payload: web::Json, -) -> HttpResponse { - let flow = Flow::ToggleConnectorAgnosticMit; - let (merchant_id, profile_id) = path.into_inner(); - - Box::pin(api::server_wrap( - flow, - state, - &req, - json_payload.into_inner(), - |state, _, req, _| connector_agnostic_mit_toggle(state, &merchant_id, &profile_id, req), - auth::auth_type( - &auth::HeaderAuth(auth::ApiKeyAuth), - &auth::JWTAuth { - permission: Permission::RoutingWrite, - minimum_entity_level: EntityType::Merchant, - }, - req.headers(), - ), - api_locking::LockAction::NotApplicable, - )) - .await -} /// Merchant Account - KV Status /// /// Toggle KV mode for the Merchant Account @@ -1178,28 +861,3 @@ pub async fn merchant_account_transfer_keys( )) .await } - -#[instrument(skip_all, fields(flow = ?Flow::ToggleExtendedCardInfo))] -pub async fn toggle_extended_card_info( - state: web::Data, - req: HttpRequest, - path: web::Path<( - common_utils::id_type::MerchantId, - common_utils::id_type::ProfileId, - )>, - json_payload: web::Json, -) -> HttpResponse { - let flow = Flow::ToggleExtendedCardInfo; - let (merchant_id, profile_id) = path.into_inner(); - - Box::pin(api::server_wrap( - flow, - state, - &req, - json_payload.into_inner(), - |state, _, req, _| extended_card_info_toggle(state, &merchant_id, &profile_id, req), - &auth::AdminApiAuth, - api_locking::LockAction::NotApplicable, - )) - .await -} diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs index 75b32976e1df..01a48c564014 100644 --- a/crates/router/src/routes/app.rs +++ b/crates/router/src/routes/app.rs @@ -51,8 +51,8 @@ use super::verification::{apple_pay_merchant_registration, retrieve_apple_pay_ve #[cfg(all(feature = "oltp", feature = "v1"))] use super::webhooks::*; use super::{ - admin, api_keys, cache::*, connector_onboarding, disputes, files, gsm, health::*, user, - user_role, + admin, api_keys, cache::*, connector_onboarding, disputes, files, gsm, health::*, profiles, + user, user_role, }; #[cfg(feature = "v1")] use super::{apple_pay_certificates_migration, blocklist, payment_link, webhook_events}; @@ -1244,8 +1244,7 @@ impl MerchantAccount { .route(web::put().to(admin::update_merchant_account)), ) .service( - web::resource("/profiles") - .route(web::get().to(admin::business_profiles_list)), + web::resource("/profiles").route(web::get().to(profiles::profiles_list)), ), ) } @@ -1601,19 +1600,19 @@ impl PayoutLink { } } -pub struct BusinessProfile; +pub struct Profile; #[cfg(all(feature = "olap", feature = "v2"))] -impl BusinessProfile { +impl Profile { pub fn server(state: AppState) -> Scope { web::scope("/v2/profiles") .app_data(web::Data::new(state)) - .service(web::resource("").route(web::post().to(admin::business_profile_create))) + .service(web::resource("").route(web::post().to(profiles::profile_create))) .service( web::scope("/{profile_id}") .service( web::resource("") - .route(web::get().to(admin::business_profile_retrieve)) - .route(web::put().to(admin::business_profile_update)), + .route(web::get().to(profiles::profile_retrieve)) + .route(web::put().to(profiles::profile_update)), ) .service( web::resource("/connector_accounts") @@ -1622,7 +1621,7 @@ impl BusinessProfile { .service( web::resource("/fallback_routing") .route(web::get().to(routing::routing_retrieve_default_config)) - .route(web::post().to(routing::routing_update_default_config)), + .route(web::patch().to(routing::routing_update_default_config)), ) .service( web::resource("/activate_routing_algorithm").route(web::patch().to( @@ -1664,14 +1663,14 @@ impl BusinessProfile { } } #[cfg(all(feature = "olap", feature = "v1"))] -impl BusinessProfile { +impl Profile { pub fn server(state: AppState) -> Scope { web::scope("/account/{account_id}/business_profile") .app_data(web::Data::new(state)) .service( web::resource("") - .route(web::post().to(admin::business_profile_create)) - .route(web::get().to(admin::business_profiles_list)), + .route(web::post().to(profiles::profile_create)) + .route(web::get().to(profiles::profiles_list)), ) .service( web::scope("/{profile_id}") @@ -1694,32 +1693,31 @@ impl BusinessProfile { ) .service( web::resource("") - .route(web::get().to(admin::business_profile_retrieve)) - .route(web::post().to(admin::business_profile_update)) - .route(web::delete().to(admin::business_profile_delete)), + .route(web::get().to(profiles::profile_retrieve)) + .route(web::post().to(profiles::profile_update)) + .route(web::delete().to(profiles::profile_delete)), ) .service( web::resource("/toggle_extended_card_info") - .route(web::post().to(admin::toggle_extended_card_info)), + .route(web::post().to(profiles::toggle_extended_card_info)), ) .service( web::resource("/toggle_connector_agnostic_mit") - .route(web::post().to(admin::toggle_connector_agnostic_mit)), + .route(web::post().to(profiles::toggle_connector_agnostic_mit)), ), ) } } -pub struct BusinessProfileNew; +pub struct ProfileNew; #[cfg(feature = "olap")] -impl BusinessProfileNew { +impl ProfileNew { pub fn server(state: AppState) -> Scope { web::scope("/account/{account_id}/profile") .app_data(web::Data::new(state)) .service( - web::resource("") - .route(web::get().to(admin::business_profiles_list_at_profile_level)), + web::resource("").route(web::get().to(profiles::profiles_list_at_profile_level)), ) .service( web::resource("/connectors").route(web::get().to(admin::connector_list_profile)), diff --git a/crates/router/src/routes/lock_utils.rs b/crates/router/src/routes/lock_utils.rs index 774e6c75bb47..d6d3ec8a9525 100644 --- a/crates/router/src/routes/lock_utils.rs +++ b/crates/router/src/routes/lock_utils.rs @@ -21,7 +21,7 @@ pub enum ApiIdentifier { CardsInfo, Files, Cache, - Business, + Profile, Verification, ApiKeys, PaymentLink, @@ -184,13 +184,13 @@ impl From for ApiIdentifier { Flow::CacheInvalidate => Self::Cache, - Flow::BusinessProfileCreate - | Flow::BusinessProfileUpdate - | Flow::BusinessProfileRetrieve - | Flow::BusinessProfileDelete - | Flow::BusinessProfileList + Flow::ProfileCreate + | Flow::ProfileUpdate + | Flow::ProfileRetrieve + | Flow::ProfileDelete + | Flow::ProfileList | Flow::ToggleExtendedCardInfo - | Flow::ToggleConnectorAgnosticMit => Self::Business, + | Flow::ToggleConnectorAgnosticMit => Self::Profile, Flow::PaymentLinkRetrieve | Flow::PaymentLinkInitiate diff --git a/crates/router/src/routes/profiles.rs b/crates/router/src/routes/profiles.rs new file mode 100644 index 000000000000..e254447cdefc --- /dev/null +++ b/crates/router/src/routes/profiles.rs @@ -0,0 +1,381 @@ +use actix_web::{web, HttpRequest, HttpResponse}; +use common_enums::EntityType; +use router_env::{instrument, tracing, Flow}; + +use super::app::AppState; +use crate::{ + core::{admin::*, api_locking}, + services::{api, authentication as auth, authorization::permissions}, + types::api::admin, +}; + +#[cfg(all(feature = "olap", feature = "v1"))] +#[instrument(skip_all, fields(flow = ?Flow::ProfileCreate))] +pub async fn profile_create( + state: web::Data, + req: HttpRequest, + json_payload: web::Json, + path: web::Path, +) -> HttpResponse { + let flow = Flow::ProfileCreate; + let payload = json_payload.into_inner(); + let merchant_id = path.into_inner(); + + Box::pin(api::server_wrap( + flow, + state, + &req, + payload, + |state, auth_data, req, _| { + create_profile(state, req, auth_data.merchant_account, auth_data.key_store) + }, + auth::auth_type( + &auth::AdminApiAuthWithMerchantIdFromRoute(merchant_id.clone()), + &auth::JWTAuthMerchantFromRoute { + merchant_id, + required_permission: permissions::Permission::MerchantAccountWrite, + minimum_entity_level: EntityType::Merchant, + }, + req.headers(), + ), + api_locking::LockAction::NotApplicable, + )) + .await +} + +#[cfg(all(feature = "olap", feature = "v2"))] +#[instrument(skip_all, fields(flow = ?Flow::ProfileCreate))] +pub async fn profile_create( + state: web::Data, + req: HttpRequest, + json_payload: web::Json, +) -> HttpResponse { + let flow = Flow::ProfileCreate; + let payload = json_payload.into_inner(); + + Box::pin(api::server_wrap( + flow, + state, + &req, + payload, + |state, auth_data, req, _| { + create_profile(state, req, auth_data.merchant_account, auth_data.key_store) + }, + auth::auth_type( + &auth::AdminApiAuthWithMerchantIdFromHeader, + &auth::JWTAuthMerchantFromHeader { + required_permission: permissions::Permission::MerchantAccountWrite, + minimum_entity_level: EntityType::Merchant, + }, + req.headers(), + ), + api_locking::LockAction::NotApplicable, + )) + .await +} + +#[cfg(feature = "v1")] +#[instrument(skip_all, fields(flow = ?Flow::ProfileRetrieve))] +pub async fn profile_retrieve( + state: web::Data, + req: HttpRequest, + path: web::Path<( + common_utils::id_type::MerchantId, + common_utils::id_type::ProfileId, + )>, +) -> HttpResponse { + let flow = Flow::ProfileRetrieve; + let (merchant_id, profile_id) = path.into_inner(); + + Box::pin(api::server_wrap( + flow, + state, + &req, + profile_id, + |state, auth_data, profile_id, _| retrieve_profile(state, profile_id, auth_data.key_store), + auth::auth_type( + &auth::AdminApiAuthWithMerchantIdFromRoute(merchant_id.clone()), + &auth::JWTAuthMerchantFromRoute { + merchant_id: merchant_id.clone(), + required_permission: permissions::Permission::MerchantAccountRead, + minimum_entity_level: EntityType::Profile, + }, + req.headers(), + ), + api_locking::LockAction::NotApplicable, + )) + .await +} + +#[cfg(feature = "v2")] +#[instrument(skip_all, fields(flow = ?Flow::ProfileRetrieve))] +pub async fn profile_retrieve( + state: web::Data, + req: HttpRequest, + path: web::Path, +) -> HttpResponse { + let flow = Flow::ProfileRetrieve; + let profile_id = path.into_inner(); + + Box::pin(api::server_wrap( + flow, + state, + &req, + profile_id, + |state, auth_data, profile_id, _| retrieve_profile(state, profile_id, auth_data.key_store), + auth::auth_type( + &auth::AdminApiAuthWithMerchantIdFromHeader, + &auth::JWTAuthMerchantFromHeader { + required_permission: permissions::Permission::MerchantAccountRead, + minimum_entity_level: EntityType::Merchant, + }, + req.headers(), + ), + api_locking::LockAction::NotApplicable, + )) + .await +} + +#[cfg(all(feature = "olap", feature = "v1"))] +#[instrument(skip_all, fields(flow = ?Flow::ProfileUpdate))] +pub async fn profile_update( + state: web::Data, + req: HttpRequest, + path: web::Path<( + common_utils::id_type::MerchantId, + common_utils::id_type::ProfileId, + )>, + json_payload: web::Json, +) -> HttpResponse { + let flow = Flow::ProfileUpdate; + let (merchant_id, profile_id) = path.into_inner(); + + Box::pin(api::server_wrap( + flow, + state, + &req, + json_payload.into_inner(), + |state, auth_data, req, _| update_profile(state, &profile_id, auth_data.key_store, req), + auth::auth_type( + &auth::AdminApiAuthWithMerchantIdFromRoute(merchant_id.clone()), + &auth::JWTAuthMerchantAndProfileFromRoute { + merchant_id: merchant_id.clone(), + profile_id: profile_id.clone(), + required_permission: permissions::Permission::MerchantAccountWrite, + minimum_entity_level: EntityType::Profile, + }, + req.headers(), + ), + api_locking::LockAction::NotApplicable, + )) + .await +} + +#[cfg(feature = "v2")] +#[instrument(skip_all, fields(flow = ?Flow::ProfileUpdate))] +pub async fn profile_update( + state: web::Data, + req: HttpRequest, + path: web::Path, + json_payload: web::Json, +) -> HttpResponse { + let flow = Flow::ProfileUpdate; + let profile_id = path.into_inner(); + + Box::pin(api::server_wrap( + flow, + state, + &req, + json_payload.into_inner(), + |state, auth_data, req, _| update_profile(state, &profile_id, auth_data.key_store, req), + auth::auth_type( + &auth::AdminApiAuthWithMerchantIdFromHeader, + &auth::JWTAuthMerchantFromHeader { + required_permission: permissions::Permission::MerchantAccountWrite, + minimum_entity_level: EntityType::Merchant, + }, + req.headers(), + ), + api_locking::LockAction::NotApplicable, + )) + .await +} + +#[instrument(skip_all, fields(flow = ?Flow::ProfileDelete))] +pub async fn profile_delete( + state: web::Data, + req: HttpRequest, + path: web::Path<( + common_utils::id_type::MerchantId, + common_utils::id_type::ProfileId, + )>, +) -> HttpResponse { + let flow = Flow::ProfileDelete; + let (merchant_id, profile_id) = path.into_inner(); + + api::server_wrap( + flow, + state, + &req, + profile_id, + |state, _, profile_id, _| delete_profile(state, profile_id, &merchant_id), + &auth::AdminApiAuth, + api_locking::LockAction::NotApplicable, + ) + .await +} +#[instrument(skip_all, fields(flow = ?Flow::ProfileList))] +pub async fn profiles_list( + state: web::Data, + req: HttpRequest, + path: web::Path, +) -> HttpResponse { + let flow = Flow::ProfileList; + let merchant_id = path.into_inner(); + + Box::pin(api::server_wrap( + flow, + state, + &req, + merchant_id.clone(), + |state, _auth, merchant_id, _| list_profile(state, merchant_id, None), + auth::auth_type( + &auth::AdminApiAuthWithMerchantIdFromHeader, + &auth::JWTAuthMerchantFromRoute { + merchant_id, + required_permission: permissions::Permission::MerchantAccountRead, + minimum_entity_level: EntityType::Merchant, + }, + req.headers(), + ), + api_locking::LockAction::NotApplicable, + )) + .await +} + +#[instrument(skip_all, fields(flow = ?Flow::ProfileList))] +pub async fn profiles_list_at_profile_level( + state: web::Data, + req: HttpRequest, + path: web::Path, +) -> HttpResponse { + let flow = Flow::ProfileList; + let merchant_id = path.into_inner(); + + Box::pin(api::server_wrap( + flow, + state, + &req, + merchant_id.clone(), + |state, auth, merchant_id, _| { + list_profile( + state, + merchant_id, + auth.profile_id.map(|profile_id| vec![profile_id]), + ) + }, + auth::auth_type( + &auth::AdminApiAuthWithMerchantIdFromHeader, + &auth::JWTAuthMerchantFromRoute { + merchant_id, + required_permission: permissions::Permission::MerchantAccountRead, + minimum_entity_level: EntityType::Profile, + }, + req.headers(), + ), + api_locking::LockAction::NotApplicable, + )) + .await +} + +#[instrument(skip_all, fields(flow = ?Flow::ToggleConnectorAgnosticMit))] +pub async fn toggle_connector_agnostic_mit( + state: web::Data, + req: HttpRequest, + path: web::Path<( + common_utils::id_type::MerchantId, + common_utils::id_type::ProfileId, + )>, + json_payload: web::Json, +) -> HttpResponse { + let flow = Flow::ToggleConnectorAgnosticMit; + let (merchant_id, profile_id) = path.into_inner(); + + Box::pin(api::server_wrap( + flow, + state, + &req, + json_payload.into_inner(), + |state, _, req, _| connector_agnostic_mit_toggle(state, &merchant_id, &profile_id, req), + auth::auth_type( + &auth::HeaderAuth(auth::ApiKeyAuth), + &auth::JWTAuth { + permission: permissions::Permission::RoutingWrite, + minimum_entity_level: EntityType::Merchant, + }, + req.headers(), + ), + api_locking::LockAction::NotApplicable, + )) + .await +} + +#[instrument(skip_all, fields(flow = ?Flow::ToggleExtendedCardInfo))] +pub async fn toggle_extended_card_info( + state: web::Data, + req: HttpRequest, + path: web::Path<( + common_utils::id_type::MerchantId, + common_utils::id_type::ProfileId, + )>, + json_payload: web::Json, +) -> HttpResponse { + let flow = Flow::ToggleExtendedCardInfo; + let (merchant_id, profile_id) = path.into_inner(); + + Box::pin(api::server_wrap( + flow, + state, + &req, + json_payload.into_inner(), + |state, _, req, _| extended_card_info_toggle(state, &merchant_id, &profile_id, req), + &auth::AdminApiAuth, + api_locking::LockAction::NotApplicable, + )) + .await +} + +#[instrument(skip_all, fields(flow = ?Flow::MerchantConnectorsList))] +pub async fn payment_connector_list_profile( + state: web::Data, + req: HttpRequest, + path: web::Path, +) -> HttpResponse { + let flow = Flow::MerchantConnectorsList; + let merchant_id = path.into_inner(); + + api::server_wrap( + flow, + state, + &req, + merchant_id.to_owned(), + |state, auth, merchant_id, _| { + list_payment_connectors( + state, + merchant_id, + auth.profile_id.map(|profile_id| vec![profile_id]), + ) + }, + auth::auth_type( + &auth::AdminApiAuthWithMerchantIdFromHeader, + &auth::JWTAuthMerchantFromRoute { + merchant_id, + required_permission: permissions::Permission::MerchantConnectorAccountRead, + minimum_entity_level: EntityType::Profile, + }, + req.headers(), + ), + api_locking::LockAction::NotApplicable, + ) + .await +} diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs index bcc2046e24e5..3a56271b08a3 100644 --- a/crates/router/src/types.rs +++ b/crates/router/src/types.rs @@ -497,14 +497,14 @@ impl Default for PollConfig { #[derive(Clone, Debug)] pub struct RedirectPaymentFlowResponse { pub payments_response: api_models::payments::PaymentsResponse, - pub business_profile: domain::BusinessProfile, + pub business_profile: domain::Profile, } #[derive(Clone, Debug)] pub struct AuthenticatePaymentFlowResponse { pub payments_response: api_models::payments::PaymentsResponse, pub poll_config: PollConfig, - pub business_profile: domain::BusinessProfile, + pub business_profile: domain::Profile, } #[derive(Debug, Clone, Default, serde::Deserialize, serde::Serialize)] diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs index e30a6ccc1fd0..f50e5376db19 100644 --- a/crates/router/src/types/api/admin.rs +++ b/crates/router/src/types/api/admin.rs @@ -1,13 +1,15 @@ use std::collections::HashMap; +#[cfg(feature = "v2")] +pub use api_models::admin; pub use api_models::{ admin::{ - BusinessProfileCreate, BusinessProfileResponse, BusinessProfileUpdate, MerchantAccountCreate, MerchantAccountDeleteResponse, MerchantAccountResponse, MerchantAccountUpdate, MerchantConnectorCreate, MerchantConnectorDeleteResponse, MerchantConnectorDetails, MerchantConnectorDetailsWrap, MerchantConnectorId, MerchantConnectorResponse, MerchantDetails, MerchantId, PaymentMethodsEnabled, - ToggleAllKVRequest, ToggleAllKVResponse, ToggleKVRequest, ToggleKVResponse, WebhookDetails, + ProfileCreate, ProfileResponse, ProfileUpdate, ToggleAllKVRequest, ToggleAllKVResponse, + ToggleKVRequest, ToggleKVResponse, WebhookDetails, }, organization::{OrganizationId, OrganizationRequest, OrganizationResponse}, }; @@ -107,10 +109,10 @@ impl ForeignTryFrom for MerchantAccountResponse { } } #[cfg(feature = "v1")] -impl ForeignTryFrom for BusinessProfileResponse { +impl ForeignTryFrom for ProfileResponse { type Error = error_stack::Report; - fn foreign_try_from(item: domain::BusinessProfile) -> Result { + fn foreign_try_from(item: domain::Profile) -> Result { let profile_id = item.get_id().to_owned(); let outgoing_webhook_custom_http_headers = item .outgoing_webhook_custom_http_headers @@ -169,10 +171,10 @@ impl ForeignTryFrom for BusinessProfileResponse { } #[cfg(feature = "v2")] -impl ForeignTryFrom for BusinessProfileResponse { +impl ForeignTryFrom for admin::ProfileResponse { type Error = error_stack::Report; - fn foreign_try_from(item: domain::BusinessProfile) -> Result { + fn foreign_try_from(item: domain::Profile) -> Result { let id = item.get_id().to_owned(); let outgoing_webhook_custom_http_headers = item @@ -235,12 +237,12 @@ impl ForeignTryFrom for BusinessProfileResponse { } #[cfg(feature = "v1")] -pub async fn create_business_profile_from_merchant_account( +pub async fn create_profile_from_merchant_account( state: &SessionState, merchant_account: domain::MerchantAccount, - request: BusinessProfileCreate, + request: ProfileCreate, key_store: &MerchantKeyStore, -) -> Result> { +) -> Result> { use common_utils::ext_traits::AsyncExt; use crate::core; @@ -281,76 +283,73 @@ pub async fn create_business_profile_from_merchant_account( }) .transpose()?; - Ok(domain::BusinessProfile::from( - domain::BusinessProfileSetter { - profile_id, - merchant_id, - profile_name: request.profile_name.unwrap_or("default".to_string()), - created_at: current_time, - modified_at: current_time, - return_url: request - .return_url - .map(|return_url| return_url.to_string()) - .or(merchant_account.return_url), - enable_payment_response_hash: request - .enable_payment_response_hash - .unwrap_or(merchant_account.enable_payment_response_hash), - payment_response_hash_key: Some(payment_response_hash_key), - redirect_to_merchant_with_http_post: request - .redirect_to_merchant_with_http_post - .unwrap_or(merchant_account.redirect_to_merchant_with_http_post), - webhook_details: webhook_details.or(merchant_account.webhook_details), - metadata: request.metadata, - routing_algorithm: None, - intent_fulfillment_time: request - .intent_fulfillment_time - .map(i64::from) - .or(merchant_account.intent_fulfillment_time) - .or(Some(common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME)), - frm_routing_algorithm: request - .frm_routing_algorithm - .or(merchant_account.frm_routing_algorithm), - #[cfg(feature = "payouts")] - payout_routing_algorithm: request - .payout_routing_algorithm - .or(merchant_account.payout_routing_algorithm), - #[cfg(not(feature = "payouts"))] - payout_routing_algorithm: None, - is_recon_enabled: merchant_account.is_recon_enabled, - applepay_verified_domains: request.applepay_verified_domains, - payment_link_config, - session_expiry: request - .session_expiry - .map(i64::from) - .or(Some(common_utils::consts::DEFAULT_SESSION_EXPIRY)), - authentication_connector_details: request - .authentication_connector_details - .map(ForeignInto::foreign_into), - payout_link_config, - is_connector_agnostic_mit_enabled: request.is_connector_agnostic_mit_enabled, - is_extended_card_info_enabled: None, - extended_card_info_config: None, - use_billing_as_payment_method_billing: request - .use_billing_as_payment_method_billing - .or(Some(true)), - collect_shipping_details_from_wallet_connector: request - .collect_shipping_details_from_wallet_connector - .or(Some(false)), - collect_billing_details_from_wallet_connector: request - .collect_billing_details_from_wallet_connector - .or(Some(false)), - always_collect_billing_details_from_wallet_connector: request - .always_collect_billing_details_from_wallet_connector - .or(Some(false)), - always_collect_shipping_details_from_wallet_connector: request - .always_collect_shipping_details_from_wallet_connector - .or(Some(false)), - outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers - .map(Into::into), - tax_connector_id: request.tax_connector_id, - is_tax_connector_enabled: request.is_tax_connector_enabled, - dynamic_routing_algorithm: None, - is_network_tokenization_enabled: request.is_network_tokenization_enabled, - }, - )) + Ok(domain::Profile::from(domain::ProfileSetter { + profile_id, + merchant_id, + profile_name: request.profile_name.unwrap_or("default".to_string()), + created_at: current_time, + modified_at: current_time, + return_url: request + .return_url + .map(|return_url| return_url.to_string()) + .or(merchant_account.return_url), + enable_payment_response_hash: request + .enable_payment_response_hash + .unwrap_or(merchant_account.enable_payment_response_hash), + payment_response_hash_key: Some(payment_response_hash_key), + redirect_to_merchant_with_http_post: request + .redirect_to_merchant_with_http_post + .unwrap_or(merchant_account.redirect_to_merchant_with_http_post), + webhook_details: webhook_details.or(merchant_account.webhook_details), + metadata: request.metadata, + routing_algorithm: None, + intent_fulfillment_time: request + .intent_fulfillment_time + .map(i64::from) + .or(merchant_account.intent_fulfillment_time) + .or(Some(common_utils::consts::DEFAULT_INTENT_FULFILLMENT_TIME)), + frm_routing_algorithm: request + .frm_routing_algorithm + .or(merchant_account.frm_routing_algorithm), + #[cfg(feature = "payouts")] + payout_routing_algorithm: request + .payout_routing_algorithm + .or(merchant_account.payout_routing_algorithm), + #[cfg(not(feature = "payouts"))] + payout_routing_algorithm: None, + is_recon_enabled: merchant_account.is_recon_enabled, + applepay_verified_domains: request.applepay_verified_domains, + payment_link_config, + session_expiry: request + .session_expiry + .map(i64::from) + .or(Some(common_utils::consts::DEFAULT_SESSION_EXPIRY)), + authentication_connector_details: request + .authentication_connector_details + .map(ForeignInto::foreign_into), + payout_link_config, + is_connector_agnostic_mit_enabled: request.is_connector_agnostic_mit_enabled, + is_extended_card_info_enabled: None, + extended_card_info_config: None, + use_billing_as_payment_method_billing: request + .use_billing_as_payment_method_billing + .or(Some(true)), + collect_shipping_details_from_wallet_connector: request + .collect_shipping_details_from_wallet_connector + .or(Some(false)), + collect_billing_details_from_wallet_connector: request + .collect_billing_details_from_wallet_connector + .or(Some(false)), + always_collect_billing_details_from_wallet_connector: request + .always_collect_billing_details_from_wallet_connector + .or(Some(false)), + always_collect_shipping_details_from_wallet_connector: request + .always_collect_shipping_details_from_wallet_connector + .or(Some(false)), + outgoing_webhook_custom_http_headers: outgoing_webhook_custom_http_headers.map(Into::into), + tax_connector_id: request.tax_connector_id, + is_tax_connector_enabled: request.is_tax_connector_enabled, + dynamic_routing_algorithm: None, + is_network_tokenization_enabled: request.is_network_tokenization_enabled, + })) } diff --git a/crates/router/src/types/domain.rs b/crates/router/src/types/domain.rs index 37b8d2b80160..070e583caabe 100644 --- a/crates/router/src/types/domain.rs +++ b/crates/router/src/types/domain.rs @@ -8,7 +8,7 @@ mod merchant_account { mod business_profile { pub use hyperswitch_domain_models::business_profile::{ - BusinessProfile, BusinessProfileGeneralUpdate, BusinessProfileSetter, BusinessProfileUpdate, + Profile, ProfileGeneralUpdate, ProfileSetter, ProfileUpdate, }; } diff --git a/crates/router/src/types/payment_methods.rs b/crates/router/src/types/payment_methods.rs index 933b8e73da80..9b8d17db42c5 100644 --- a/crates/router/src/types/payment_methods.rs +++ b/crates/router/src/types/payment_methods.rs @@ -96,7 +96,7 @@ impl PaymentMethodClientSecret { #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] pub struct SavedPMLPaymentsInfo { pub payment_intent: storage::PaymentIntent, - pub business_profile: Option, + pub business_profile: Option, pub requires_cvv: bool, pub off_session_payment_flag: bool, pub is_connector_agnostic_mit_enabled: bool, diff --git a/crates/router/src/types/storage/business_profile.rs b/crates/router/src/types/storage/business_profile.rs index 2ab7597bcdaf..5396bbfb2c55 100644 --- a/crates/router/src/types/storage/business_profile.rs +++ b/crates/router/src/types/storage/business_profile.rs @@ -1,3 +1 @@ -pub use diesel_models::business_profile::{ - BusinessProfile, BusinessProfileNew, BusinessProfileUpdateInternal, -}; +pub use diesel_models::business_profile::{Profile, ProfileNew, ProfileUpdateInternal}; diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs index b603b86a72c4..edeb3f12fa75 100644 --- a/crates/router/src/utils.rs +++ b/crates/router/src/utils.rs @@ -1077,7 +1077,7 @@ pub fn check_if_pull_mechanism_for_external_3ds_enabled_from_connector_metadata( #[allow(clippy::too_many_arguments)] pub async fn trigger_payments_webhook( merchant_account: domain::MerchantAccount, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, key_store: &domain::MerchantKeyStore, payment_data: D, customer: Option, @@ -1096,7 +1096,7 @@ where #[allow(clippy::too_many_arguments)] pub async fn trigger_payments_webhook( merchant_account: domain::MerchantAccount, - business_profile: domain::BusinessProfile, + business_profile: domain::Profile, key_store: &domain::MerchantKeyStore, payment_data: D, customer: Option, diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs index f030df01fc06..1f7d75fba83d 100644 --- a/crates/router/src/utils/user/sample_data.rs +++ b/crates/router/src/utils/user/sample_data.rs @@ -90,7 +90,7 @@ pub async fn generate_sample_data( state .store - .list_business_profile_by_merchant_id(key_manager_state, &key_store, merchant_id) + .list_profile_by_merchant_id(key_manager_state, &key_store, merchant_id) .await .change_context(SampleDataError::InternalServerError) .attach_printable("Failed to get business profile")? diff --git a/crates/router/src/utils/user_role.rs b/crates/router/src/utils/user_role.rs index 3936ff60b720..b4008bd00083 100644 --- a/crates/router/src/utils/user_role.rs +++ b/crates/router/src/utils/user_role.rs @@ -382,7 +382,7 @@ pub async fn get_single_merchant_id_and_profile_id( state .store - .list_business_profile_by_merchant_id(&state.into(), &key_store, &merchant_id) + .list_profile_by_merchant_id(&state.into(), &key_store, &merchant_id) .await .change_context(UserErrors::InternalServerError)? .pop() diff --git a/crates/router/src/workflows/payment_sync.rs b/crates/router/src/workflows/payment_sync.rs index 3701418c8f17..f34d707b6c83 100644 --- a/crates/router/src/workflows/payment_sync.rs +++ b/crates/router/src/workflows/payment_sync.rs @@ -190,11 +190,9 @@ impl ProcessTrackerWorkflow for PaymentsSyncWorkflow { profile_id, ) .await - .to_not_found_response( - errors::ApiErrorResponse::BusinessProfileNotFound { - id: profile_id.get_string_repr().to_owned(), - }, - )?; + .to_not_found_response(errors::ApiErrorResponse::ProfileNotFound { + id: profile_id.get_string_repr().to_owned(), + })?; // Trigger the outgoing webhook to notify the merchant about failed payment let operation = operations::PaymentStatus; diff --git a/crates/router_env/src/logger/types.rs b/crates/router_env/src/logger/types.rs index 310f5ccecbf9..12e30f545494 100644 --- a/crates/router_env/src/logger/types.rs +++ b/crates/router_env/src/logger/types.rs @@ -306,16 +306,16 @@ pub enum Flow { PaymentLinkList, /// Payment Link Status PaymentLinkStatus, - /// Create a business profile - BusinessProfileCreate, - /// Update a business profile - BusinessProfileUpdate, - /// Retrieve a business profile - BusinessProfileRetrieve, - /// Delete a business profile - BusinessProfileDelete, - /// List all the business profiles for a merchant - BusinessProfileList, + /// Create a profile + ProfileCreate, + /// Update a profile + ProfileUpdate, + /// Retrieve a profile + ProfileRetrieve, + /// Delete a profile + ProfileDelete, + /// List all the profiles for a merchant + ProfileList, /// Different verification flows Verification, /// Rust locker migration diff --git a/crates/storage_impl/src/mock_db.rs b/crates/storage_impl/src/mock_db.rs index 3434bcb67ddb..b3358d898b24 100644 --- a/crates/storage_impl/src/mock_db.rs +++ b/crates/storage_impl/src/mock_db.rs @@ -43,7 +43,7 @@ pub struct MockDb { pub mandates: Arc>>, pub captures: Arc>>, pub merchant_key_store: Arc>>, - pub business_profiles: Arc>>, + pub business_profiles: Arc>>, pub reverse_lookups: Arc>>, pub payment_link: Arc>>, pub organizations: Arc>>,