1+ import config from 'config' ;
12import { getConfig } from '../../lib/util/getConfig.js' ;
23import { hookAfter } from '../../lib/util/hookable.js' ;
3- import { addProcessor } from '../../lib/util/registry.js' ;
44import { registerPaymentMethod } from '../checkout/services/getAvailablePaymentMethods.js' ;
55import { getSetting } from '../setting/services/setting.js' ;
66import { voidPaymentTransaction } from './services/voidPaymentTransaction.js' ;
77
88export default async ( ) => {
9+ const paypalPaymentStatus = {
10+ order : {
11+ paymentStatus : {
12+ paypal_authorized : {
13+ name : 'Authorized' ,
14+ badge : 'warning'
15+ } ,
16+ paypal_captured : {
17+ name : 'Captured' ,
18+ badge : 'success'
19+ }
20+ } ,
21+ psoMapping : {
22+ 'paypal_authorized:*' : 'processing' ,
23+ 'paypal_captured:*' : 'processing' ,
24+ 'paypal_captured:delivered' : 'completed'
25+ }
26+ }
27+ } ;
28+ config . util . setModuleDefaults ( 'oms' , paypalPaymentStatus ) ;
29+
930 hookAfter ( 'changePaymentStatus' , async ( order , orderID , status ) => {
1031 if ( status !== 'canceled' ) {
1132 return ;
@@ -24,7 +45,7 @@ export default async () => {
2445 validator : async ( ) => {
2546 const paypalConfig = getConfig ( 'system.paypal' , { } ) ;
2647 let paypalStatus ;
27- if ( paypalConfig . status ) {
48+ if ( paypalConfig ? .status ) {
2849 paypalStatus = paypalConfig . status ;
2950 } else {
3051 paypalStatus = await getSetting ( 'paypalPaymentStatus' , 0 ) ;
0 commit comments