mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
✨ First draft of production login action
This commit is contained in:
parent
2ccc489fd6
commit
8341d4ec0e
4 changed files with 45 additions and 5 deletions
|
@ -12,7 +12,7 @@ import apiFetch from '@wordpress/api-fetch';
|
|||
import {
|
||||
REST_PERSIST_PATH,
|
||||
REST_MANUAL_CONNECTION_PATH,
|
||||
REST_SANDBOX_CONNECTION_PATH,
|
||||
REST_CONNECTION_URL_PATH,
|
||||
} from './constants';
|
||||
import ACTION_TYPES from './action-types';
|
||||
|
||||
|
@ -34,11 +34,33 @@ export const controls = {
|
|||
|
||||
try {
|
||||
result = await apiFetch( {
|
||||
path: REST_SANDBOX_CONNECTION_PATH,
|
||||
path: REST_CONNECTION_URL_PATH,
|
||||
method: 'POST',
|
||||
data: {
|
||||
environment: 'sandbox',
|
||||
products: [ 'EXPRESS_CHECKOUT' ],
|
||||
products: [ 'EXPRESS_CHECKOUT' ], // Sandbox always uses EXPRESS_CHECKOUT.
|
||||
},
|
||||
} );
|
||||
} catch ( e ) {
|
||||
result = {
|
||||
success: false,
|
||||
error: e,
|
||||
};
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
async [ ACTION_TYPES.DO_PRODUCTION_LOGIN ]( { products } ) {
|
||||
let result = null;
|
||||
|
||||
try {
|
||||
result = await apiFetch( {
|
||||
path: REST_CONNECTION_URL_PATH,
|
||||
method: 'POST',
|
||||
data: {
|
||||
environment: 'production',
|
||||
products,
|
||||
},
|
||||
} );
|
||||
} catch ( e ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue