Skip to content

Commit 6af5477

Browse files
committed
πŸ“„ Add seller status filter documentation
1 parent 41cfbfa commit 6af5477

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

β€Ždocs/seller-status-filter.mdβ€Ž

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Seller Status Filter
2+
3+
## Overview
4+
The `SellerStatusFilter` allows overriding the PayPal merchant-integrations API response. This is useful when the API is unavailable (e.g., Stage environment returning 404) or when testing specific feature eligibility.
5+
6+
## Hook
7+
```php
8+
do_action( 'woocommerce_paypal_payments_seller_status_filter_init', SellerStatusFilter $filter );
9+
```
10+
Fires once when the `api.seller-status-filter` container service is resolved.
11+
12+
## API
13+
14+
| Method | Description |
15+
|---|---|
16+
| `set_fallback( SellerStatus $status )` | Base response when API fails |
17+
| `add_product_capability( string $product, string $cap )` | Add capability to a product (auto-creates product if missing) |
18+
| `remove_product_capability( string $product, string $cap )` | Remove capability from a product |
19+
| `remove_product( string $name )` | Remove entire product |
20+
| `ensure_capability( string $name, string $status )` | Ensure top-level capability exists (default: `ACTIVE`) |
21+
| `remove_capability( string $name )` | Remove top-level capability |
22+
| `override_country( string $country )` | Override merchant country |
23+
24+
All operations are additive β€” multiple callers can modify the same product without conflict.
25+
26+
## Examples
27+
28+
### Fallback + ACDC + Vaulting (Stage environment)
29+
```php
30+
add_action( 'woocommerce_paypal_payments_seller_status_filter_init', function ( $filter ) {
31+
$filter->set_fallback( new SellerStatus( array(), array(), 'US' ) );
32+
33+
$filter->add_product_capability( 'PPCP_CUSTOM', 'CUSTOM_CARD_PROCESSING' );
34+
$filter->ensure_capability( 'CUSTOM_CARD_PROCESSING' );
35+
36+
$filter->add_product_capability( 'ADVANCED_VAULTING', 'PAYPAL_WALLET_VAULTING_ADVANCED' );
37+
$filter->add_product_capability( 'PPCP_CUSTOM', 'PAYPAL_WALLET_VAULTING_ADVANCED' );
38+
$filter->ensure_capability( 'PAYPAL_WALLET_VAULTING_ADVANCED' );
39+
} );
40+
```
41+
42+
### Inject a single feature
43+
```php
44+
add_action( 'woocommerce_paypal_payments_seller_status_filter_init', function ( $filter ) {
45+
$filter->add_product_capability( 'PAYMENT_METHODS', 'GOOGLE_PAY' );
46+
$filter->ensure_capability( 'GOOGLE_PAY' );
47+
} );
48+
```
49+
50+
### Remove a feature
51+
```php
52+
add_action( 'woocommerce_paypal_payments_seller_status_filter_init', function ( $filter ) {
53+
$filter->remove_product_capability( 'PPCP_CUSTOM', 'CUSTOM_CARD_PROCESSING' );
54+
$filter->remove_capability( 'CUSTOM_CARD_PROCESSING' );
55+
} );
56+
```
57+
58+
## Feature-to-capability reference
59+
60+
| Feature | Product | Product capability | Top-level capability |
61+
|---|---|---|---|
62+
| ACDC | `PPCP_CUSTOM` | `CUSTOM_CARD_PROCESSING` | `CUSTOM_CARD_PROCESSING` |
63+
| Vaulting | `ADVANCED_VAULTING`, `PPCP_CUSTOM` | `PAYPAL_WALLET_VAULTING_ADVANCED` | `PAYPAL_WALLET_VAULTING_ADVANCED` |
64+
| Apple Pay | `PAYMENT_METHODS`, `PPCP_CUSTOM` | `APPLE_PAY` | `APPLE_PAY` |
65+
| Google Pay | `PAYMENT_METHODS`, `PPCP_CUSTOM` | `GOOGLE_PAY` | `GOOGLE_PAY` |
66+
| APMs | `PPCP_STANDARD` | `PAYPAL_CHECKOUT_ALTERNATIVE_PAYMENT_METHODS` | `PAYPAL_CHECKOUT_ALTERNATIVE_PAYMENT_METHODS` |
67+
| Fastlane | `PPCP_CUSTOM` | `FASTLANE_CHECKOUT` | `FASTLANE_CHECKOUT` |
68+
| Venmo | `PPCP_CUSTOM` | `VENMO_PAY_PROCESSING` | `VENMO_PAY_PROCESSING` |
69+
| Installments | β€” | β€” | `INSTALLMENTS` |
70+
| Crypto | β€” | β€” | `CRYPTO_PYMTS` |
71+
| PUI | `PAYMENT_METHODS` | `PAY_UPON_INVOICE` | β€” |

0 commit comments

Comments
Β (0)