mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
♻️ Use EnvironmentConfig in ConnectionUrlGenerator
This commit is contained in:
parent
a1f80f1d3d
commit
3f691bea01
6 changed files with 54 additions and 85 deletions
|
@ -153,7 +153,7 @@ export const persist = function* () {
|
|||
export const sandboxOnboardingUrl = function* () {
|
||||
return yield {
|
||||
type: ACTION_TYPES.DO_GENERATE_ONBOARDING_URL,
|
||||
environment: 'sandbox',
|
||||
useSandbox: true,
|
||||
products: [ 'EXPRESS_CHECKOUT' ],
|
||||
};
|
||||
};
|
||||
|
@ -167,7 +167,7 @@ export const sandboxOnboardingUrl = function* () {
|
|||
export const productionOnboardingUrl = function* ( products = [] ) {
|
||||
return yield {
|
||||
type: ACTION_TYPES.DO_GENERATE_ONBOARDING_URL,
|
||||
environment: 'production',
|
||||
useSandbox: false,
|
||||
products,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -36,13 +36,13 @@ export const controls = {
|
|||
|
||||
async [ ACTION_TYPES.DO_GENERATE_ONBOARDING_URL ]( {
|
||||
products,
|
||||
environment,
|
||||
useSandbox,
|
||||
} ) {
|
||||
try {
|
||||
return apiFetch( {
|
||||
path: REST_CONNECTION_URL_PATH,
|
||||
method: 'POST',
|
||||
data: { environment, products },
|
||||
data: { useSandbox, products },
|
||||
} );
|
||||
} catch ( e ) {
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue