Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
get Stripe() {
deprecatedModule(
`DangerZone.Stripe -> import { PaymentsStripe } from 'expo-payments-stripe'`,
'DangerZone.Stripe',
'expo-payments-stripe'
);
return require('expo-payments-stripe').PaymentsStripe;
},
get DeviceMotion() {
get Stripe() {
deprecatedModule(`DangerZone.Stripe -> import { PaymentsStripe } from 'expo-payments-stripe'`, 'DangerZone.Stripe', 'expo-payments-stripe');
return require('expo-payments-stripe').PaymentsStripe;
},
get DeviceMotion() {
async componentWillMount() {
await Stripe.setOptionsAsync({
publishableKey: 'pk_test_M315xbWEvSQjt7B8ZJYzuipC',
androidPayMode: 'test',
merchantId: 'merchant.host.exp.exponent',
});
const allowed = await Stripe.deviceSupportsApplePayAsync();
const amexAvailable = await Stripe.canMakeApplePayPaymentsAsync({
networks: ['american_express'],
});
const discoverAvailable = await Stripe.canMakeApplePayPaymentsAsync({
networks: ['discover'],
});
const masterCardAvailable = await Stripe.canMakeApplePayPaymentsAsync({
networks: ['master_card'],
});
const visaAvailable = await Stripe.canMakeApplePayPaymentsAsync({
networks: ['visa'],
componentWillMount() {
Stripe.setOptionsAsync({
publishableKey: 'pk_test_M315xbWEvSQjt7B8ZJYzuipC',
androidPayMode: 'test',
});
}
async componentWillMount() {
await Stripe.setOptionsAsync({
publishableKey: 'pk_test_M315xbWEvSQjt7B8ZJYzuipC',
androidPayMode: 'test',
merchantId: 'merchant.host.exp.exponent',
});
const allowed = await Stripe.deviceSupportsApplePayAsync();
const amexAvailable = await Stripe.canMakeApplePayPaymentsAsync({
networks: ['american_express'],
});
const discoverAvailable = await Stripe.canMakeApplePayPaymentsAsync({
networks: ['discover'],
});
const masterCardAvailable = await Stripe.canMakeApplePayPaymentsAsync({
networks: ['master_card'],
});
const visaAvailable = await Stripe.canMakeApplePayPaymentsAsync({
networks: ['visa'],
});
this.setState({
allowed,
amexAvailable,
discoverAvailable,
masterCardAvailable,
id: 'fedex',
label: 'FedEX',
detail: 'Test @ 10',
amount: '1.00',
},
],
}
);
this.setState({ loading: false, token });
if (this.state.complete) {
await Stripe.completeApplePayRequestAsync();
this.setState({ status: 'Apple Pay payment completed' });
} else {
await Stripe.cancelApplePayRequestAsync();
this.setState({ status: 'Apple Pay payment cenceled' });
}
} catch (error) {
this.setState({ loading: false, status: `Error: ${error.message}` });
}
};
//requiredShippingAddressFields: ['all'],
shippingMethods: [
{
id: 'fedex',
label: 'FedEX',
detail: 'Test @ 10',
amount: '1.00',
},
],
}
);
this.setState({ loading: false, token });
if (this.state.complete) {
await Stripe.completeApplePayRequestAsync();
this.setState({ status: 'Apple Pay payment completed' });
} else {
await Stripe.cancelApplePayRequestAsync();
this.setState({ status: 'Apple Pay payment cenceled' });
}
} catch (error) {
this.setState({ loading: false, status: `Error: ${error.message}` });
}
};
handleCreateSourcePress = async () => {
try {
this.setState({ loading: true, source: null });
const source = await Stripe.createSourceWithParamsAsync({
type: 'alipay',
amount: 50,
currency: 'EUR',
returnURL: Linking.makeUrl('source'),
});
this.setState({ loading: false, source });
} catch (error) {
this.setState({ loading: false });
}
};
async componentWillMount() {
await Stripe.setOptionsAsync({
publishableKey: 'pk_test_M315xbWEvSQjt7B8ZJYzuipC',
androidPayMode: 'test',
merchantId: 'merchant.host.exp.exponent',
});
const allowed = await Stripe.deviceSupportsApplePayAsync();
const amexAvailable = await Stripe.canMakeApplePayPaymentsAsync({
networks: ['american_express'],
});
const discoverAvailable = await Stripe.canMakeApplePayPaymentsAsync({
networks: ['discover'],
});
const masterCardAvailable = await Stripe.canMakeApplePayPaymentsAsync({
networks: ['master_card'],
});
const visaAvailable = await Stripe.canMakeApplePayPaymentsAsync({
networks: ['visa'],
});
this.setState({
allowed,
amexAvailable,
discoverAvailable,
handleSetupApplePayPress = () => Stripe.openApplePaySetupAsync();