Skip to content

feat(connector): [tesouro] google pay#9706

Merged
likhinbopanna merged 7 commits intomainfrom
connector/tesouro-googlepay
Oct 7, 2025
Merged

feat(connector): [tesouro] google pay#9706
likhinbopanna merged 7 commits intomainfrom
connector/tesouro-googlepay

Conversation

@pixincreate
Copy link
Member

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

This PR adds support for Google Pay payment method in the Tesouro connector.

Changes

  • Added Google Pay to supported payment methods with refund support enabled
  • Implemented get_goole_pay_data() function to extract and validate Google Pay decrypted data from either payment method token or tokenization data
  • Added TryFrom implementation for (&GooglePayWalletData, Option<&PaymentMethodToken>) to convert Google Pay wallet data to Tesouro payment method details
  • Integrated Google Pay handling in the payment authorization flow to create network token pass-through details with cryptogram, expiry, ECI indicator, and wallet type
  • Updated payment method data matching to handle Google Pay wallet data alongside existing wallet types

Important

Decryption of Google Pay Payment Method Data at Hyperswitch's end cannot be tested unless we get the required Gateway and GatewayMerchantId which is necessary to generate the tokenizationData

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Extends Tesouro connector's wallet payment capabilities to support Google Pay alongside the existing Apple Pay integration, following the same network token pass-through pattern.

How did you test it?

Payment Create
curl --location 'https://base_url/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Accept-Language: ja' \
--header 'api-key: dev_oDdg3CgZu0bDwQkA1W2UIvF7EeQyUzQQIQ6XdY9kDiwaEUkvPVbgJjGlNQgZXxpz' \
--data-raw '{
    "amount": 1000,
    "currency": "USD",
    "confirm": false,
    "business_country": "US",
    "business_label": "default",
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "StripeCustomer",
    "email": "likhin.bopanna@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
{
	"payment_id": "pay_KCvNqWTotLjCWsSZOefH",
	"merchant_id": "postman_merchant_GHAction_1759821919",
	"status": "requires_payment_method",
	"amount": 1000,
	"net_amount": 1000,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": null,
	"connector": null,
	"client_secret": "pay_KCvNqWTotLjCWsSZOefH_secret_7d8PHz5pDfknfo6aynG7",
	"created": "2025-10-07T07:44:08.680Z",
	"currency": "USD",
	"customer_id": "StripeCustomer",
	"customer": {
		"id": "StripeCustomer",
		"name": "John Doe",
		"email": "likhin.bopanna@gmail.com",
		"phone": "999999999",
		"phone_country_code": "+65"
	},
	"description": "Its my first payment request",
	"refunds": null,
	"disputes": null,
	"mandate_id": null,
	"mandate_data": null,
	"setup_future_usage": null,
	"off_session": null,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": null,
	"payment_method_data": null,
	"payment_token": null,
	"shipping": null,
	"billing": null,
	"order_details": null,
	"email": "likhin.bopanna@gmail.com",
	"name": "John Doe",
	"phone": "999999999",
	"return_url": "https://google.com/",
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": "joseph",
	"statement_descriptor_suffix": "JS",
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": null,
	"connector_label": null,
	"business_country": "US",
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": {
		"customer_id": "StripeCustomer",
		"created_at": 1759823048,
		"expires": 1759826648,
		"secret": "epk_457e74f79de04b57941e91179f439cbc"
	},
	"manual_retry_allowed": null,
	"connector_transaction_id": null,
	"frm_message": null,
	"metadata": {
		"udf1": "value1",
		"login_date": "2019-09-10T10:11:12Z",
		"new_customer": "true"
	},
	"connector_metadata": null,
	"feature_metadata": null,
	"reference_id": null,
	"payment_link": null,
	"profile_id": "pro_bN425ADwv1vuxah9eH5S",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": null,
	"incremental_authorization_allowed": null,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-10-07T07:59:08.680Z",
	"fingerprint": null,
	"browser_info": null,
	"payment_channel": null,
	"payment_method_id": null,
	"network_transaction_id": null,
	"payment_method_status": null,
	"updated": "2025-10-07T07:44:08.704Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"request_extended_authorization": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": null,
	"card_discovery": null,
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null,
	"enable_overcapture": null,
	"is_overcapture_enabled": null,
	"network_details": null,
	"is_stored_credential": null,
	"mit_category": null
}
Payment Confirm (Predecrypted)
curl --location 'https://base_url/payments/pay_KCvNqWTotLjCWsSZOefH/confirm' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_oDdg3CgZu0bDwQkA1W2UIvF7EeQyUzQQIQ6XdY9kDiwaEUkvPVbgJjGlNQgZXxpz' \
--data '{
	"confirm": true,
	"payment_method": "wallet",
	"payment_method_type": "google_pay",
	"payment_method_data": {
		"wallet": {
			"google_pay": {
				"type": "CARD",
				"tokenization_data": {
					"application_primary_account_number": "4761344136141390",
					"card_exp_month": "12",
					"card_exp_year": "25",
					"cryptogram": "ejJRskdjfgbdskjgbrjhgbrjghriuU=",
					"eci_indicator": "5"
				},
				"info": {
					"card_details": "Discover 9319",
					"card_network": "VISA"
				},
				"description": "something"
			}
		}
	},
	"browser_info": {
		"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
		"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"language": "nl-NL",
		"color_depth": 24,
		"screen_height": 723,
		"screen_width": 1536,
		"time_zone": 0,
		"java_enabled": true,
		"java_script_enabled": true,
		"ip_address": "127.0.0.1"
	},
	"billing": {
		"address": {
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "California",
			"zip": "94122",
			"country": "US",
			"first_name": "John",
			"last_name": "Doe"
		}
	},
	"shipping": {
		"address": {
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"city": "San Fransico",
			"state": "California",
			"zip": "94122",
			"country": "US",
			"first_name": "John",
			"last_name": "Doe"
		}
	}
}'
{
	"payment_id": "pay_KCvNqWTotLjCWsSZOefH",
	"merchant_id": "postman_merchant_GHAction_1759821919",
	"status": "succeeded",
	"amount": 1000,
	"net_amount": 1000,
	"shipping_cost": null,
	"amount_capturable": 0,
	"amount_received": 1000,
	"connector": "tesouro",
	"client_secret": "pay_KCvNqWTotLjCWsSZOefH_secret_7d8PHz5pDfknfo6aynG7",
	"created": "2025-10-07T07:44:08.680Z",
	"currency": "USD",
	"customer_id": "StripeCustomer",
	"customer": {
		"id": "StripeCustomer",
		"name": "John Doe",
		"email": "likhin.bopanna@gmail.com",
		"phone": "999999999",
		"phone_country_code": "+65"
	},
	"description": "Its my first payment request",
	"refunds": null,
	"disputes": null,
	"mandate_id": null,
	"mandate_data": null,
	"setup_future_usage": null,
	"off_session": null,
	"capture_on": null,
	"capture_method": "automatic",
	"payment_method": "wallet",
	"payment_method_data": {
		"wallet": {
			"google_pay": {
				"last4": "Discover 9319",
				"card_network": "VISA",
				"type": "CARD"
			}
		},
		"billing": null
	},
	"payment_token": null,
	"shipping": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "California",
			"first_name": "John",
			"last_name": "Doe",
			"origin_zip": null
		},
		"phone": null,
		"email": null
	},
	"billing": {
		"address": {
			"city": "San Fransico",
			"country": "US",
			"line1": "1467",
			"line2": "Harrison Street",
			"line3": "Harrison Street",
			"zip": "94122",
			"state": "California",
			"first_name": "John",
			"last_name": "Doe",
			"origin_zip": null
		},
		"phone": null,
		"email": null
	},
	"order_details": null,
	"email": "likhin.bopanna@gmail.com",
	"name": "John Doe",
	"phone": "999999999",
	"return_url": "https://google.com/",
	"authentication_type": "no_three_ds",
	"statement_descriptor_name": "joseph",
	"statement_descriptor_suffix": "JS",
	"next_action": null,
	"cancellation_reason": null,
	"error_code": null,
	"error_message": null,
	"unified_code": null,
	"unified_message": null,
	"payment_experience": null,
	"payment_method_type": "google_pay",
	"connector_label": "tesouro_US_default",
	"business_country": "US",
	"business_label": "default",
	"business_sub_label": null,
	"allowed_payment_method_types": null,
	"ephemeral_key": null,
	"manual_retry_allowed": null,
	"connector_transaction_id": "d421ed3e-a351-11f0-ae3d-fce2946c9735",
	"frm_message": null,
	"metadata": {
		"udf1": "value1",
		"login_date": "2019-09-10T10:11:12Z",
		"new_customer": "true"
	},
	"connector_metadata": null,
	"feature_metadata": {
		"redirect_response": null,
		"search_tags": null,
		"apple_pay_recurring_details": null,
		"gateway_system": "direct"
	},
	"reference_id": null,
	"payment_link": null,
	"profile_id": "pro_bN425ADwv1vuxah9eH5S",
	"surcharge_details": null,
	"attempt_count": 1,
	"merchant_decision": null,
	"merchant_connector_id": "mca_FxLj3pu6AjtYlYJ2n13Y",
	"incremental_authorization_allowed": false,
	"authorization_count": null,
	"incremental_authorizations": null,
	"external_authentication_details": null,
	"external_3ds_authentication_attempted": false,
	"expires_on": "2025-10-07T07:59:08.680Z",
	"fingerprint": null,
	"browser_info": {
		"os_type": null,
		"referer": null,
		"language": "nl-NL",
		"time_zone": 0,
		"ip_address": "127.0.0.1",
		"os_version": null,
		"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
		"color_depth": 24,
		"device_model": null,
		"java_enabled": true,
		"screen_width": 1536,
		"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
		"screen_height": 723,
		"accept_language": "en",
		"java_script_enabled": true
	},
	"payment_channel": null,
	"payment_method_id": null,
	"network_transaction_id": null,
	"payment_method_status": null,
	"updated": "2025-10-07T07:47:09.597Z",
	"split_payments": null,
	"frm_metadata": null,
	"extended_authorization_applied": null,
	"request_extended_authorization": null,
	"capture_before": null,
	"merchant_order_reference_id": null,
	"order_tax_amount": null,
	"connector_mandate_id": null,
	"card_discovery": null,
	"force_3ds_challenge": false,
	"force_3ds_challenge_trigger": false,
	"issuer_error_code": null,
	"issuer_error_message": null,
	"is_iframe_redirection_enabled": null,
	"whole_connector_response": null,
	"enable_partial_authorization": null,
	"enable_overcapture": null,
	"is_overcapture_enabled": null,
	"network_details": null,
	"is_stored_credential": null,
	"mit_category": null
}

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by just clippy && just clippy_v2
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

…esouro-googlepay

* 'main' of github.com:juspay/hyperswitch:
  feat(connector): [tesouro] apple pay (#9648)
  fix(payments): update error handling for payment void v2 (#9595)
  fix(connectors): [Nexixpay] MIT & order_id fix (#9644)
  chore(version): 2025.10.07.0
  fix(database): percent-encode spaces in Postgres connection URI (#9685)
  chore(version): 2025.10.06.0
  feat(subscriptions): Invoice record back workflow (#9529)
  feat: Implement subscriptions workflow and incoming webhook support (#9400)
  Feat(Customer): Added search Feature to the Customer Page (#9619)
  chore(version): 2025.10.02.0
  feat(subscription): Add support to call payments microservice from subscription service via payments API client (#9590)
@pixincreate pixincreate added this to the July 2025 Release milestone Oct 7, 2025
@pixincreate pixincreate self-assigned this Oct 7, 2025
@pixincreate pixincreate added A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Oct 7, 2025
@semanticdiff-com
Copy link

semanticdiff-com bot commented Oct 7, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/tesouro/transformers.rs  8% smaller
  crates/connector_configs/toml/development.toml Unsupported file format
  crates/connector_configs/toml/production.toml Unsupported file format
  crates/connector_configs/toml/sandbox.toml Unsupported file format
  crates/hyperswitch_connectors/src/connectors/tesouro.rs  0% smaller

@pixincreate pixincreate marked this pull request as ready for review October 7, 2025 08:45
@pixincreate pixincreate requested a review from a team as a code owner October 7, 2025 08:45
@pixincreate pixincreate linked an issue Oct 7, 2025 that may be closed by this pull request
@likhinbopanna likhinbopanna added this pull request to the merge queue Oct 7, 2025
Merged via the queue into main with commit 916444b Oct 7, 2025
21 of 25 checks passed
@likhinbopanna likhinbopanna deleted the connector/tesouro-googlepay branch October 7, 2025 15:14
@pixincreate pixincreate removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Oct 7, 2025
UdayPandey01 pushed a commit to UdayPandey01/hyperswitch that referenced this pull request Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-connector-integration Area: Connector integration C-feature Category: Feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] (tesouro) add wallet support

4 participants