Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(core): add support for account funded transactions (AFT) (#13870)

Vani Gupta2f483780662b
diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json
index 9d7129b99d..e8c9dd59e2 100644
--- a/api-reference/v1/openapi_spec_v1.json
+++ b/api-reference/v1/openapi_spec_v1.json
@@ -19903,6 +19903,13 @@
}
],
"nullable": true
+ },
+ "date_of_birth": {
+ "type": "string",
+ "format": "date",
+ "description": "The customer's date of birth",
+ "example": "1990-01-31",
+ "nullable": true
}
}
},
@@ -25633,6 +25640,305 @@
}
}
},
+ "MaskedRecipientAccount": {
+ "oneOf": [
+ {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MaskedRecipientBankAccount"
+ },
+ {
+ "type": "object",
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "bank_account"
+ ]
+ }
+ }
+ }
+ ]
+ },
+ {
+ "type": "object",
+ "description": "A partially masked card.",
+ "required": [
+ "card_number",
+ "type"
+ ],
+ "properties": {
+ "card_number": {
+ "type": "string",
+ "description": "The recipient's partially masked card number.",
+ "example": "411111******1111"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "card"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A partially masked wallet.",
+ "required": [
+ "wallet_id",
+ "type"
+ ],
+ "properties": {
+ "wallet_id": {
+ "type": "string",
+ "description": "The partially masked identifier of the recipient's wallet.",
+ "example": "wall****8891"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "wallet"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A masked email address.",
+ "required": [
+ "email",
+ "type"
+ ],
+ "properties": {
+ "email": {
+ "type": "string",
+ "description": "The email address that identifies the recipient's account.",
+ "example": "ja******@example.com"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "email"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A partially masked phone number.",
+ "required": [
+ "phone_number",
+ "type"
+ ],
+ "properties": {
+ "phone_number": {
+ "type": "string",
+ "description": "The phone number that identifies the recipient's account.",
+ "example": "9123****6789"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "phone"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A partially masked social network handle.",
+ "required": [
+ "social_network_id",
+ "type"
+ ],
+ "properties": {
+ "social_network_id": {
+ "type": "string",
+ "description": "The social network identifier of the recipient.",
+ "example": "jane****.doe"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "social_network"
+ ]
+ }
+ }
+ }
+ ],
+ "description": "A partially masked view of `RecipientAccount`, safe to return in API responses.",
+ "discriminator": {
+ "propertyName": "type"
+ }
+ },
+ "MaskedRecipientBankAccount": {
+ "oneOf": [
+ {
+ "type": "object",
+ "description": "A partially masked International Bank Account Number.",
+ "required": [
+ "iban",
+ "bank_account_type"
+ ],
+ "properties": {
+ "iban": {
+ "type": "string",
+ "description": "The recipient's partially masked IBAN.",
+ "example": "GB29N************46864"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "iban"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A partially masked account number and routing number.",
+ "required": [
+ "account_number",
+ "routing_number",
+ "bank_account_type"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "The recipient's partially masked bank account number.",
+ "example": "0001****6789"
+ },
+ "routing_number": {
+ "type": "string",
+ "description": "The partially masked routing number of the recipient's bank.",
+ "example": "110***000"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "routing_number"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A partially masked account number and BIC.",
+ "required": [
+ "account_number",
+ "bic",
+ "bank_account_type"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "The recipient's partially masked bank account number.",
+ "example": "0987****5432"
+ },
+ "bic": {
+ "type": "string",
+ "description": "The partially masked Bank Identification Code of the recipient's bank.",
+ "example": "HBU***4B"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "bic"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A partially masked bare bank account number.",
+ "required": [
+ "account_number",
+ "bank_account_type"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "The recipient's partially masked bank account number.",
+ "example": "0001****6789"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "account_number"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A truncated primary account number. This is already the industry standard truncated form,\nso it is returned as supplied.",
+ "required": [
+ "card_isin",
+ "last4",
+ "bank_account_type"
+ ],
+ "properties": {
+ "card_isin": {
+ "type": "string",
+ "description": "The first six digits of the recipient's PAN.",
+ "example": "411111"
+ },
+ "last4": {
+ "type": "string",
+ "description": "The last four digits of the recipient's PAN.",
+ "example": "1111"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "truncated_pan"
+ ]
+ }
+ }
+ }
+ ],
+ "description": "A partially masked view of `RecipientBankAccount`, safe to return in API responses.",
+ "discriminator": {
+ "propertyName": "bank_account_type"
+ }
+ },
+ "MaskedRecipientDetails": {
+ "type": "object",
+ "description": "A partially masked view of `RecipientDetails`, safe to return in API responses.",
+ "properties": {
+ "account": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MaskedRecipientAccount"
+ }
+ ],
+ "nullable": true
+ },
+ "phone_number": {
+ "type": "string",
+ "description": "The recipient's partially masked phone number.",
+ "example": "9123****6789",
+ "nullable": true
+ },
+ "tax_id": {
+ "type": "string",
+ "description": "The recipient's partially masked tax identifier.",
+ "example": "162.****41-42",
+ "nullable": true
+ },
+ "address": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/AddressDetails"
+ }
+ ],
+ "nullable": true
+ }
+ }
+ },
"MasterCardEligibilityCheckData": {
"type": "object",
"required": [
@@ -33656,6 +33962,20 @@
],
"nullable": true
},
+ "is_account_funded_transaction": {
+ "type": "boolean",
+ "description": "Indicates whether this payment is an account funded transaction.",
+ "example": true,
+ "nullable": true
+ },
+ "recipient_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RecipientDetails"
+ }
+ ],
+ "nullable": true
+ },
"tokenization": {
"allOf": [
{
@@ -34443,6 +34763,20 @@
],
"nullable": true
},
+ "is_account_funded_transaction": {
+ "type": "boolean",
+ "description": "Indicates whether this payment is an account funded transaction, where funds are pulled\nfrom a card account to fund another account rather than to pay for goods or services.",
+ "example": true,
+ "nullable": true
+ },
+ "recipient_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MaskedRecipientDetails"
+ }
+ ],
+ "nullable": true
+ },
"tokenization": {
"allOf": [
{
@@ -35465,6 +35799,20 @@
],
"nullable": true
},
+ "is_account_funded_transaction": {
+ "type": "boolean",
+ "description": "Indicates whether this payment is an account funded transaction.",
+ "example": true,
+ "nullable": true
+ },
+ "recipient_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RecipientDetails"
+ }
+ ],
+ "nullable": true
+ },
"tokenization": {
"allOf": [
{
@@ -36278,6 +36626,20 @@
],
"nullable": true
},
+ "is_account_funded_transaction": {
+ "type": "boolean",
+ "description": "Indicates whether this payment is an account funded transaction, where funds are pulled\nfrom a card account to fund another account rather than to pay for goods or services.",
+ "example": true,
+ "nullable": true
+ },
+ "recipient_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MaskedRecipientDetails"
+ }
+ ],
+ "nullable": true
+ },
"tokenization": {
"allOf": [
{
@@ -37011,6 +37373,20 @@
],
"nullable": true
},
+ "is_account_funded_transaction": {
+ "type": "boolean",
+ "description": "Indicates whether this payment is an account funded transaction.",
+ "example": true,
+ "nullable": true
+ },
+ "recipient_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RecipientDetails"
+ }
+ ],
+ "nullable": true
+ },
"tokenization": {
"allOf": [
{
@@ -41176,6 +41552,272 @@
}
}
},
+ "RecipientAccount": {
+ "oneOf": [
+ {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RecipientBankAccount"
+ },
+ {
+ "type": "object",
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "bank_account"
+ ]
+ }
+ }
+ }
+ ]
+ },
+ {
+ "type": "object",
+ "description": "Funds are credited to a card.",
+ "required": [
+ "card_number",
+ "type"
+ ],
+ "properties": {
+ "card_number": {
+ "type": "string",
+ "description": "The recipient's card number.",
+ "example": "4111111111111111"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "card"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "Funds are credited to a wallet held for the recipient.",
+ "required": [
+ "wallet_id",
+ "type"
+ ],
+ "properties": {
+ "wallet_id": {
+ "type": "string",
+ "description": "The identifier of the recipient's wallet.",
+ "example": "wallet_8891"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "wallet"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "The recipient's account is identified by their email address.",
+ "required": [
+ "email",
+ "type"
+ ],
+ "properties": {
+ "email": {
+ "type": "string",
+ "description": "The email address that identifies the recipient's account.",
+ "example": "[email protected]"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "email"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "The recipient's account is identified by their phone number.",
+ "required": [
+ "phone_number",
+ "type"
+ ],
+ "properties": {
+ "phone_number": {
+ "type": "string",
+ "description": "The phone number that identifies the recipient's account.",
+ "example": "9123456789"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "phone"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "The recipient's account is identified by a social network handle.",
+ "required": [
+ "social_network_id",
+ "type"
+ ],
+ "properties": {
+ "social_network_id": {
+ "type": "string",
+ "description": "The social network identifier of the recipient.",
+ "example": "jane.doe"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "social_network"
+ ]
+ }
+ }
+ }
+ ],
+ "description": "The account that receives the funds in an account funded transaction.",
+ "discriminator": {
+ "propertyName": "type"
+ }
+ },
+ "RecipientBankAccount": {
+ "oneOf": [
+ {
+ "type": "object",
+ "description": "An International Bank Account Number.",
+ "required": [
+ "iban",
+ "bank_account_type"
+ ],
+ "properties": {
+ "iban": {
+ "type": "string",
+ "description": "The recipient's IBAN.",
+ "example": "GB29NWBK70361331946864"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "iban"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A bank account number paired with the routing number of the holding bank.",
+ "required": [
+ "account_number",
+ "routing_number",
+ "bank_account_type"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "The recipient's bank account number.",
+ "example": "000123456789"
+ },
+ "routing_number": {
+ "type": "string",
+ "description": "The routing number of the recipient's bank.",
+ "example": "110000000"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "routing_number"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A bank account number paired with the BIC of the holding bank.",
+ "required": [
+ "account_number",
+ "bic",
+ "bank_account_type"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "The recipient's bank account number.",
+ "example": "09875432"
+ },
+ "bic": {
+ "type": "string",
+ "description": "The Bank Identification Code of the recipient's bank.",
+ "example": "HBUKGB4B"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "bic"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A bare bank account number, where the scheme does not require a bank identifier.",
+ "required": [
+ "account_number",
+ "bank_account_type"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "The recipient's bank account number.",
+ "example": "000123456789"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "account_number"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A truncated primary account number, made up of the first six and last four digits.",
+ "required": [
+ "card_isin",
+ "last4",
+ "bank_account_type"
+ ],
+ "properties": {
+ "card_isin": {
+ "type": "string",
+ "description": "The first six digits of the recipient's PAN.",
+ "example": "411111",
+ "maxLength": 6
+ },
+ "last4": {
+ "type": "string",
+ "description": "The last four digits of the recipient's PAN.",
+ "example": "1111",
+ "maxLength": 4
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "truncated_pan"
+ ]
+ }
+ }
+ }
+ ],
+ "discriminator": {
+ "propertyName": "bank_account_type"
+ }
+ },
"RecipientCardData": {
"type": "object",
"required": [
@@ -41203,6 +41845,42 @@
}
}
},
+ "RecipientDetails": {
+ "type": "object",
+ "description": "Details of the party receiving the funds in an account funded transaction.",
+ "properties": {
+ "account": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RecipientAccount"
+ }
+ ],
+ "nullable": true
+ },
+ "phone_number": {
+ "type": "string",
+ "description": "The recipient's phone number.",
+ "example": "9123456789",
+ "nullable": true,
+ "maxLength": 20
+ },
+ "tax_id": {
+ "type": "string",
+ "description": "The recipient's tax identifier. Some connectors require this for recipients in Brazil\n(CPF or CNPJ) and Argentina.",
+ "example": "162.152.541-42",
+ "nullable": true,
+ "maxLength": 25
+ },
+ "address": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/AddressDetails"
+ }
+ ],
+ "nullable": true
+ }
+ }
+ },
"RecipientPaymentMethodData": {
"oneOf": [
{
diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.json
index 4fdd42287f..c0e2f6aecb 100644
--- a/api-reference/v2/openapi_spec_v2.json
+++ b/api-reference/v2/openapi_spec_v2.json
@@ -13547,6 +13547,13 @@
}
],
"nullable": true
+ },
+ "date_of_birth": {
+ "type": "string",
+ "format": "date",
+ "description": "The customer's date of birth",
+ "example": "1990-01-31",
+ "nullable": true
}
}
},
@@ -18005,6 +18012,305 @@
}
}
},
+ "MaskedRecipientAccount": {
+ "oneOf": [
+ {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MaskedRecipientBankAccount"
+ },
+ {
+ "type": "object",
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "bank_account"
+ ]
+ }
+ }
+ }
+ ]
+ },
+ {
+ "type": "object",
+ "description": "A partially masked card.",
+ "required": [
+ "card_number",
+ "type"
+ ],
+ "properties": {
+ "card_number": {
+ "type": "string",
+ "description": "The recipient's partially masked card number.",
+ "example": "411111******1111"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "card"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A partially masked wallet.",
+ "required": [
+ "wallet_id",
+ "type"
+ ],
+ "properties": {
+ "wallet_id": {
+ "type": "string",
+ "description": "The partially masked identifier of the recipient's wallet.",
+ "example": "wall****8891"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "wallet"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A masked email address.",
+ "required": [
+ "email",
+ "type"
+ ],
+ "properties": {
+ "email": {
+ "type": "string",
+ "description": "The email address that identifies the recipient's account.",
+ "example": "ja******@example.com"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "email"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A partially masked phone number.",
+ "required": [
+ "phone_number",
+ "type"
+ ],
+ "properties": {
+ "phone_number": {
+ "type": "string",
+ "description": "The phone number that identifies the recipient's account.",
+ "example": "9123****6789"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "phone"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A partially masked social network handle.",
+ "required": [
+ "social_network_id",
+ "type"
+ ],
+ "properties": {
+ "social_network_id": {
+ "type": "string",
+ "description": "The social network identifier of the recipient.",
+ "example": "jane****.doe"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "social_network"
+ ]
+ }
+ }
+ }
+ ],
+ "description": "A partially masked view of `RecipientAccount`, safe to return in API responses.",
+ "discriminator": {
+ "propertyName": "type"
+ }
+ },
+ "MaskedRecipientBankAccount": {
+ "oneOf": [
+ {
+ "type": "object",
+ "description": "A partially masked International Bank Account Number.",
+ "required": [
+ "iban",
+ "bank_account_type"
+ ],
+ "properties": {
+ "iban": {
+ "type": "string",
+ "description": "The recipient's partially masked IBAN.",
+ "example": "GB29N************46864"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "iban"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A partially masked account number and routing number.",
+ "required": [
+ "account_number",
+ "routing_number",
+ "bank_account_type"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "The recipient's partially masked bank account number.",
+ "example": "0001****6789"
+ },
+ "routing_number": {
+ "type": "string",
+ "description": "The partially masked routing number of the recipient's bank.",
+ "example": "110***000"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "routing_number"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A partially masked account number and BIC.",
+ "required": [
+ "account_number",
+ "bic",
+ "bank_account_type"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "The recipient's partially masked bank account number.",
+ "example": "0987****5432"
+ },
+ "bic": {
+ "type": "string",
+ "description": "The partially masked Bank Identification Code of the recipient's bank.",
+ "example": "HBU***4B"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "bic"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A partially masked bare bank account number.",
+ "required": [
+ "account_number",
+ "bank_account_type"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "The recipient's partially masked bank account number.",
+ "example": "0001****6789"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "account_number"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A truncated primary account number. This is already the industry standard truncated form,\nso it is returned as supplied.",
+ "required": [
+ "card_isin",
+ "last4",
+ "bank_account_type"
+ ],
+ "properties": {
+ "card_isin": {
+ "type": "string",
+ "description": "The first six digits of the recipient's PAN.",
+ "example": "411111"
+ },
+ "last4": {
+ "type": "string",
+ "description": "The last four digits of the recipient's PAN.",
+ "example": "1111"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "truncated_pan"
+ ]
+ }
+ }
+ }
+ ],
+ "description": "A partially masked view of `RecipientBankAccount`, safe to return in API responses.",
+ "discriminator": {
+ "propertyName": "bank_account_type"
+ }
+ },
+ "MaskedRecipientDetails": {
+ "type": "object",
+ "description": "A partially masked view of `RecipientDetails`, safe to return in API responses.",
+ "properties": {
+ "account": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MaskedRecipientAccount"
+ }
+ ],
+ "nullable": true
+ },
+ "phone_number": {
+ "type": "string",
+ "description": "The recipient's partially masked phone number.",
+ "example": "9123****6789",
+ "nullable": true
+ },
+ "tax_id": {
+ "type": "string",
+ "description": "The recipient's partially masked tax identifier.",
+ "example": "162.****41-42",
+ "nullable": true
+ },
+ "address": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/AddressDetails"
+ }
+ ],
+ "nullable": true
+ }
+ }
+ },
"MbWayRedirection": {
"type": "object",
"required": [
@@ -24733,6 +25039,20 @@
"description": "Allow partial authorization for this payment",
"default": false,
"nullable": true
+ },
+ "is_account_funded_transaction": {
+ "type": "boolean",
+ "description": "Indicates whether this payment is an account funded transaction, where funds are pulled\nfrom a card account to fund another account rather than to pay for goods or services.",
+ "example": true,
+ "nullable": true
+ },
+ "recipient_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RecipientDetails"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -25102,6 +25422,20 @@
"description": "Allow partial authorization for this payment",
"default": false,
"nullable": true
+ },
+ "is_account_funded_transaction": {
+ "type": "boolean",
+ "description": "Indicates whether this payment is an account funded transaction.",
+ "example": true,
+ "nullable": true
+ },
+ "recipient_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/MaskedRecipientDetails"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -25582,6 +25916,20 @@
"description": "The webhook endpoint URL to receive payment status notifications",
"example": "https://merchant.example.com/webhooks/payment",
"nullable": true
+ },
+ "is_account_funded_transaction": {
+ "type": "boolean",
+ "description": "Indicates whether this payment is an account funded transaction, where funds are pulled\nfrom a card account to fund another account rather than to pay for goods or services.",
+ "example": true,
+ "nullable": true
+ },
+ "recipient_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RecipientDetails"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -26076,6 +26424,20 @@
"description": "Allow partial authorization for this payment",
"default": false,
"nullable": true
+ },
+ "is_account_funded_transaction": {
+ "type": "boolean",
+ "description": "Indicates whether this payment is an account funded transaction.",
+ "example": true,
+ "nullable": true
+ },
+ "recipient_details": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RecipientDetails"
+ }
+ ],
+ "nullable": true
}
},
"additionalProperties": false
@@ -29461,6 +29823,308 @@
}
}
},
+ "RecipientAccount": {
+ "oneOf": [
+ {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RecipientBankAccount"
+ },
+ {
+ "type": "object",
+ "required": [
+ "type"
+ ],
+ "properties": {
+ "type": {
+ "type": "string",
+ "enum": [
+ "bank_account"
+ ]
+ }
+ }
+ }
+ ]
+ },
+ {
+ "type": "object",
+ "description": "Funds are credited to a card.",
+ "required": [
+ "card_number",
+ "type"
+ ],
+ "properties": {
+ "card_number": {
+ "type": "string",
+ "description": "The recipient's card number.",
+ "example": "4111111111111111"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "card"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "Funds are credited to a wallet held for the recipient.",
+ "required": [
+ "wallet_id",
+ "type"
+ ],
+ "properties": {
+ "wallet_id": {
+ "type": "string",
+ "description": "The identifier of the recipient's wallet.",
+ "example": "wallet_8891"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "wallet"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "The recipient's account is identified by their email address.",
+ "required": [
+ "email",
+ "type"
+ ],
+ "properties": {
+ "email": {
+ "type": "string",
+ "description": "The email address that identifies the recipient's account.",
+ "example": "[email protected]"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "email"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "The recipient's account is identified by their phone number.",
+ "required": [
+ "phone_number",
+ "type"
+ ],
+ "properties": {
+ "phone_number": {
+ "type": "string",
+ "description": "The phone number that identifies the recipient's account.",
+ "example": "9123456789"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "phone"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "The recipient's account is identified by a social network handle.",
+ "required": [
+ "social_network_id",
+ "type"
+ ],
+ "properties": {
+ "social_network_id": {
+ "type": "string",
+ "description": "The social network identifier of the recipient.",
+ "example": "jane.doe"
+ },
+ "type": {
+ "type": "string",
+ "enum": [
+ "social_network"
+ ]
+ }
+ }
+ }
+ ],
+ "description": "The account that receives the funds in an account funded transaction.",
+ "discriminator": {
+ "propertyName": "type"
+ }
+ },
+ "RecipientBankAccount": {
+ "oneOf": [
+ {
+ "type": "object",
+ "description": "An International Bank Account Number.",
+ "required": [
+ "iban",
+ "bank_account_type"
+ ],
+ "properties": {
+ "iban": {
+ "type": "string",
+ "description": "The recipient's IBAN.",
+ "example": "GB29NWBK70361331946864"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "iban"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A bank account number paired with the routing number of the holding bank.",
+ "required": [
+ "account_number",
+ "routing_number",
+ "bank_account_type"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "The recipient's bank account number.",
+ "example": "000123456789"
+ },
+ "routing_number": {
+ "type": "string",
+ "description": "The routing number of the recipient's bank.",
+ "example": "110000000"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "routing_number"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A bank account number paired with the BIC of the holding bank.",
+ "required": [
+ "account_number",
+ "bic",
+ "bank_account_type"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "The recipient's bank account number.",
+ "example": "09875432"
+ },
+ "bic": {
+ "type": "string",
+ "description": "The Bank Identification Code of the recipient's bank.",
+ "example": "HBUKGB4B"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "bic"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A bare bank account number, where the scheme does not require a bank identifier.",
+ "required": [
+ "account_number",
+ "bank_account_type"
+ ],
+ "properties": {
+ "account_number": {
+ "type": "string",
+ "description": "The recipient's bank account number.",
+ "example": "000123456789"
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "account_number"
+ ]
+ }
+ }
+ },
+ {
+ "type": "object",
+ "description": "A truncated primary account number, made up of the first six and last four digits.",
+ "required": [
+ "card_isin",
+ "last4",
+ "bank_account_type"
+ ],
+ "properties": {
+ "card_isin": {
+ "type": "string",
+ "description": "The first six digits of the recipient's PAN.",
+ "example": "411111",
+ "maxLength": 6
+ },
+ "last4": {
+ "type": "string",
+ "description": "The last four digits of the recipient's PAN.",
+ "example": "1111",
+ "maxLength": 4
+ },
+ "bank_account_type": {
+ "type": "string",
+ "enum": [
+ "truncated_pan"
+ ]
+ }
+ }
+ }
+ ],
+ "discriminator": {
+ "propertyName": "bank_account_type"
+ }
+ },
+ "RecipientDetails": {
+ "type": "object",
+ "description": "Details of the party receiving the funds in an account funded transaction.",
+ "properties": {
+ "account": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/RecipientAccount"
+ }
+ ],
+ "nullable": true
+ },
+ "phone_number": {
+ "type": "string",
+ "description": "The recipient's phone number.",
+ "example": "9123456789",
+ "nullable": true,
+ "maxLength": 20
+ },
+ "tax_id": {
+ "type": "string",
+ "description": "The recipient's tax identifier. Some connectors require this for recipients in Brazil\n(CPF or CNPJ) and Argentina.",
+ "example": "162.152.541-42",
+ "nullable": true,
+ "maxLength": 25
+ },
+ "address": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/AddressDetails"
+ }
+ ],
+ "nullable": true
+ }
+ }
+ },
"ReconStatus": {
"type": "string",
"enum": [
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index be2255568e..699a97a532 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -5,6 +5,7 @@ use std::{
num::{NonZeroI64, NonZeroU8},
};
pub mod additional_info;
+pub mod recipient;
pub mod trait_impls;
use cards::{CardNumber, NetworkToken};
#[cfg(feature = "v2")]
@@ -32,6 +33,10 @@ use common_utils::{
};
use error_stack::ResultExt;
+pub use self::recipient::{
+ MaskedRecipientAccount, MaskedRecipientBankAccount, MaskedRecipientDetails, RecipientAccount,
+ RecipientBankAccount, RecipientDetails,
+};
use crate::customers::CustomerDocumentDetails;
#[cfg(feature = "v2")]
fn parse_comma_separated<'de, D, T>(v: D) -> Result<Option<Vec<T>>, D::Error>
@@ -164,6 +169,11 @@ pub struct CustomerDetails {
#[schema(value_type = Option<CustomerDocumentDetails>)]
#[smithy(value_type = "Option<CustomerDocumentDetails>")]
pub document_details: Option<CustomerDocumentDetails>,
+
+ /// The customer's date of birth
+ #[schema(value_type = Option<Date>, example = "1990-01-31")]
+ #[smithy(value_type = "Option<String>")]
+ pub date_of_birth: Option<Secret<Date>>,
}
#[cfg(feature = "v1")]
@@ -358,6 +368,15 @@ pub struct PaymentsCreateIntentRequest {
/// Allow partial authorization for this payment
#[schema(value_type = Option<bool>, default = false)]
pub enable_partial_authorization: Option<primitive_wrappers::EnablePartialAuthorizationBool>,
+
+ /// Indicates whether this payment is an account funded transaction, where funds are pulled
+ /// from a card account to fund another account rather than to pay for goods or services.
+ #[schema(value_type = Option<bool>, example = true)]
+ pub is_account_funded_transaction: Option<bool>,
+
+ /// Details of the party receiving the funds in an account funded transaction.
+ #[schema(value_type = Option<RecipientDetails>)]
+ pub recipient_details: Option<RecipientDetails>,
}
#[cfg(feature = "v2")]
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, ToSchema)]
@@ -538,6 +557,14 @@ pub struct PaymentsUpdateIntentRequest {
/// Allow partial authorization for this payment
#[schema(value_type = Option<bool>, default = false)]
pub enable_partial_authorization: Option<primitive_wrappers::EnablePartialAuthorizationBool>,
+
+ /// Indicates whether this payment is an account funded transaction.
+ #[schema(value_type = Option<bool>, example = true)]
+ pub is_account_funded_transaction: Option<bool>,
+
+ /// Details of the party receiving the funds in an account funded transaction.
+ #[schema(value_type = Option<RecipientDetails>)]
+ pub recipient_details: Option<RecipientDetails>,
}
#[cfg(feature = "v2")]
@@ -571,6 +598,8 @@ impl PaymentsUpdateIntentRequest {
frm_metadata: None,
request_external_three_ds_authentication: None,
enable_partial_authorization: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
}
}
}
@@ -719,6 +748,14 @@ pub struct PaymentsIntentResponse {
/// Allow partial authorization for this payment
#[schema(value_type = Option<bool>, default = false)]
pub enable_partial_authorization: Option<primitive_wrappers::EnablePartialAuthorizationBool>,
+
+ /// Indicates whether this payment is an account funded transaction.
+ #[schema(value_type = Option<bool>, example = true)]
+ pub is_account_funded_transaction: Option<bool>,
+
+ /// Partially masked details of the party receiving the funds in an account funded transaction.
+ #[schema(value_type = Option<MaskedRecipientDetails>)]
+ pub recipient_details: Option<MaskedRecipientDetails>,
}
#[derive(Debug, serde::Serialize, Clone, ToSchema)]
@@ -1585,6 +1622,16 @@ pub struct PaymentsRequest {
#[schema(value_type = Option<BillingDescriptor>)]
pub billing_descriptor: Option<common_types::payments::BillingDescriptor>,
+ /// Indicates whether this payment is an account funded transaction.
+ #[schema(value_type = Option<bool>, example = true)]
+ #[remove_in(PaymentsConfirmRequest)]
+ pub is_account_funded_transaction: Option<bool>,
+
+ /// Details of the party receiving the funds in an account funded transaction.
+ #[schema(value_type = Option<RecipientDetails>)]
+ #[remove_in(PaymentsConfirmRequest)]
+ pub recipient_details: Option<RecipientDetails>,
+
/// The tokenization preference for the payment method. This is used to control whether a PSP token is created or not.
#[schema(value_type = Option<Tokenization>, example = "tokenize_at_psp")]
pub tokenization: Option<enums::Tokenization>,
@@ -1886,6 +1933,7 @@ mod payments_request_test {
phone_country_code: None,
tax_registration_id: None,
document_details: None,
+ date_of_birth: None,
};
let payments_request = PaymentsRequest {
@@ -1912,6 +1960,7 @@ mod payments_request_test {
phone_country_code: None,
tax_registration_id: None,
document_details: None,
+ date_of_birth: None,
};
let payments_request = PaymentsRequest {
@@ -7862,6 +7911,15 @@ pub struct PaymentsResponse {
#[schema(value_type = Option<BillingDescriptor>)]
pub billing_descriptor: Option<common_types::payments::BillingDescriptor>,
+ /// Indicates whether this payment is an account funded transaction, where funds are pulled
+ /// from a card account to fund another account rather than to pay for goods or services.
+ #[schema(value_type = Option<bool>, example = true)]
+ pub is_account_funded_transaction: Option<bool>,
+
+ /// Partially masked details of the party receiving the funds in an account funded transaction.
+ #[schema(value_type = Option<MaskedRecipientDetails>)]
+ pub recipient_details: Option<MaskedRecipientDetails>,
+
/// The tokenization preference for the payment method. This is used to control whether a PSP token is created or not.
#[schema(value_type = Option<Tokenization>,example="skip_psp")]
pub tokenization: Option<enums::Tokenization>,
@@ -8423,6 +8481,15 @@ pub struct PaymentsRequest {
/// The webhook endpoint URL to receive payment status notifications
#[schema(value_type = Option<String>, example = "https://merchant.example.com/webhooks/payment")]
pub webhook_url: Option<common_utils::types::Url>,
+
+ /// Indicates whether this payment is an account funded transaction, where funds are pulled
+ /// from a card account to fund another account rather than to pay for goods or services.
+ #[schema(value_type = Option<bool>, example = true)]
+ pub is_account_funded_transaction: Option<bool>,
+
+ /// Details of the party receiving the funds in an account funded transaction.
+ #[schema(value_type = Option<RecipientDetails>)]
+ pub recipient_details: Option<RecipientDetails>,
}
#[cfg(feature = "v2")]
@@ -8458,6 +8525,8 @@ impl From<&PaymentsRequest> for PaymentsCreateIntentRequest {
force_3ds_challenge: request.force_3ds_challenge,
merchant_connector_details: request.merchant_connector_details.clone(),
enable_partial_authorization: request.enable_partial_authorization,
+ is_account_funded_transaction: request.is_account_funded_transaction,
+ recipient_details: request.recipient_details.clone(),
}
}
}
diff --git a/crates/api_models/src/payments/recipient.rs b/crates/api_models/src/payments/recipient.rs
new file mode 100644
index 0000000000..c65946c167
--- /dev/null
+++ b/crates/api_models/src/payments/recipient.rs
@@ -0,0 +1,287 @@
+use common_utils::{
+ new_type::{
+ MaskedBankAccount, MaskedBic, MaskedCardNumber, MaskedEmail, MaskedIban, MaskedPhoneNumber,
+ MaskedRoutingNumber, MaskedValue,
+ },
+ pii::Email,
+ transformers::ForeignFrom,
+};
+use hyperswitch_masking::Secret;
+use utoipa::ToSchema;
+
+use crate::payments::AddressDetails;
+
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+#[serde(tag = "bank_account_type", rename_all = "snake_case")]
+pub enum RecipientBankAccount {
+ /// An International Bank Account Number.
+ Iban {
+ /// The recipient's IBAN.
+ #[schema(value_type = String, example = "GB29NWBK70361331946864")]
+ iban: Secret<String>,
+ },
+ /// A bank account number paired with the routing number of the holding bank.
+ RoutingNumber {
+ /// The recipient's bank account number.
+ #[schema(value_type = String, example = "000123456789")]
+ account_number: Secret<String>,
+ /// The routing number of the recipient's bank.
+ #[schema(value_type = String, example = "110000000")]
+ routing_number: Secret<String>,
+ },
+ /// A bank account number paired with the BIC of the holding bank.
+ Bic {
+ /// The recipient's bank account number.
+ #[schema(value_type = String, example = "09875432")]
+ account_number: Secret<String>,
+ /// The Bank Identification Code of the recipient's bank.
+ #[schema(value_type = String, example = "HBUKGB4B")]
+ bic: Secret<String>,
+ },
+ /// A bare bank account number, where the scheme does not require a bank identifier.
+ AccountNumber {
+ /// The recipient's bank account number.
+ #[schema(value_type = String, example = "000123456789")]
+ account_number: Secret<String>,
+ },
+ /// A truncated primary account number, made up of the first six and last four digits.
+ TruncatedPan {
+ /// The first six digits of the recipient's PAN.
+ #[schema(value_type = String, max_length = 6, example = "411111")]
+ card_isin: Secret<String>,
+ /// The last four digits of the recipient's PAN.
+ #[schema(value_type = String, max_length = 4, example = "1111")]
+ last4: Secret<String>,
+ },
+}
+
+/// The account that receives the funds in an account funded transaction.
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+#[serde(tag = "type", rename_all = "snake_case")]
+pub enum RecipientAccount {
+ /// Funds are credited to a bank account.
+ BankAccount(RecipientBankAccount),
+ /// Funds are credited to a card.
+ Card {
+ /// The recipient's card number.
+ #[schema(value_type = String, example = "4111111111111111")]
+ card_number: cards::CardNumber,
+ },
+ /// Funds are credited to a wallet held for the recipient.
+ Wallet {
+ /// The identifier of the recipient's wallet.
+ #[schema(value_type = String, example = "wallet_8891")]
+ wallet_id: Secret<String>,
+ },
+ /// The recipient's account is identified by their email address.
+ Email {
+ /// The email address that identifies the recipient's account.
+ #[schema(value_type = String, example = "[email protected]")]
+ email: Email,
+ },
+ /// The recipient's account is identified by their phone number.
+ Phone {
+ /// The phone number that identifies the recipient's account.
+ #[schema(value_type = String, example = "9123456789")]
+ phone_number: Secret<String>,
+ },
+ /// The recipient's account is identified by a social network handle.
+ SocialNetwork {
+ /// The social network identifier of the recipient.
+ #[schema(value_type = String, example = "jane.doe")]
+ social_network_id: Secret<String>,
+ },
+}
+
+/// Details of the party receiving the funds in an account funded transaction.
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+pub struct RecipientDetails {
+ /// The account the funds are credited to.
+ #[schema(value_type = Option<RecipientAccount>)]
+ pub account: Option<RecipientAccount>,
+
+ /// The recipient's phone number.
+ #[schema(value_type = Option<String>, max_length = 20, example = "9123456789")]
+ pub phone_number: Option<Secret<String>>,
+
+ /// The recipient's tax identifier. Some connectors require this for recipients in Brazil
+ /// (CPF or CNPJ) and Argentina.
+ #[schema(value_type = Option<String>, max_length = 25, example = "162.152.541-42")]
+ pub tax_id: Option<Secret<String>>,
+
+ /// The recipient's address.
+ #[schema(value_type = Option<AddressDetails>)]
+ pub address: Option<AddressDetails>,
+}
+
+/// A partially masked view of `RecipientBankAccount`, safe to return in API responses.
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+#[serde(tag = "bank_account_type", rename_all = "snake_case")]
+pub enum MaskedRecipientBankAccount {
+ /// A partially masked International Bank Account Number.
+ Iban {
+ /// The recipient's partially masked IBAN.
+ #[schema(value_type = String, example = "GB29N************46864")]
+ iban: MaskedIban,
+ },
+ /// A partially masked account number and routing number.
+ RoutingNumber {
+ /// The recipient's partially masked bank account number.
+ #[schema(value_type = String, example = "0001****6789")]
+ account_number: MaskedBankAccount,
+ /// The partially masked routing number of the recipient's bank.
+ #[schema(value_type = String, example = "110***000")]
+ routing_number: MaskedRoutingNumber,
+ },
+ /// A partially masked account number and BIC.
+ Bic {
+ /// The recipient's partially masked bank account number.
+ #[schema(value_type = String, example = "0987****5432")]
+ account_number: MaskedBankAccount,
+ /// The partially masked Bank Identification Code of the recipient's bank.
+ #[schema(value_type = String, example = "HBU***4B")]
+ bic: MaskedBic,
+ },
+ /// A partially masked bare bank account number.
+ AccountNumber {
+ /// The recipient's partially masked bank account number.
+ #[schema(value_type = String, example = "0001****6789")]
+ account_number: MaskedBankAccount,
+ },
+ /// A truncated primary account number. This is already the industry standard truncated form,
+ /// so it is returned as supplied.
+ TruncatedPan {
+ /// The first six digits of the recipient's PAN.
+ #[schema(value_type = String, example = "411111")]
+ card_isin: Secret<String>,
+ /// The last four digits of the recipient's PAN.
+ #[schema(value_type = String, example = "1111")]
+ last4: Secret<String>,
+ },
+}
+
+/// A partially masked view of `RecipientAccount`, safe to return in API responses.
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+#[serde(tag = "type", rename_all = "snake_case")]
+pub enum MaskedRecipientAccount {
+ /// A partially masked bank account.
+ BankAccount(MaskedRecipientBankAccount),
+ /// A partially masked card.
+ Card {
+ /// The recipient's partially masked card number.
+ #[schema(value_type = String, example = "411111******1111")]
+ card_number: MaskedCardNumber,
+ },
+ /// A partially masked wallet.
+ Wallet {
+ /// The partially masked identifier of the recipient's wallet.
+ #[schema(value_type = String, example = "wall****8891")]
+ wallet_id: MaskedValue,
+ },
+ /// A masked email address.
+ Email {
+ /// The email address that identifies the recipient's account.
+ #[schema(value_type = String, example = "ja******@example.com")]
+ email: MaskedEmail,
+ },
+ /// A partially masked phone number.
+ Phone {
+ /// The phone number that identifies the recipient's account.
+ #[schema(value_type = String, example = "9123****6789")]
+ phone_number: MaskedPhoneNumber,
+ },
+ /// A partially masked social network handle.
+ SocialNetwork {
+ /// The social network identifier of the recipient.
+ #[schema(value_type = String, example = "jane****.doe")]
+ social_network_id: MaskedValue,
+ },
+}
+
+/// A partially masked view of `RecipientDetails`, safe to return in API responses.
+#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
+pub struct MaskedRecipientDetails {
+ /// The partially masked account the funds are credited to.
+ #[schema(value_type = Option<MaskedRecipientAccount>)]
+ pub account: Option<MaskedRecipientAccount>,
+
+ /// The recipient's partially masked phone number.
+ #[schema(value_type = Option<String>, example = "9123****6789")]
+ pub phone_number: Option<MaskedPhoneNumber>,
+
+ /// The recipient's partially masked tax identifier.
+ #[schema(value_type = Option<String>, example = "162.****41-42")]
+ pub tax_id: Option<MaskedValue>,
+
+ /// The recipient's address.
+ #[schema(value_type = Option<AddressDetails>)]
+ pub address: Option<AddressDetails>,
+}
+
+impl From<RecipientBankAccount> for MaskedRecipientBankAccount {
+ fn from(bank_account: RecipientBankAccount) -> Self {
+ match bank_account {
+ RecipientBankAccount::Iban { iban } => Self::Iban {
+ iban: MaskedIban::from(iban),
+ },
+ RecipientBankAccount::RoutingNumber {
+ account_number,
+ routing_number,
+ } => Self::RoutingNumber {
+ account_number: MaskedBankAccount::from(account_number),
+ routing_number: MaskedRoutingNumber::from(routing_number),
+ },
+ RecipientBankAccount::Bic {
+ account_number,
+ bic,
+ } => Self::Bic {
+ account_number: MaskedBankAccount::from(account_number),
+ bic: MaskedBic::from(bic),
+ },
+ RecipientBankAccount::AccountNumber { account_number } => Self::AccountNumber {
+ account_number: MaskedBankAccount::from(account_number),
+ },
+ // A truncated PAN is already the industry standard truncated form, so it is returned
+ // as supplied.
+ RecipientBankAccount::TruncatedPan { card_isin, last4 } => {
+ Self::TruncatedPan { card_isin, last4 }
+ }
+ }
+ }
+}
+
+impl From<RecipientAccount> for MaskedRecipientAccount {
+ fn from(account: RecipientAccount) -> Self {
+ match account {
+ RecipientAccount::BankAccount(bank_account) => {
+ Self::BankAccount(MaskedRecipientBankAccount::from(bank_account))
+ }
+ RecipientAccount::Card { card_number } => Self::Card {
+ card_number: MaskedCardNumber::from(Secret::new(card_number.get_card_no())),
+ },
+ RecipientAccount::Wallet { wallet_id } => Self::Wallet {
+ wallet_id: MaskedValue::from(wallet_id),
+ },
+ RecipientAccount::Email { email } => Self::Email {
+ email: MaskedEmail::foreign_from(email),
+ },
+ RecipientAccount::Phone { phone_number } => Self::Phone {
+ phone_number: MaskedPhoneNumber::from(phone_number),
+ },
+ RecipientAccount::SocialNetwork { social_network_id } => Self::SocialNetwork {
+ social_network_id: MaskedValue::from(social_network_id),
+ },
+ }
+ }
+}
+
+impl From<RecipientDetails> for MaskedRecipientDetails {
+ fn from(recipient_details: RecipientDetails) -> Self {
+ Self {
+ account: recipient_details.account.map(MaskedRecipientAccount::from),
+ phone_number: recipient_details.phone_number.map(MaskedPhoneNumber::from),
+ tax_id: recipient_details.tax_id.map(MaskedValue::from),
+ address: recipient_details.address,
+ }
+ }
+}
diff --git a/crates/common_utils/src/new_type.rs b/crates/common_utils/src/new_type.rs
index be08561be6..8973f02202 100644
--- a/crates/common_utils/src/new_type.rs
+++ b/crates/common_utils/src/new_type.rs
@@ -162,6 +162,64 @@ impl From<Secret<String>> for MaskedBankAccount {
}
}
+/// A generically masked value, for identifiers that have no more specific masked type.
+#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
+pub struct MaskedValue<const UNMASKED_CHAR_COUNT: usize = 4, const MIN_MASKED_CHAR_COUNT: usize = 4>(
+ Secret<String>,
+);
+
+impl<const UNMASKED_CHAR_COUNT: usize, const MIN_MASKED_CHAR_COUNT: usize> From<String>
+ for MaskedValue<UNMASKED_CHAR_COUNT, MIN_MASKED_CHAR_COUNT>
+{
+ fn from(src: String) -> Self {
+ let masked_value = apply_mask(src.as_ref(), UNMASKED_CHAR_COUNT, MIN_MASKED_CHAR_COUNT);
+ Self(Secret::from(masked_value))
+ }
+}
+
+impl<const UNMASKED_CHAR_COUNT: usize, const MIN_MASKED_CHAR_COUNT: usize> From<Secret<String>>
+ for MaskedValue<UNMASKED_CHAR_COUNT, MIN_MASKED_CHAR_COUNT>
+{
+ fn from(secret: Secret<String>) -> Self {
+ Self::from(secret.expose())
+ }
+}
+
+/// Masked card number, revealing the first six and last four digits.
+#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
+pub struct MaskedCardNumber(hyperswitch_masking::StrongSecret<String>);
+impl From<String> for MaskedCardNumber {
+ fn from(src: String) -> Self {
+ const UNMASKED_PREFIX_LEN: usize = 6;
+ const UNMASKED_SUFFIX_LEN: usize = 4;
+
+ let len = src.len();
+ let masked_value = if len <= UNMASKED_PREFIX_LEN + UNMASKED_SUFFIX_LEN {
+ apply_mask(src.as_ref(), UNMASKED_SUFFIX_LEN, UNMASKED_SUFFIX_LEN)
+ } else {
+ src.chars()
+ .enumerate()
+ .map(|(index, ch)| {
+ if index >= UNMASKED_PREFIX_LEN
+ && index < len - UNMASKED_SUFFIX_LEN
+ && ch.is_alphanumeric()
+ {
+ '*'
+ } else {
+ ch
+ }
+ })
+ .collect()
+ };
+ Self(hyperswitch_masking::StrongSecret::new(masked_value))
+ }
+}
+impl From<Secret<String>> for MaskedCardNumber {
+ fn from(secret: Secret<String>) -> Self {
+ Self::from(secret.expose())
+ }
+}
+
/// Masked IBAN
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct MaskedIban(Secret<String>);
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index f1b938f616..6f067513f2 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -90,6 +90,8 @@ pub struct PaymentIntent {
pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
pub external_surcharge_strategy: Option<common_enums::SurchargeStrategy>,
pub external_surcharge_applicable: Option<bool>,
+ pub is_account_funded_transaction: Option<bool>,
+ pub recipient_details: Option<Encryption>,
pub merchant_reference_id: Option<common_utils::id_type::PaymentReferenceId>,
pub billing_address: Option<Encryption>,
pub shipping_address: Option<Encryption>,
@@ -214,6 +216,8 @@ pub struct PaymentIntent {
pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
pub external_surcharge_strategy: Option<common_enums::SurchargeStrategy>,
pub external_surcharge_applicable: Option<bool>,
+ pub is_account_funded_transaction: Option<bool>,
+ pub recipient_details: Option<Encryption>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, diesel::AsExpression, PartialEq)]
@@ -436,6 +440,8 @@ pub struct PaymentIntentNew {
pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
pub external_surcharge_strategy: Option<common_enums::SurchargeStrategy>,
pub external_surcharge_applicable: Option<bool>,
+ pub is_account_funded_transaction: Option<bool>,
+ pub recipient_details: Option<Encryption>,
}
#[cfg(feature = "v1")]
@@ -530,6 +536,8 @@ pub struct PaymentIntentNew {
pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
pub external_surcharge_strategy: Option<common_enums::SurchargeStrategy>,
pub external_surcharge_applicable: Option<bool>,
+ pub is_account_funded_transaction: Option<bool>,
+ pub recipient_details: Option<Encryption>,
}
#[cfg(feature = "v2")]
@@ -725,6 +733,8 @@ pub struct PaymentIntentUpdateFields {
pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
pub external_surcharge_strategy: Option<common_enums::SurchargeStrategy>,
pub external_surcharge_applicable: Option<bool>,
+ pub is_account_funded_transaction: Option<bool>,
+ pub recipient_details: Option<Encryption>,
}
// TODO: uncomment fields as necessary
@@ -841,6 +851,8 @@ pub struct PaymentIntentUpdateInternal {
pub profile_acquirer_id: Option<common_utils::id_type::ProfileAcquirerId>,
pub external_surcharge_strategy: Option<common_enums::SurchargeStrategy>,
pub external_surcharge_applicable: Option<bool>,
+ pub is_account_funded_transaction: Option<bool>,
+ pub recipient_details: Option<Encryption>,
}
#[cfg(feature = "v1")]
@@ -914,6 +926,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::StateMetadataUpdate {
state_metadata,
@@ -975,6 +989,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
installment_options: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::Update(value) => Self {
amount: Some(value.amount),
@@ -1034,6 +1050,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: value.profile_acquirer_id,
external_surcharge_strategy: value.external_surcharge_strategy,
external_surcharge_applicable: value.external_surcharge_applicable,
+ is_account_funded_transaction: value.is_account_funded_transaction,
+ recipient_details: value.recipient_details,
},
PaymentIntentUpdate::PaymentCreateUpdate {
return_url,
@@ -1100,6 +1118,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::PGStatusUpdate {
status,
@@ -1163,6 +1183,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::MerchantStatusUpdate {
status,
@@ -1226,6 +1248,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::ResponseUpdate {
// amount,
@@ -1297,6 +1321,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::PaymentAttemptAndAttemptCountUpdate {
active_attempt_id,
@@ -1359,6 +1385,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::StatusAndAttemptUpdate {
status,
@@ -1422,6 +1450,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::ApproveUpdate {
status,
@@ -1484,6 +1514,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::RejectUpdate {
status,
@@ -1546,6 +1578,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::SurchargeApplicableUpdate {
surcharge_applicable,
@@ -1607,6 +1641,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::ExternalSurchargeApplicableUpdate {
external_surcharge_applicable,
@@ -1668,6 +1704,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
shipping_cost: None,
profile_acquirer_id: None,
external_surcharge_strategy: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::IncrementalAuthorizationAmountUpdate { amount } => Self {
amount: Some(amount),
@@ -1726,6 +1764,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::AuthorizationCountUpdate {
authorization_count,
@@ -1786,6 +1826,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::CompleteAuthorizeUpdate {
shipping_address_id,
@@ -1846,6 +1888,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::ManualUpdate {
status,
@@ -1908,6 +1952,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::SessionResponseUpdate {
tax_details,
@@ -1971,6 +2017,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::RecurrenceUpdate { status, updated_by } => Self {
status: Some(status),
@@ -2029,6 +2077,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
}
}
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 39665bc516..63148108ad 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -1378,6 +1378,8 @@ diesel::table! {
#[max_length = 64]
external_surcharge_strategy -> Nullable<Varchar>,
external_surcharge_applicable -> Nullable<Bool>,
+ is_account_funded_transaction -> Nullable<Bool>,
+ recipient_details -> Nullable<Bytea>,
}
}
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index cea3f572cb..35a1c0b753 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -1290,6 +1290,8 @@ diesel::table! {
#[max_length = 64]
external_surcharge_strategy -> Nullable<Varchar>,
external_surcharge_applicable -> Nullable<Bool>,
+ is_account_funded_transaction -> Nullable<Bool>,
+ recipient_details -> Nullable<Bytea>,
#[max_length = 64]
merchant_reference_id -> Nullable<Varchar>,
billing_address -> Nullable<Bytea>,
diff --git a/crates/hyperswitch_connectors/src/utils.rs b/crates/hyperswitch_connectors/src/utils.rs
index 3aea204891..a6929e51a5 100644
--- a/crates/hyperswitch_connectors/src/utils.rs
+++ b/crates/hyperswitch_connectors/src/utils.rs
@@ -596,6 +596,8 @@ pub trait RouterData {
fn get_customer_document_details(
&self,
) -> Result<Option<api_models::customers::CustomerDocumentDetails>, Error>;
+ fn get_optional_customer_date_of_birth(&self) -> Option<Secret<time::Date>>;
+ fn get_customer_date_of_birth(&self) -> Result<Secret<time::Date>, Error>;
fn get_optional_customer_id(&self) -> Option<id_type::CustomerId>;
fn get_connector_customer_id(&self) -> Result<String, Error>;
fn get_preprocessing_id(&self) -> Result<String, Error>;
@@ -1111,6 +1113,13 @@ impl<Flow, Request, Response> RouterData
) -> Result<Option<api_models::customers::CustomerDocumentDetails>, Error> {
Ok(self.customer_document_details.clone())
}
+ fn get_optional_customer_date_of_birth(&self) -> Option<Secret<time::Date>> {
+ self.customer_date_of_birth.clone()
+ }
+ fn get_customer_date_of_birth(&self) -> Result<Secret<time::Date>, Error> {
+ self.get_optional_customer_date_of_birth()
+ .ok_or_else(missing_field_err("customer.date_of_birth"))
+ }
fn get_connector_customer_id(&self) -> Result<String, Error> {
self.connector_customer
.to_owned()
@@ -7843,6 +7852,8 @@ pub(crate) fn convert_setup_mandate_router_data_to_authorize_router_data(
.clone(),
feature_metadata: None,
installment_details: None,
+ is_account_funded_transaction: data.request.is_account_funded_transaction,
+ recipient_details: data.request.recipient_details.clone(),
connector_intent_metadata: data.request.connector_intent_metadata.clone(),
}
}
@@ -7909,6 +7920,7 @@ pub(crate) fn convert_payment_authorize_router_response<F1, F2, T1, T2>(
minor_amount_capturable: data.minor_amount_capturable,
authorized_amount: data.authorized_amount,
customer_document_details: data.customer_document_details.clone(),
+ customer_date_of_birth: data.customer_date_of_birth.clone(),
feature_data: data.feature_data.clone(),
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
diff --git a/crates/hyperswitch_domain_models/src/bulk_tokenization.rs b/crates/hyperswitch_domain_models/src/bulk_tokenization.rs
index 0c72a4636c..2a086a3d3b 100644
--- a/crates/hyperswitch_domain_models/src/bulk_tokenization.rs
+++ b/crates/hyperswitch_domain_models/src/bulk_tokenization.rs
@@ -113,6 +113,7 @@ impl ForeignFrom<&CardNetworkTokenizeRecord> for payments_api::CustomerDetails {
phone_country_code: record.customer_phone_country_code.clone(),
tax_registration_id: record.customer_tax_registration_id.clone(),
document_details: record.customer_document_details.clone(),
+ date_of_birth: None,
}
}
}
@@ -229,6 +230,7 @@ impl ForeignTryFrom<CustomerDetails> for payments_api::CustomerDetails {
phone_country_code: customer.phone_country_code,
tax_registration_id: customer.tax_registration_id,
document_details: customer.document_details,
+ date_of_birth: customer.date_of_birth,
})
}
}
@@ -283,6 +285,7 @@ impl ForeignFrom<payments_api::CustomerDetails> for CustomerDetails {
phone_country_code: req.phone_country_code,
tax_registration_id: req.tax_registration_id,
document_details: req.document_details,
+ date_of_birth: req.date_of_birth,
}
}
}
diff --git a/crates/hyperswitch_domain_models/src/payments.rs b/crates/hyperswitch_domain_models/src/payments.rs
index 61cc758525..5246054a77 100644
--- a/crates/hyperswitch_domain_models/src/payments.rs
+++ b/crates/hyperswitch_domain_models/src/payments.rs
@@ -156,6 +156,9 @@ pub struct PaymentIntent {
pub profile_acquirer_id: Option<id_type::ProfileAcquirerId>,
pub external_surcharge_strategy: Option<common_enums::SurchargeStrategy>,
pub external_surcharge_applicable: Option<bool>,
+ pub is_account_funded_transaction: Option<bool>,
+ #[encrypt]
+ pub recipient_details: Option<Encryptable<Secret<Value>>>,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
@@ -408,6 +411,25 @@ impl PaymentIntent {
})
}
+ /// Decrypt and parse the recipient details
+ pub fn get_recipient_details(
+ &self,
+ ) -> CustomResult<
+ Option<api_models::payments::RecipientDetails>,
+ common_utils::errors::ParsingError,
+ > {
+ self.recipient_details
+ .as_ref()
+ .map(|details| {
+ let decrypted_value = details.clone().into_inner().expose();
+ ValueExt::parse_value::<api_models::payments::RecipientDetails>(
+ decrypted_value,
+ "RecipientDetails",
+ )
+ })
+ .transpose()
+ }
+
#[cfg(feature = "v1")]
pub fn prevent_refund_after_post_capture_void(
&self,
@@ -1008,6 +1030,11 @@ pub struct PaymentIntent {
/// Denotes the surcharge strategy for this payment.
pub external_surcharge_strategy: Option<common_enums::SurchargeStrategy>,
pub external_surcharge_applicable: Option<bool>,
+ /// Denotes whether this payment is an account funded transaction.
+ pub is_account_funded_transaction: Option<bool>,
+ /// The details of the party receiving the funds in an account funded transaction.
+ #[encrypt]
+ pub recipient_details: Option<Encryptable<Secret<Value>>>,
}
#[cfg(feature = "v2")]
@@ -1218,6 +1245,8 @@ impl PaymentIntent {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: request.is_account_funded_transaction,
+ recipient_details: decrypted_payment_intent.recipient_details,
})
}
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
index c8060457e2..45c430a6b9 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs
@@ -159,6 +159,7 @@ pub struct CustomerData {
pub phone_country_code: Option<String>,
pub tax_registration_id: Option<Secret<String>>,
pub customer_document_details: Option<CustomerDocumentDetails>,
+ pub date_of_birth: Option<Secret<time::Date>>,
}
impl CustomerData {
@@ -174,6 +175,10 @@ impl CustomerData {
.tax_registration_id
.clone()
.or_else(|| other.tax_registration_id.clone());
+ self.date_of_birth = self
+ .date_of_birth
+ .clone()
+ .or_else(|| other.date_of_birth.clone());
}
}
@@ -272,6 +277,8 @@ pub struct PaymentIntentUpdateFields {
pub profile_acquirer_id: Option<id_type::ProfileAcquirerId>,
pub external_surcharge_strategy: Option<common_enums::SurchargeStrategy>,
pub external_surcharge_applicable: Option<bool>,
+ pub is_account_funded_transaction: Option<bool>,
+ pub recipient_details: Option<Encryptable<Secret<serde_json::Value>>>,
}
#[cfg(feature = "v1")]
@@ -505,6 +512,8 @@ pub struct PaymentIntentUpdateInternal {
pub profile_acquirer_id: Option<id_type::ProfileAcquirerId>,
pub external_surcharge_strategy: Option<common_enums::SurchargeStrategy>,
pub external_surcharge_applicable: Option<bool>,
+ pub is_account_funded_transaction: Option<bool>,
+ pub recipient_details: Option<Encryptable<Secret<serde_json::Value>>>,
}
// This conversion is used in the `update_payment_intent` function
@@ -1340,6 +1349,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
PaymentIntentUpdate::RecurrenceUpdate { status, updated_by } => Self {
status: Some(status),
@@ -1397,6 +1408,8 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
profile_acquirer_id: None,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
},
}
}
@@ -1506,6 +1519,8 @@ impl From<PaymentIntentUpdate> for DieselPaymentIntentUpdate {
profile_acquirer_id: value.profile_acquirer_id,
external_surcharge_strategy: None,
external_surcharge_applicable: None,
+ is_account_funded_transaction: value.is_account_funded_transaction,
+ recipient_details: value.recipient_details.map(Encryption::from),
}))
}
PaymentIntentUpdate::PaymentCreateUpdate {
@@ -1699,6 +1714,8 @@ impl From<PaymentIntentUpdateInternal> for diesel_models::PaymentIntentUpdateInt
profile_acquirer_id,
external_surcharge_strategy,
external_surcharge_applicable,
+ is_account_funded_transaction,
+ recipient_details,
} = value;
Self {
amount,
@@ -1758,6 +1775,8 @@ impl From<PaymentIntentUpdateInternal> for diesel_models::PaymentIntentUpdateInt
profile_acquirer_id,
external_surcharge_strategy,
external_surcharge_applicable,
+ is_account_funded_transaction,
+ recipient_details: recipient_details.map(Encryption::from),
}
}
}
@@ -2155,6 +2174,8 @@ impl behaviour::Conversion for PaymentIntent {
profile_acquirer_id,
external_surcharge_strategy,
external_surcharge_applicable,
+ is_account_funded_transaction,
+ recipient_details,
} = self;
Ok(DieselPaymentIntent {
skip_external_tax_calculation: Some(amount_details.get_external_tax_action_as_bool()),
@@ -2269,6 +2290,8 @@ impl behaviour::Conversion for PaymentIntent {
profile_acquirer_id,
external_surcharge_strategy,
external_surcharge_applicable,
+ is_account_funded_transaction,
+ recipient_details: recipient_details.map(Encryption::from),
})
}
async fn convert_back(
@@ -2289,6 +2312,7 @@ impl behaviour::Conversion for PaymentIntent {
billing_address: storage_model.billing_address,
shipping_address: storage_model.shipping_address,
customer_details: storage_model.customer_details,
+ recipient_details: storage_model.recipient_details,
},
)),
key_manager_identifier,
@@ -2425,6 +2449,8 @@ impl behaviour::Conversion for PaymentIntent {
profile_acquirer_id: storage_model.profile_acquirer_id,
external_surcharge_strategy: storage_model.external_surcharge_strategy,
external_surcharge_applicable: storage_model.external_surcharge_applicable,
+ is_account_funded_transaction: storage_model.is_account_funded_transaction,
+ recipient_details: data.recipient_details,
})
}
.await
@@ -2539,6 +2565,8 @@ impl behaviour::Conversion for PaymentIntent {
profile_acquirer_id: self.profile_acquirer_id,
external_surcharge_strategy: self.external_surcharge_strategy,
external_surcharge_applicable: self.external_surcharge_applicable,
+ is_account_funded_transaction: self.is_account_funded_transaction,
+ recipient_details: self.recipient_details.map(Encryption::from),
})
}
}
@@ -2633,6 +2661,8 @@ impl behaviour::Conversion for PaymentIntent {
profile_acquirer_id: self.profile_acquirer_id,
external_surcharge_strategy: self.external_surcharge_strategy,
external_surcharge_applicable: self.external_surcharge_applicable,
+ is_account_funded_transaction: self.is_account_funded_transaction,
+ recipient_details: self.recipient_details.map(Encryption::from),
})
}
@@ -2654,6 +2684,7 @@ impl behaviour::Conversion for PaymentIntent {
billing_details: storage_model.billing_details,
shipping_details: storage_model.shipping_details,
customer_details: storage_model.customer_details,
+ recipient_details: storage_model.recipient_details,
},
)),
key_manager_identifier,
@@ -2752,6 +2783,8 @@ impl behaviour::Conversion for PaymentIntent {
profile_acquirer_id: storage_model.profile_acquirer_id,
external_surcharge_strategy: storage_model.external_surcharge_strategy,
external_surcharge_applicable: storage_model.external_surcharge_applicable,
+ is_account_funded_transaction: storage_model.is_account_funded_transaction,
+ recipient_details: data.recipient_details,
})
}
.await
@@ -2844,6 +2877,8 @@ impl behaviour::Conversion for PaymentIntent {
profile_acquirer_id: self.profile_acquirer_id,
external_surcharge_strategy: self.external_surcharge_strategy,
external_surcharge_applicable: self.external_surcharge_applicable,
+ is_account_funded_transaction: self.is_account_funded_transaction,
+ recipient_details: self.recipient_details.map(Encryption::from),
})
}
}
diff --git a/crates/hyperswitch_domain_models/src/revenue_recovery.rs b/crates/hyperswitch_domain_models/src/revenue_recovery.rs
index 9da43761f6..09265d88fd 100644
--- a/crates/hyperswitch_domain_models/src/revenue_recovery.rs
+++ b/crates/hyperswitch_domain_models/src/revenue_recovery.rs
@@ -175,6 +175,8 @@ impl From<&RevenueRecoveryInvoiceData> for api_payments::PaymentsCreateIntentReq
force_3ds_challenge: None,
merchant_connector_details: None,
enable_partial_authorization: data.enable_partial_authorization,
+ is_account_funded_transaction: None,
+ recipient_details: None,
}
}
}
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index 0786fa6e1c..7b65d3382a 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -124,6 +124,8 @@ pub struct RouterData<Flow, Request, Response> {
// Document details of the customer consisting of document number and type
pub customer_document_details: Option<CustomerDocumentDetails>,
+ /// The customer's date of birth.
+ pub customer_date_of_birth: Option<Secret<time::Date>>,
// feature related data
pub feature_data: Option<FeatureData>,
/// A connector-specific identifier representing the stored payment instrument
diff --git a/crates/hyperswitch_domain_models/src/router_request_types.rs b/crates/hyperswitch_domain_models/src/router_request_types.rs
index cd137cced4..a1d8d94fee 100644
--- a/crates/hyperswitch_domain_models/src/router_request_types.rs
+++ b/crates/hyperswitch_domain_models/src/router_request_types.rs
@@ -168,6 +168,9 @@ pub struct PaymentsAuthorizeData {
pub installment_details: Option<common_types::payments::InstallmentData>,
// Contains the connector specific metadata coming from payments request
pub connector_intent_metadata: Option<ConnectorMetadata>,
+ /// Indicates whether this payment is an account funded transaction.
+ pub is_account_funded_transaction: Option<bool>,
+ pub recipient_details: Option<api_models::payments::RecipientDetails>,
}
#[derive(Debug, Clone, Serialize)]
@@ -1790,6 +1793,7 @@ pub struct CustomerDetails {
pub phone_country_code: Option<String>,
pub tax_registration_id: Option<Secret<String, hyperswitch_masking::WithType>>,
pub document_details: Option<api_models::customers::CustomerDocumentDetails>,
+ pub date_of_birth: Option<Secret<time::Date>>,
}
impl CustomerDetails {
@@ -1800,6 +1804,7 @@ impl CustomerDetails {
|| self.phone_country_code.is_some()
|| self.tax_registration_id.is_some()
|| self.document_details.is_some()
+ || self.date_of_birth.is_some()
{
Some(payments::payment_intent::CustomerData {
name: self.name.clone(),
@@ -1808,6 +1813,7 @@ impl CustomerDetails {
phone_country_code: self.phone_country_code.clone(),
tax_registration_id: self.tax_registration_id.clone(),
customer_document_details: self.document_details.clone(),
+ date_of_birth: self.date_of_birth.clone(),
})
} else {
None
@@ -1974,6 +1980,8 @@ pub struct SetupMandateRequestData {
pub connector_intent_metadata: Option<ConnectorMetadata>,
pub merchant_order_reference_id: Option<String>,
pub mit_category: Option<common_enums::MitCategory>,
+ pub is_account_funded_transaction: Option<bool>,
+ pub recipient_details: Option<api_models::payments::RecipientDetails>,
}
#[derive(Debug, Clone)]
diff --git a/crates/hyperswitch_interfaces/src/conversion_impls.rs b/crates/hyperswitch_interfaces/src/conversion_impls.rs
index 24ad9ae64c..fc62059a90 100644
--- a/crates/hyperswitch_interfaces/src/conversion_impls.rs
+++ b/crates/hyperswitch_interfaces/src/conversion_impls.rs
@@ -97,6 +97,7 @@ fn get_default_router_data<F, Req, Resp>(
minor_amount_capturable: None,
authorized_amount: None,
customer_document_details: None,
+ customer_date_of_birth: None,
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs
index 267790bb35..7391a04d1d 100644
--- a/crates/openapi/src/openapi.rs
+++ b/crates/openapi/src/openapi.rs
@@ -331,6 +331,12 @@ Never share your secret api keys. Keep them guarded and secure.
common_types::three_ds_decision_rule_engine::ThreeDSDecision,
common_types::payments::MerchantCountryCode,
common_types::payments::BillingDescriptor,
+ api_models::payments::RecipientDetails,
+ api_models::payments::RecipientAccount,
+ api_models::payments::RecipientBankAccount,
+ api_models::payments::MaskedRecipientDetails,
+ api_models::payments::MaskedRecipientAccount,
+ api_models::payments::MaskedRecipientBankAccount,
common_types::payments::PartnerMerchantIdentifierDetails,
common_types::payments::PartnerApplicationDetails,
common_types::payments::MerchantApplicationDetails,
diff --git a/crates/openapi/src/openapi_v2.rs b/crates/openapi/src/openapi_v2.rs
index 70949359d3..37803e17a7 100644
--- a/crates/openapi/src/openapi_v2.rs
+++ b/crates/openapi/src/openapi_v2.rs
@@ -461,6 +461,12 @@ Never share your secret api keys. Keep them guarded and secure.
common_types::domain::RetryFeatureData,
api_models::payments::NullObject,
api_models::payments::AddressDetails,
+ api_models::payments::RecipientDetails,
+ api_models::payments::RecipientAccount,
+ api_models::payments::RecipientBankAccount,
+ api_models::payments::MaskedRecipientDetails,
+ api_models::payments::MaskedRecipientAccount,
+ api_models::payments::MaskedRecipientBankAccount,
api_models::payments::EligibilityBalanceCheckResponseItem,
api_models::payments::PMBalanceCheckEligibilityResponse,
api_models::payments::PMBalanceCheckSuccessResponse,
diff --git a/crates/router/src/core/authentication/transformers.rs b/crates/router/src/core/authentication/transformers.rs
index f9b279eeb5..73aa1ea219 100644
--- a/crates/router/src/core/authentication/transformers.rs
+++ b/crates/router/src/core/authentication/transformers.rs
@@ -219,6 +219,7 @@ pub fn construct_router_data<F: Clone, Req, Res>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
})
}
diff --git a/crates/router/src/core/fraud_check/flows/checkout_flow.rs b/crates/router/src/core/fraud_check/flows/checkout_flow.rs
index 1d1a40133d..28fed68152 100644
--- a/crates/router/src/core/fraud_check/flows/checkout_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/checkout_flow.rs
@@ -192,6 +192,7 @@ impl ConstructFlowSpecificData<frm_api::Checkout, FraudCheckCheckoutData, FraudC
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
diff --git a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
index a2b288f9f8..3c7b164490 100644
--- a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
@@ -144,6 +144,7 @@ pub async fn construct_fulfillment_router_data<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
}
diff --git a/crates/router/src/core/fraud_check/flows/record_return.rs b/crates/router/src/core/fraud_check/flows/record_return.rs
index 44a17bec45..a49389615c 100644
--- a/crates/router/src/core/fraud_check/flows/record_return.rs
+++ b/crates/router/src/core/fraud_check/flows/record_return.rs
@@ -147,6 +147,7 @@ impl ConstructFlowSpecificData<RecordReturn, FraudCheckRecordReturnData, FraudCh
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
diff --git a/crates/router/src/core/fraud_check/flows/sale_flow.rs b/crates/router/src/core/fraud_check/flows/sale_flow.rs
index 51022184b4..6affa3d750 100644
--- a/crates/router/src/core/fraud_check/flows/sale_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/sale_flow.rs
@@ -199,6 +199,7 @@ impl ConstructFlowSpecificData<frm_api::Sale, FraudCheckSaleData, FraudCheckResp
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
diff --git a/crates/router/src/core/fraud_check/flows/transaction_flow.rs b/crates/router/src/core/fraud_check/flows/transaction_flow.rs
index 83b4f0ed4e..5c4c5236ad 100644
--- a/crates/router/src/core/fraud_check/flows/transaction_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/transaction_flow.rs
@@ -166,6 +166,7 @@ impl
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
diff --git a/crates/router/src/core/mandate/utils.rs b/crates/router/src/core/mandate/utils.rs
index a872bf4537..0aab1b611b 100644
--- a/crates/router/src/core/mandate/utils.rs
+++ b/crates/router/src/core/mandate/utils.rs
@@ -96,6 +96,7 @@ pub async fn construct_mandate_revoke_router_data(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
diff --git a/crates/router/src/core/merchant_connector_webhook_management/transformers.rs b/crates/router/src/core/merchant_connector_webhook_management/transformers.rs
index f6928ff887..2091a1aac9 100644
--- a/crates/router/src/core/merchant_connector_webhook_management/transformers.rs
+++ b/crates/router/src/core/merchant_connector_webhook_management/transformers.rs
@@ -137,6 +137,7 @@ pub async fn construct_webhook_register_router_data<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
})
}
@@ -217,6 +218,7 @@ pub async fn construct_generate_secret_router_data<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
})
}
diff --git a/crates/router/src/core/payment_methods/tokenize/card_executor.rs b/crates/router/src/core/payment_methods/tokenize/card_executor.rs
index 88ded081a5..278ef814ef 100644
--- a/crates/router/src/core/payment_methods/tokenize/card_executor.rs
+++ b/crates/router/src/core/payment_methods/tokenize/card_executor.rs
@@ -370,6 +370,7 @@ impl CardNetworkTokenizeExecutor<'_, domain::TokenizeCardRequest> {
.clone()
.map(|tax_registration_id| tax_registration_id.into_inner()),
document_details: None,
+ date_of_birth: None,
}))
},
)
@@ -467,6 +468,7 @@ impl CardNetworkTokenizeExecutor<'_, domain::TokenizeCardRequest> {
phone_country_code: self.customer.phone_country_code.clone(),
tax_registration_id: self.customer.tax_registration_id.clone(),
document_details: self.customer.document_details.clone(),
+ date_of_birth: None,
})
}
diff --git a/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs b/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs
index 50d29a48db..cb96c47aff 100644
--- a/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs
+++ b/crates/router/src/core/payment_methods/tokenize/payment_method_executor.rs
@@ -387,6 +387,7 @@ impl CardNetworkTokenizeExecutor<'_, domain::TokenizePaymentMethodRequest> {
.clone()
.map(|tax_registration_id| tax_registration_id.into_inner()),
document_details: None,
+ date_of_birth: None,
};
Ok((locker_id, customer_details))
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index da49754b59..8ef2cbcd49 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -9784,6 +9784,8 @@ pub struct PaymentDataUpdateRequestFields {
pub metadata: Option<serde_json::Value>,
pub merchant_order_reference_id: Option<String>,
pub customer_document_details: Option<api_models::customers::CustomerDocumentDetails>,
+ pub is_account_funded_transaction: Option<bool>,
+ pub recipient_details: Option<api_models::payments::RecipientDetails>,
}
#[derive(Clone)]
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 4e78ec3f91..8d56ddb794 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1782,6 +1782,11 @@ pub fn get_customer_details_from_request_or_pm_table(
.as_ref()
.and_then(|customer_details| customer_details.tax_registration_id.clone());
+ let date_of_birth = request
+ .customer
+ .as_ref()
+ .and_then(|customer_details| customer_details.date_of_birth.clone());
+
let document_details = match mandate_type {
Some(api::MandateTransactionType::NewMandateTransaction) | None => {
// Extracting customer details from request in case of CIT/One-Off
@@ -1824,6 +1829,7 @@ pub fn get_customer_details_from_request_or_pm_table(
phone_country_code: customer_phone_code,
tax_registration_id,
document_details,
+ date_of_birth,
})
}
@@ -1886,6 +1892,7 @@ pub async fn populate_raw_customer_details<F: Clone>(
phone_country_code: request_customer_details.phone_country_code.clone(),
tax_registration_id: request_customer_details.tax_registration_id.clone(),
customer_document_details: request_customer_details.document_details.clone(),
+ date_of_birth: None,
})
} else {
None
@@ -1931,6 +1938,7 @@ pub async fn populate_raw_customer_details<F: Clone>(
.document_details
.clone()
.or(parsed_customer_data.customer_document_details.clone()),
+ date_of_birth: None,
})
.or(temp_customer_data);
@@ -2258,6 +2266,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, D>(
.change_context(storage_impl::StorageError::SerializationFailed)
})
.transpose()?,
+ date_of_birth: None,
};
// Merge with existing payment intent customer details if present
@@ -4961,6 +4970,8 @@ mod tests {
enable_partial_authorization: None,
enable_overcapture: None,
billing_descriptor: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
partner_merchant_identifier_details: None,
state_metadata: None,
installment_options: None,
@@ -5054,6 +5065,8 @@ mod tests {
enable_partial_authorization: None,
enable_overcapture: None,
billing_descriptor: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
tokenization: None,
partner_merchant_identifier_details: None,
state_metadata: None,
@@ -5147,6 +5160,8 @@ mod tests {
enable_partial_authorization: None,
enable_overcapture: None,
billing_descriptor: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
partner_merchant_identifier_details: None,
state_metadata: None,
installment_options: None,
@@ -5413,6 +5428,7 @@ pub fn router_data_type_conversion<F1, F2, Req1, Req2, Res1, Res2>(
feature_data: router_data.feature_data,
sender_payment_instrument_id: router_data.sender_payment_instrument_id,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: router_data.customer_date_of_birth,
}
}
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 05dc6a4969..8aba114e51 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -411,6 +411,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsRequest>
phone_country_code: request.phone_country_code.clone(),
tax_registration_id: None,
document_details: customer_document_details,
+ date_of_birth: None,
});
let get_trackers_response = operations::GetTrackerResponse {
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index af12e72b7b..9f1d609da6 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -3005,6 +3005,10 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
.payment_intent
.is_iframe_redirection_enabled,
is_confirm_operation: true, // Indicates that this is a confirm operation
+ is_account_funded_transaction: payment_data
+ .payment_intent
+ .is_account_funded_transaction,
+ recipient_details: payment_data.payment_intent.recipient_details.clone(),
payment_channel: payment_data.payment_intent.payment_channel,
feature_metadata: payment_data.payment_intent.feature_metadata.clone(),
tax_status: payment_data.payment_intent.tax_status,
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index f83a95e20e..f46391c4c2 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -1880,6 +1880,14 @@ impl PaymentCreate {
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Unable to encode shipping details to serde_json::Value")?;
+ let recipient_details_encoded = request
+ .recipient_details
+ .clone()
+ .map(|recipient| Encode::encode_to_value(&recipient).map(Secret::new))
+ .transpose()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to encode recipient details to serde_json::Value")?;
+
let encrypted_data = domain::types::crypto_operation(
&key_manager_state,
type_name!(storage::PaymentIntent),
@@ -1889,6 +1897,7 @@ impl PaymentCreate {
shipping_details: shipping_details_encoded,
billing_details: billing_details_encoded,
customer_details: customer_details_encoded,
+ recipient_details: recipient_details_encoded,
},
),
),
@@ -2004,6 +2013,8 @@ impl PaymentCreate {
enable_overcapture: request.enable_overcapture,
mit_category: request.mit_category,
billing_descriptor: request.billing_descriptor.clone(),
+ is_account_funded_transaction: request.is_account_funded_transaction,
+ recipient_details: encrypted_data.recipient_details,
tokenization: request.tokenization,
partner_merchant_identifier_details: request
.partner_merchant_identifier_details
diff --git a/crates/router/src/core/payments/operations/payment_create_intent.rs b/crates/router/src/core/payments/operations/payment_create_intent.rs
index 57e0539d49..229fe64943 100644
--- a/crates/router/src/core/payments/operations/payment_create_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_create_intent.rs
@@ -123,6 +123,7 @@ impl<F: Send + Clone + Sync>
shipping_address: request.shipping.clone().map(|address| address.encode_to_value()).transpose().change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("Failed to encode shipping address")?.map(hyperswitch_masking::Secret::new),
billing_address: request.billing.clone().map(|address| address.encode_to_value()).transpose().change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("Failed to encode billing address")?.map(hyperswitch_masking::Secret::new),
customer_details: None,
+ recipient_details: request.recipient_details.clone().map(|recipient| recipient.encode_to_value()).transpose().change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("Failed to encode recipient details")?.map(hyperswitch_masking::Secret::new),
},
),
),
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index 9365e01d6a..d4a0487abd 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -4690,6 +4690,7 @@ impl<F: Clone + Send + Sync>
phone_country_code: None,
tax_registration_id: None,
customer_document_details: Some(customer_document_details),
+ date_of_birth: None,
});
}
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 818bd64d1b..0531299505 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -142,6 +142,7 @@ impl<F: Send + Clone + Sync> GetTracker<F, PaymentData<F>, api::PaymentsSessionR
phone_country_code: None,
tax_registration_id: None,
document_details: None,
+ date_of_birth: None,
};
let creds_identifier = request
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 7ad683c906..2d3b28fa4f 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -964,6 +964,7 @@ impl ForeignTryFrom<domain::Customer> for CustomerData {
router_env::logger::error!(error = ?report, "Failed to convert customer document details");
errors::ApiErrorResponse::InternalServerError
})?,
+ date_of_birth: None,
})
}
}
@@ -1068,6 +1069,8 @@ impl PaymentUpdate {
.customer
.as_ref()
.and_then(|customer| customer.document_details.clone()),
+ is_account_funded_transaction: request.is_account_funded_transaction,
+ recipient_details: request.recipient_details.clone(),
}
}
@@ -1256,6 +1259,23 @@ impl PaymentUpdate {
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Unable to encrypt shipping details")?;
+ // Re-encrypt the recipient details only when the update request carries them; otherwise
+ // retain whatever is already stored on the intent.
+ let recipient_details = match request.recipient_details.as_ref() {
+ Some(recipient_details) => Some(
+ core_utils::create_encrypted_data(
+ &key_manager_state,
+ key_store,
+ recipient_details.clone(),
+ common_utils::type_name!(diesel_models::payment_intent::PaymentIntent),
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Unable to encrypt recipient details")?,
+ ),
+ None => payment_data.payment_intent.recipient_details.clone(),
+ };
+
let order_details = payment_data.payment_intent.order_details.clone();
let connector_metadata = payment_data.payment_intent.connector_metadata.clone();
let frm_metadata = payment_data.payment_intent.frm_metadata.clone();
@@ -1324,6 +1344,10 @@ impl PaymentUpdate {
statement_descriptor_name,
statement_descriptor_suffix,
billing_descriptor: payment_data.payment_intent.billing_descriptor.clone(),
+ is_account_funded_transaction: request
+ .is_account_funded_transaction
+ .or(payment_data.payment_intent.is_account_funded_transaction),
+ recipient_details,
order_details,
metadata,
connector_metadata,
diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rs
index eab8dedca6..f7f33223bf 100644
--- a/crates/router/src/core/payments/operations/payment_update_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs
@@ -195,6 +195,8 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
request_external_three_ds_authentication,
set_active_attempt_id,
enable_partial_authorization,
+ is_account_funded_transaction,
+ recipient_details,
} = request.clone();
let batch_encrypted_data = domain_types::crypto_operation(
@@ -206,6 +208,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
shipping_address: shipping.map(|address| address.encode_to_value()).transpose().change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("Failed to encode shipping address")?.map(hyperswitch_masking::Secret::new),
billing_address: billing.map(|address| address.encode_to_value()).transpose().change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("Failed to encode billing address")?.map(hyperswitch_masking::Secret::new),
customer_details: None,
+ recipient_details: recipient_details.map(|recipient| recipient.encode_to_value()).transpose().change_context(errors::ApiErrorResponse::InternalServerError).attach_printable("Failed to encode recipient details")?.map(hyperswitch_masking::Secret::new),
},
),
),
@@ -304,6 +307,12 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentIntentData<F>, PaymentsUpda
enable_partial_authorization: enable_partial_authorization
.unwrap_or(payment_intent.enable_partial_authorization),
setup_future_usage: setup_future_usage.unwrap_or(payment_intent.setup_future_usage),
+ is_account_funded_transaction: is_account_funded_transaction
+ .or(payment_intent.is_account_funded_transaction),
+ recipient_details: decrypted_payment_intent
+ .recipient_details
+ .clone()
+ .or(payment_intent.recipient_details.clone()),
..payment_intent
};
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 306eeb1d15..5352ebc83e 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -243,6 +243,7 @@ where
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
}
@@ -430,6 +431,14 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
.and_then(|noon| noon.order_category.clone())
});
+ // Account funded transaction details are merchant supplied and are always read
+ // from the payment intent, never from the confirm request.
+ let recipient_details = payment_data
+ .payment_intent
+ .get_recipient_details()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse recipient details")?;
+
// TODO: few fields are repeated in both routerdata and request
let request = types::PaymentsAuthorizeData {
payment_method_data: payment_data
@@ -503,6 +512,8 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
feature_metadata: None,
installment_details: None,
connector_intent_metadata: None,
+ is_account_funded_transaction: payment_data.payment_intent.is_account_funded_transaction,
+ recipient_details,
};
let connector_mandate_request_reference_id = payment_data
.payment_attempt
@@ -594,6 +605,7 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -1010,6 +1022,7 @@ pub async fn construct_external_vault_proxy_payment_router_data_v1<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -1182,6 +1195,7 @@ pub async fn construct_payment_router_data_for_capture<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -1322,6 +1336,7 @@ pub async fn construct_router_data_for_psync<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -1679,6 +1694,7 @@ pub async fn construct_payment_router_data_for_sdk_session<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -1768,6 +1784,14 @@ pub async fn construct_payment_router_data_for_setup_mandate<'a>(
.clone()
.map(types::BrowserInformation::from);
+ // Account funded transaction details are merchant supplied and are always read
+ // from the payment intent, never from the confirm request.
+ let recipient_details = payment_data
+ .payment_intent
+ .get_recipient_details()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse recipient details")?;
+
// TODO: few fields are repeated in both routerdata and request
let request = types::SetupMandateRequestData {
currency: payment_data.payment_intent.amount_details.currency,
@@ -1819,6 +1843,8 @@ pub async fn construct_payment_router_data_for_setup_mandate<'a>(
connector_intent_metadata: None,
merchant_order_reference_id: None,
mit_category: None,
+ is_account_funded_transaction: payment_data.payment_intent.is_account_funded_transaction,
+ recipient_details,
};
let connector_mandate_request_reference_id = payment_data
.payment_attempt
@@ -1907,6 +1933,7 @@ pub async fn construct_payment_router_data_for_setup_mandate<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -2243,6 +2270,12 @@ where
feature_data,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: payment_data
+ .payment_intent
+ .get_intent_customer_details()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse customer details")?
+ .and_then(|customer_details| customer_details.date_of_birth),
};
Ok(router_data)
@@ -2467,6 +2500,7 @@ pub async fn construct_payment_router_data_for_update_metadata<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -2923,6 +2957,12 @@ where
mandate_type.as_ref(),
);
+ let masked_recipient_details = payment_intent
+ .get_recipient_details()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse recipient details")?
+ .map(api_models::payments::MaskedRecipientDetails::from);
+
Ok(services::ApplicationResponse::JsonWithHeaders((
Self {
id: payment_intent.id.clone(),
@@ -2979,6 +3019,8 @@ where
.request_external_three_ds_authentication,
payment_type,
enable_partial_authorization: Some(payment_intent.enable_partial_authorization),
+ is_account_funded_transaction: payment_intent.is_account_funded_transaction,
+ recipient_details: masked_recipient_details,
},
vec![],
)))
@@ -4274,6 +4316,11 @@ where
payment_attempt.get_connector_response_metadata_from_attempt_metadata();
let applied_offer = applied_offer_response(payment_attempt.applied_offer_details.clone());
+ let masked_recipient_details = payment_intent
+ .get_recipient_details()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse recipient details")?
+ .map(api_models::payments::MaskedRecipientDetails::from);
let payments_response = api::PaymentsResponse {
payment_id: payment_intent.payment_id,
merchant_id: payment_intent.merchant_id,
@@ -4418,6 +4465,8 @@ where
is_stored_credential: payment_attempt.is_stored_credential,
request_extended_authorization: payment_attempt.request_extended_authorization,
billing_descriptor: payment_intent.billing_descriptor,
+ is_account_funded_transaction: payment_intent.is_account_funded_transaction,
+ recipient_details: masked_recipient_details,
partner_merchant_identifier_details: payment_intent.partner_merchant_identifier_details,
payment_method_tokenization_details,
installment_options: payment_intent.installment_options,
@@ -4676,6 +4725,14 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Pay
None
}
});
+ let masked_recipient_details = pi
+ .get_recipient_details()
+ .inspect_err(|error| {
+ router_env::logger::error!(?error, "Failed to parse recipient details")
+ })
+ .ok()
+ .flatten()
+ .map(api_models::payments::MaskedRecipientDetails::from);
Self {
connector_response_metadata: pa.get_connector_response_metadata_from_attempt_metadata(),
applied_offer: applied_offer_response(pa.applied_offer_details.clone()),
@@ -4828,6 +4885,8 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Pay
is_stored_credential:pa.is_stored_credential,
request_extended_authorization: pa.request_extended_authorization,
billing_descriptor: pi.billing_descriptor,
+ is_account_funded_transaction: pi.is_account_funded_transaction,
+ recipient_details: masked_recipient_details,
partner_merchant_identifier_details: pi.partner_merchant_identifier_details,
payment_method_tokenization_details: None,
installment_options: pi.installment_options,
@@ -5142,6 +5201,14 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
let customer_id = additional_data.customer_id.clone();
+ // Account funded transaction details are merchant supplied and are always read
+ // from the payment intent, never from the confirm request.
+ let recipient_details = payment_data
+ .payment_intent
+ .get_recipient_details()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse recipient details")?;
+
let merchant_order_reference_id = payment_data
.payment_intent
.merchant_reference_id
@@ -5210,6 +5277,10 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
feature_metadata: None,
installment_details: None,
connector_intent_metadata: None,
+ is_account_funded_transaction: payment_data
+ .payment_intent
+ .is_account_funded_transaction,
+ recipient_details,
})
}
}
@@ -5398,6 +5469,14 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
let billing_descriptor = payment_data.payment_intent.get_billing_descriptor();
+ // Account funded transaction details are merchant supplied and are always read
+ // from the payment intent, never from the confirm request.
+ let recipient_details = payment_data
+ .payment_intent
+ .get_recipient_details()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse recipient details")?;
+
Ok(Self {
payment_method_data: (payment_method_data.get_required_value("payment_method_data")?),
setup_future_usage: payment_data
@@ -5480,6 +5559,10 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::PaymentsAuthoriz
feature_metadata,
installment_details: payment_data.payment_attempt.installment_data.clone(),
connector_intent_metadata,
+ is_account_funded_transaction: payment_data
+ .payment_intent
+ .is_account_funded_transaction,
+ recipient_details,
})
}
}
@@ -7039,6 +7122,14 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SetupMandateRequ
let billing_descriptor = payment_data.payment_intent.get_billing_descriptor();
+ // Account funded transaction details are merchant supplied and are always read
+ // from the payment intent, never from the confirm request.
+ let recipient_details = payment_data
+ .payment_intent
+ .get_recipient_details()
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to parse recipient details")?;
+
let merchant_order_reference_id = payment_data
.payment_intent
.merchant_order_reference_id
@@ -7124,6 +7215,10 @@ impl<F: Clone> TryFrom<PaymentAdditionalData<'_, F>> for types::SetupMandateRequ
.transpose()?,
merchant_order_reference_id,
mit_category: payment_data.payment_intent.mit_category,
+ is_account_funded_transaction: payment_data
+ .payment_intent
+ .is_account_funded_transaction,
+ recipient_details,
})
}
}
@@ -7434,6 +7529,7 @@ impl ForeignFrom<CustomerDetails> for router_request_types::CustomerDetails {
phone_country_code: customer.phone_country_code,
tax_registration_id: customer.tax_registration_id,
document_details: customer.document_details,
+ date_of_birth: customer.date_of_birth,
}
}
}
@@ -8278,6 +8374,7 @@ pub async fn construct_payment_router_data_for_update_post_confirm<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 44b6d7964d..845e9af9a9 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -1582,6 +1582,7 @@ pub(super) fn get_customer_details_from_request(
phone_country_code: customer_phone_code,
tax_registration_id,
document_details,
+ date_of_birth: None,
}
}
diff --git a/crates/router/src/core/relay/utils.rs b/crates/router/src/core/relay/utils.rs
index bca80c115d..06a0c945c1 100644
--- a/crates/router/src/core/relay/utils.rs
+++ b/crates/router/src/core/relay/utils.rs
@@ -154,6 +154,7 @@ pub async fn construct_relay_refund_router_data<F>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -295,6 +296,7 @@ pub async fn construct_relay_capture_router_data(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -420,6 +422,7 @@ pub async fn construct_relay_incremental_authorization_router_data(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -554,6 +557,7 @@ pub async fn construct_relay_void_router_data(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -702,6 +706,7 @@ pub async fn construct_relay_payments_retrieve_router_data(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
diff --git a/crates/router/src/core/revenue_recovery.rs b/crates/router/src/core/revenue_recovery.rs
index 30dac9e5c4..78e936e0ff 100644
--- a/crates/router/src/core/revenue_recovery.rs
+++ b/crates/router/src/core/revenue_recovery.rs
@@ -791,7 +791,7 @@ pub async fn perform_calculate_workflow(
})
.flatten()
.async_map(|(event_kind, response)| async move {
- let _ = RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
+ let _ = Box::pin(RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
state,
common_enums::EventClass::Payments,
event_kind,
@@ -800,7 +800,7 @@ pub async fn perform_calculate_workflow(
profile,
tracking_data.payment_attempt_id.get_string_repr().to_string(),
response
- )
+ ))
.await
.map_err(|e| {
logger::error!(
diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs
index fec5d46115..1df5e66420 100644
--- a/crates/router/src/core/revenue_recovery/types.rs
+++ b/crates/router/src/core/revenue_recovery/types.rs
@@ -207,7 +207,7 @@ impl RevenueRecoveryPaymentIntentStatus {
.change_context(errors::RecoveryError::PaymentsResponseGenerationFailed)
.attach_printable("Failed while generating response for payment")?;
- RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
+ Box::pin(RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
state,
common_enums::EventClass::Payments,
event_status,
@@ -219,7 +219,7 @@ impl RevenueRecoveryPaymentIntentStatus {
.get_string_repr()
.to_string(),
payments_response
- )
+ ))
.await?;
// Record a successful transaction back to Billing Connector
@@ -286,7 +286,7 @@ impl RevenueRecoveryPaymentIntentStatus {
))
.await?;
- RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
+ Box::pin(RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
state,
common_enums::EventClass::Payments,
event_status,
@@ -298,7 +298,7 @@ impl RevenueRecoveryPaymentIntentStatus {
.get_string_repr()
.to_string(),
payments_response
- )
+ ))
.await?;
}
Self::Failed => {
@@ -646,7 +646,7 @@ impl Action {
.change_context(errors::RecoveryError::PaymentsResponseGenerationFailed)
.attach_printable("Failed while generating response for payment")?;
- RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
+ Box::pin(RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
state,
common_enums::EventClass::Payments,
event_status,
@@ -655,7 +655,7 @@ impl Action {
profile,
payment_data.payment_attempt.id.get_string_repr().to_string(),
payments_response
- )
+ ))
.await?;
Ok(Self::SuccessfulPayment(
@@ -689,7 +689,7 @@ impl Action {
.change_context(errors::RecoveryError::PaymentsResponseGenerationFailed)
.attach_printable("Failed while generating response for payment")?;
- RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
+ Box::pin(RevenueRecoveryOutgoingWebhook::send_outgoing_webhook_based_on_revenue_recovery_status(
state,
common_enums::EventClass::Payments,
event_status,
@@ -698,7 +698,7 @@ impl Action {
profile,
payment_data.payment_attempt.id.get_string_repr().to_string(),
payments_response
- )
+ ))
.await?;
Ok(Self::PartialCharged)
diff --git a/crates/router/src/core/unified_authentication_service.rs b/crates/router/src/core/unified_authentication_service.rs
index 40c1164f69..5b9a7e6c62 100644
--- a/crates/router/src/core/unified_authentication_service.rs
+++ b/crates/router/src/core/unified_authentication_service.rs
@@ -932,6 +932,7 @@ impl
phone_country_code: details.phone_country_code,
tax_registration_id: details.tax_registration_id,
document_details: details.customer_document_details,
+ date_of_birth: details.date_of_birth,
})
} else {
None
diff --git a/crates/router/src/core/unified_authentication_service/utils.rs b/crates/router/src/core/unified_authentication_service/utils.rs
index a57ea560fc..247f642755 100644
--- a/crates/router/src/core/unified_authentication_service/utils.rs
+++ b/crates/router/src/core/unified_authentication_service/utils.rs
@@ -152,6 +152,7 @@ pub fn construct_uas_router_data<F: Clone, Req, Res>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
})
}
@@ -722,6 +723,7 @@ pub fn construct_uas_webhook_router_data<F: Clone, Req, Res>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
})
}
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index e007cd6fbc..876e93e493 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -311,6 +311,7 @@ pub async fn construct_payout_router_data<'a, F>(
phone_country_code: c.phone_country_code,
tax_registration_id: c.tax_registration_id.map(Encryptable::into_inner),
document_details: None,
+ date_of_birth: None,
}),
connector_transfer_method_id,
webhook_url: Some(webhook_url),
@@ -359,6 +360,7 @@ pub async fn construct_payout_router_data<'a, F>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -542,6 +544,7 @@ pub async fn construct_refund_router_data<'a, F>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -744,6 +747,7 @@ pub async fn construct_refund_router_data<'a, F>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
@@ -1266,6 +1270,7 @@ pub async fn construct_accept_dispute_router_data<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
}
@@ -1379,6 +1384,7 @@ pub async fn construct_submit_evidence_router_data<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
}
@@ -1498,6 +1504,7 @@ pub async fn construct_upload_file_router_data<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
}
@@ -1578,6 +1585,7 @@ pub async fn construct_dispute_list_router_data<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
})
}
@@ -1693,6 +1701,7 @@ pub async fn construct_dispute_sync_router_data<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
}
@@ -1831,6 +1840,7 @@ pub async fn construct_payments_dynamic_tax_calculation_router_data<F: Clone>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
}
@@ -1947,6 +1957,7 @@ pub async fn construct_defend_dispute_router_data<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
}
@@ -2053,6 +2064,7 @@ pub async fn construct_retrieve_file_router_data<'a>(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
}
diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rs
index 86a4b59bff..c488278ef2 100644
--- a/crates/router/src/core/webhooks/utils.rs
+++ b/crates/router/src/core/webhooks/utils.rs
@@ -144,6 +144,7 @@ pub async fn construct_webhook_router_data(
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
};
Ok(router_data)
}
diff --git a/crates/router/src/db/events.rs b/crates/router/src/db/events.rs
index 5bd4eef98d..ccb5a156e5 100644
--- a/crates/router/src/db/events.rs
+++ b/crates/router/src/db/events.rs
@@ -2212,6 +2212,8 @@ mod tests {
is_stored_credential: None,
request_extended_authorization: None,
billing_descriptor: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
partner_merchant_identifier_details: None,
payment_method_tokenization_details: None,
error_details: None,
diff --git a/crates/router/src/services/kafka/payment_intent.rs b/crates/router/src/services/kafka/payment_intent.rs
index 719c0ccb72..2f3090980f 100644
--- a/crates/router/src/services/kafka/payment_intent.rs
+++ b/crates/router/src/services/kafka/payment_intent.rs
@@ -250,6 +250,8 @@ impl<'a> KafkaPaymentIntent<'a> {
profile_acquirer_id: _,
external_surcharge_strategy: _,
external_surcharge_applicable: _,
+ is_account_funded_transaction: _,
+ recipient_details: _,
} = intent;
Self {
diff --git a/crates/router/src/services/kafka/payment_intent_event.rs b/crates/router/src/services/kafka/payment_intent_event.rs
index 5e4c2ba17b..e8fff4653d 100644
--- a/crates/router/src/services/kafka/payment_intent_event.rs
+++ b/crates/router/src/services/kafka/payment_intent_event.rs
@@ -264,6 +264,8 @@ impl<'a> KafkaPaymentIntentEvent<'a> {
profile_acquirer_id: _,
external_surcharge_strategy: _,
external_surcharge_applicable: _,
+ is_account_funded_transaction: _,
+ recipient_details: _,
} = intent;
Self {
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index b78d1e237e..c2e391a02b 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -1441,6 +1441,8 @@ impl ForeignFrom<&SetupMandateRouterData> for PaymentsAuthorizeData {
is_stored_credential: data.request.is_stored_credential,
mit_category: None,
billing_descriptor: data.request.billing_descriptor.clone(),
+ is_account_funded_transaction: data.request.is_account_funded_transaction,
+ recipient_details: data.request.recipient_details.clone(),
tokenization: None,
partner_merchant_identifier_details: data
.request
@@ -1521,6 +1523,7 @@ impl<F1, F2, T1, T2> ForeignFrom<(&RouterData<F1, T1, PaymentsResponseData>, T2)
feature_data: data.feature_data.clone(),
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: data.customer_date_of_birth.clone(),
}
}
}
@@ -1598,6 +1601,7 @@ impl<F1, F2>
feature_data: data.feature_data.clone(),
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
}
}
}
diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs
index abcaa5623e..fc9ff37d6a 100644
--- a/crates/router/src/types/api/verify_connector.rs
+++ b/crates/router/src/types/api/verify_connector.rs
@@ -73,6 +73,8 @@ impl VerifyConnectorData {
is_stored_credential: None,
mit_category: None,
billing_descriptor: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
tokenization: None,
partner_merchant_identifier_details: None,
feature_metadata: None,
@@ -151,6 +153,7 @@ impl VerifyConnectorData {
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
}
}
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 06d8cc8ec2..07d193568a 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -1887,6 +1887,7 @@ impl
}),
customer: Some(CustomerDetails {
name: None,
+ date_of_birth: None,
email: None,
phone: None,
id: None,
diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs
index 4e85492447..26dce7e3db 100644
--- a/crates/router/src/utils/user/sample_data.rs
+++ b/crates/router/src/utils/user/sample_data.rs
@@ -296,6 +296,8 @@ pub async fn generate_sample_data(
enable_overcapture: None,
mit_category: None,
billing_descriptor: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
tokenization: None,
partner_merchant_identifier_details: None,
state_metadata: None,
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 5c0f498552..f1c8e84098 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -476,6 +476,7 @@ pub trait ConnectorActions: Connector {
phone_country_code: Some("+31".to_string()),
tax_registration_id: Some("1232343243".to_string().into()),
document_details: None,
+ date_of_birth: None,
}),
vendor_details: None,
priority: None,
@@ -575,6 +576,7 @@ pub trait ConnectorActions: Connector {
feature_data: None,
sender_payment_instrument_id: None,
connector_returned_payment_method_details: None,
+ customer_date_of_birth: None,
}
}
@@ -1033,6 +1035,8 @@ impl Default for PaymentAuthorizeType {
is_stored_credential: None,
mit_category: None,
billing_descriptor: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
tokenization: None,
partner_merchant_identifier_details: None,
feature_metadata: None,
diff --git a/crates/router/tests/payments.rs b/crates/router/tests/payments.rs
index b15e33a034..022259f52e 100644
--- a/crates/router/tests/payments.rs
+++ b/crates/router/tests/payments.rs
@@ -481,6 +481,8 @@ async fn payments_create_core() {
is_stored_credential: None,
request_extended_authorization: None,
billing_descriptor: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
partner_merchant_identifier_details: None,
payment_method_tokenization_details: None,
error_details: None,
@@ -790,6 +792,8 @@ async fn payments_create_core_adyen_no_redirect() {
is_stored_credential: None,
request_extended_authorization: None,
billing_descriptor: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
partner_merchant_identifier_details: None,
payment_method_tokenization_details: None,
error_details: None,
diff --git a/crates/router/tests/payments2.rs b/crates/router/tests/payments2.rs
index 1802b0df8f..fe78b3b671 100644
--- a/crates/router/tests/payments2.rs
+++ b/crates/router/tests/payments2.rs
@@ -241,6 +241,8 @@ async fn payments_create_core() {
is_stored_credential: None,
request_extended_authorization: None,
billing_descriptor: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
partner_merchant_identifier_details: None,
payment_method_tokenization_details: None,
error_details: None,
@@ -559,6 +561,8 @@ async fn payments_create_core_adyen_no_redirect() {
is_stored_credential: None,
request_extended_authorization: None,
billing_descriptor: None,
+ is_account_funded_transaction: None,
+ recipient_details: None,
partner_merchant_identifier_details: None,
payment_method_tokenization_details: None,
error_details: None,
diff --git a/migrations/2026-08-26-120000_add_aft_details_to_payment_intent/down.sql b/migrations/2026-08-26-120000_add_aft_details_to_payment_intent/down.sql
new file mode 100644
index 0000000000..7c5fcb8cdc
--- /dev/null
+++ b/migrations/2026-08-26-120000_add_aft_details_to_payment_intent/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE payment_intent DROP COLUMN IF EXISTS is_account_funded_transaction;
+ALTER TABLE payment_intent DROP COLUMN IF EXISTS recipient_details;
diff --git a/migrations/2026-08-26-120000_add_aft_details_to_payment_intent/up.sql b/migrations/2026-08-26-120000_add_aft_details_to_payment_intent/up.sql
new file mode 100644
index 0000000000..1a9338e3c3
--- /dev/null
+++ b/migrations/2026-08-26-120000_add_aft_details_to_payment_intent/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS is_account_funded_transaction BOOLEAN DEFAULT NULL;
+ALTER TABLE payment_intent ADD COLUMN IF NOT EXISTS recipient_details BYTEA DEFAULT NULL;