Skip to content

Commit

Permalink
fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
charliecruzan-stripe committed Dec 2, 2022
1 parent e2456c1 commit afe48d0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 45 deletions.
36 changes: 3 additions & 33 deletions example/src/screens/ApplePayScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import React, { useState } from 'react';
import { Alert, StyleSheet, Text, View } from 'react-native';
import {
<<<<<<< HEAD
PlatformPay,
=======
ApplePayButton,
useApplePay,
ApplePay,
>>>>>>> 7a9c9d6 (revert unnecessary changes)
AddToWalletButton,
Constants,
canAddCardToWallet,
Expand Down Expand Up @@ -332,6 +326,7 @@ export default function ApplePayScreen() {
<AddToWalletButton
androidAssetSource={{}}
testEnv={true}
style={styles.payButton}
iOSButtonStyle="onLightBackground"
cardDetails={{
name: cardDetails?.cardholder?.name,
Expand All @@ -350,33 +345,8 @@ export default function ApplePayScreen() {
);
}}
/>

{showAddToWalletButton && (
<AddToWalletButton
androidAssetSource={{}}
testEnv={true}
style={styles.payButton}
iOSButtonStyle="onLightBackground"
cardDetails={{
name: cardDetails?.cardholder?.name,
primaryAccountIdentifier:
cardDetails?.wallets?.primary_account_identifier,
lastFour: cardDetails?.last4,
description: 'Added by Stripe',
}}
ephemeralKey={ephemeralKey}
onComplete={({ error }) => {
Alert.alert(
error ? error.code : 'Success',
error
? error.message
: 'Card was successfully added to the wallet.'
);
}}
/>
)}
</View>
)}
)}
</View>
</PaymentScreen>
);
}
Expand Down
20 changes: 10 additions & 10 deletions src/types/PlatformPay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ export type ApplePaySheetError =
message?: string;
};

export const enum ApplePaySheetErrorType {
export enum ApplePaySheetErrorType {
InvalidShippingAddress = 'InvalidShippingAddress',
UnserviceableShippingAddress = 'UnserviceableShippingAddress',
InvalidCouponCode = 'InvalidCouponCode',
ExpiredCouponCode = 'ExpiredCouponCode',
}

export const enum ContactField {
export enum ContactField {
EmailAddress = 'emailAddress',
Name = 'name',
PhoneNumber = 'phoneNumber',
PhoneticName = 'phoneticName',
PostalAddress = 'postalAddress',
}

export const enum InvalidShippingField {
export enum InvalidShippingField {
Street = 'street',
City = 'city',
SubAdministrativeArea = 'subAdministrativeArea',
Expand Down Expand Up @@ -76,7 +76,7 @@ export type ApplePayPaymentMethodParams = {
couponCode?: string;
};

export const enum ApplePayMerchantCapability {
export enum ApplePayMerchantCapability {
/** Required. This value must be supplied. */
Supports3DS = 'supports3DS',
/** Optional. If present, only transactions that are categorized as credit cards are allowed. */
Expand All @@ -86,7 +86,7 @@ export const enum ApplePayMerchantCapability {
}

/** A type that indicates how to ship purchased items. */
export const enum ApplePayShippingType {
export enum ApplePayShippingType {
/** Default. */
Shipping = 'shipping',
Delivery = 'delivery',
Expand Down Expand Up @@ -140,7 +140,7 @@ export type GooglePayPaymentMethodParams = {
};
};

export const enum BillingAddressFormat {
export enum BillingAddressFormat {
/** Collect name, street address, locality, region, country code, and postal code. */
Full = 'FULL',
/** Collect name, country code, and postal code (default). */
Expand All @@ -161,7 +161,7 @@ export type ConfirmParams = {
applePay?: ApplePayBaseParams;
};

export const enum ButtonType {
export enum ButtonType {
/** A button with the Apple Pay or Google Pay logo only, useful when an additional call to action isn't needed. */
Default = 0,
/** A button useful for product purchases. */
Expand Down Expand Up @@ -203,7 +203,7 @@ export const enum ButtonType {
}

/** iOS only. */
export const enum ButtonStyle {
export enum ButtonStyle {
/** A white button with black lettering. */
White = 0,
/** A white button with black lettering and a black outline. */
Expand All @@ -221,7 +221,7 @@ export type CartSummaryItem =
| RecurringCartSummaryItem;

/** iOS only. */
export const enum PaymentType {
export enum PaymentType {
Deferred = 'Deferred',
Immediate = 'Immediate',
Recurring = 'Recurring',
Expand Down Expand Up @@ -261,7 +261,7 @@ export type RecurringCartSummaryItem = {
};

/** iOS only. */
export const enum IntervalUnit {
export enum IntervalUnit {
Minute = 'minute',
Hour = 'hour',
Day = 'day',
Expand Down
10 changes: 8 additions & 2 deletions src/types/PushProvisioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type GooglePayCardToken = {
status: GooglePayCardTokenStatus;
};

export const enum GooglePayCardTokenStatus {
export enum GooglePayCardTokenStatus {
/** */
TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION = 'TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION',
/** */
Expand Down Expand Up @@ -43,6 +43,8 @@ export type CanAddCardToWalletParams = {
cardLastFour: string;
/** iOS only. Set this to `true` until shipping through TestFlight || App Store. If true, you must be using live cards, and have the proper iOS entitlement set up. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#requesting-access-for-ios */
testEnv?: boolean;
/** iOS only. Set this to `true` if: your user has an Apple Watch device currently paired, and you want to check that device for the presence of the specified card. */
hasPairedAppleWatch?: boolean;
};

export type CanAddCardToWalletResult =
Expand All @@ -60,11 +62,15 @@ export type CanAddCardToWalletResult =
error: StripeError<GooglePayError>;
};

export const enum CanAddCardToWalletStatus {
export enum CanAddCardToWalletStatus {
/** You are missing configuration required for Push Provisioning. Make sure you've completed all steps at https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native. */
MISSING_CONFIGURATION = 'MISSING_CONFIGURATION',
/** This device doesn't support adding a card to the native wallet. */
UNSUPPORTED_DEVICE = 'UNSUPPORTED_DEVICE',
/** This card already exists on this device and any paired devices. */
CARD_ALREADY_EXISTS = 'CARD_ALREADY_EXISTS',
/** This card already exists on this device, but not on the paired device. */
CARD_EXISTS_ON_CURRENT_DEVICE = 'CARD_EXISTS_ON_CURRENT_DEVICE',
/** This card already exists on the paired device, but not on this device. */
CARD_EXISTS_ON_PAIRED_DEVICE = 'CARD_EXISTS_ON_PAIRED_DEVICE',
}

0 comments on commit afe48d0

Please sign in to comment.