Skip to content

Feature(SDK-106): Add unionpay as a supported network#42

Merged
AbdulazizAlrabiah merged 2 commits into
mainfrom
feat/sdk-105-support-union-pay
May 24, 2026
Merged

Feature(SDK-106): Add unionpay as a supported network#42
AbdulazizAlrabiah merged 2 commits into
mainfrom
feat/sdk-105-support-union-pay

Conversation

@AbdulazizAlrabiah
Copy link
Copy Markdown
Collaborator

@AbdulazizAlrabiah AbdulazizAlrabiah commented May 19, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds UnionPay as a supported card network across the React Native credit card flow and the native Apple Pay / Samsung Pay network mappings.

Changes:

  • Introduces unionpay to CreditCardNetwork, adds UnionPay prefix detection, and surfaces a UnionPay logo in the credit card UI.
  • Updates card-number formatting/validation to allow up to 19 digits (UnionPay) and expands defaults/config fixtures to include unionpay.
  • Extends iOS (Apple Pay) and Android (Samsung Pay) network mapping to recognize unionpay, plus adds/updates tests.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/views/credit_card.tsx Updates card-number input handling, max length, and renders UnionPay logo.
src/services/validators/credit_card_number_validator.ts Adjusts card-number validation to account for UnionPay candidates and 19-digit ranges.
src/models/payment_config.ts Adds unionpay to default supportedNetworks and updates docs.
src/models/credit_card_network.ts Adds unionpay enum member.
src/helpers/formatters.ts Extends formatting regex to support up to 19 digits.
src/helpers/credit_card_utils.ts Adds UnionPay prefix regex + network detection; extends network-string mapping aliases.
src/assets/unionpay.tsx Adds UnionPay SVG asset.
src/assets/index.ts Introduces barrel exports for assets (including UnionPay).
src/tests/services/validators/credit_card_number_validator.test.ts Adds UnionPay validation and supported-networks tests.
src/tests/services/validators/credit_card_cvc_validator.test.ts Adds CVC validation expectations for UnionPay.
src/tests/services/credit_card_payment_service.test.ts Adds UnionPay to “all networks” and validates UnionPay field set.
src/tests/models/payment_request.test.ts Verifies company: 'unionpay' serialization for credit card requests.
src/tests/models/payment_config.test.ts Updates default supported networks expectation to include UnionPay.
src/tests/helpers/formatters.test.ts Adds formatting tests for 19-digit UnionPay numbers.
src/tests/helpers/credit_card_utils.test.ts Adds UnionPay Luhn + network detection + alias mapping tests.
src/tests/fixtures/payment_config_fixture.ts Adds UnionPay to supportedNetworks fixtures.
ios/ReactNativeApplePay/ReactNativePayments.m Maps unionpay to PKPaymentNetworkChinaUnionPay and skips unknown mappings safely.
example/src/App.tsx Updates example config to include unionpay.
android/src/main/java/com/moyasarsdk/samsungpay/SamsungPayButtonViewModel.kt Maps unionpay to Samsung Pay’s ChinaUnionPay brand and lowercases inputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/views/credit_card.tsx
Comment on lines +133 to 135
const cardNetwork = getCreditCardNetworkFromNumber(number);
const cardNumberMaxLength = cardNetwork === CreditCardNetwork.amex ? 17 : 23;

Comment thread src/views/credit_card.tsx
Comment on lines 189 to +193
onChangeText={(value) => {
const cleanNumber = value
.replace(/\s/g, '')
.replace(/[^\d٠-٩]/gi, '')
.slice(0, 16);
.slice(0, 19);
Comment on lines +26 to +30
if (isUnionPayCandidate) {
return value.length < 16 || value.length > 19 || !isValidLuhn(value);
}

return value.length < 15 || value.length > 19 || !isValidLuhn(value);
Comment thread src/__tests__/helpers/credit_card_utils.test.ts Outdated
Copy link
Copy Markdown
Contributor

@sultan-algarbi sultan-algarbi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work overall. Please address the Copilot comments, then proceed with merging and release.

@sultan-algarbi sultan-algarbi changed the title feat: support union pay Feature(SDK-106): Add unionpay as a supported network May 20, 2026
@AbdulazizAlrabiah AbdulazizAlrabiah merged commit 0fe396d into main May 24, 2026
4 of 5 checks passed
@AbdulazizAlrabiah AbdulazizAlrabiah deleted the feat/sdk-105-support-union-pay branch May 24, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants