Files
assets
data
dependencies
amphp
berlindb
composer
daverandom
delight-im
doctrine
guzzlehttp
hashids
ifsnop
jasny
kelunik
league
mexitek
mpdf
myclabs
nesbot
nyholm
pablo-sg-pacheco
paragonie
phpdocumentor
phpseclib
phpstan
psr
rakit
ralouphie
remotelyliving
rpnzl
scssphp
setasign
spatie
stripe
stripe-php
data
lib
ApiOperations
All.php
Create.php
Delete.php
NestedResource.php
Request.php
Retrieve.php
Search.php
SingletonRetrieve.php
Update.php
Apps
BillingPortal
Checkout
Exception
FinancialConnections
HttpClient
Identity
Issuing
Radar
Reporting
Service
Sigma
Tax
Terminal
TestHelpers
Treasury
Util
Account.php
AccountLink.php
ApiRequestor.php
ApiResource.php
ApiResponse.php
ApplePayDomain.php
ApplicationFee.php
ApplicationFeeRefund.php
Balance.php
BalanceTransaction.php
BankAccount.php
BaseStripeClient.php
BaseStripeClientInterface.php
Capability.php
Card.php
CashBalance.php
Charge.php
Collection.php
CountrySpec.php
Coupon.php
CreditNote.php
CreditNoteLineItem.php
Customer.php
CustomerBalanceTransaction.php
CustomerCashBalanceTransaction.php
Discount.php
Dispute.php
EphemeralKey.php
ErrorObject.php
Event.php
ExchangeRate.php
File.php
FileLink.php
FundingInstructions.php
Invoice.php
InvoiceItem.php
InvoiceLineItem.php
LineItem.php
LoginLink.php
Mandate.php
OAuth.php
OAuthErrorObject.php
PaymentIntent.php
PaymentLink.php
PaymentMethod.php
Payout.php
Person.php
Plan.php
Price.php
Product.php
PromotionCode.php
Quote.php
RecipientTransfer.php
Refund.php
RequestTelemetry.php
Review.php
SearchResult.php
SetupAttempt.php
SetupIntent.php
ShippingRate.php
SingletonApiResource.php
Source.php
SourceTransaction.php
Stripe.php
StripeClient.php
StripeClientInterface.php
StripeObject.php
StripeStreamingClientInterface.php
Subscription.php
SubscriptionItem.php
SubscriptionSchedule.php
TaxCode.php
TaxId.php
TaxRate.php
Token.php
Topup.php
Transfer.php
TransferReversal.php
UsageRecord.php
UsageRecordSummary.php
Webhook.php
WebhookEndpoint.php
WebhookSignature.php
OPENAPI_VERSION
VERSION
init.php
symfony
webmozart
woocommerce
yahnis-elsts
autoload.php
scoper-autoload.php
inc
lang
views
.gitignore
LICENSE
autoload.php
composer.json
constants.php
loco.xml
readme.txt
sunrise.php
uninstall.php
wp-multisite-waas.php
2024-11-30 18:24:12 -07:00

34 lines
1.2 KiB
PHP

<?php
namespace WP_Ultimo\Dependencies\Stripe\ApiOperations;
/**
* Trait for searchable resources.
*
* This trait should only be applied to classes that derive from StripeObject.
*/
trait Search
{
/**
* @param string $searchUrl
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\SearchResult of ApiResources
*/
protected static function _searchResource($searchUrl, $params = null, $opts = null)
{
self::_validateParams($params);
list($response, $opts) = static::_staticRequest('get', $searchUrl, $params, $opts);
$obj = \WP_Ultimo\Dependencies\Stripe\Util\Util::convertToStripeObject($response->json, $opts);
if (!$obj instanceof \WP_Ultimo\Dependencies\Stripe\SearchResult) {
throw new \WP_Ultimo\Dependencies\Stripe\Exception\UnexpectedValueException('Expected type ' . \WP_Ultimo\Dependencies\Stripe\SearchResult::class . ', got "' . \get_class($obj) . '" instead.');
}
$obj->setLastResponse($response);
$obj->setFilters($params);
return $obj;
}
}