$criteria->
addAssociation('appPaymentMethod'
);
$criteria->
addFilter(new EqualsFilter('appPaymentMethod.appId',
$appId));
$paymentMethods =
$paymentMethodRepository->
search($criteria,
$this->context
)->
getEntities();
static::
assertCount(2,
$paymentMethods);
/** @var PaymentMethodEntity|null $paymentMethod */
$paymentMethod =
$paymentMethods->
filterByProperty('name', 'The app payment method'
)->
first();
static::
assertNotNull($paymentMethod);
static::
assertSame('The app payment method',
$paymentMethod->
getName());
static::
assertSame('handler_app_test_mymethod',
$paymentMethod->
getFormattedHandlerIdentifier());
static::
assertNotNull($paymentMethod->
getMediaId());
$fileLoader =
$this->
getContainer()->
get(FileLoader::
class);
static::
assertNotEmpty($fileLoader->
loadMediaFile($paymentMethod->
getMediaId(),
$this->context
));
$appPaymentMethod =
$paymentMethod->
getAppPaymentMethod();
static::
assertNotNull($appPaymentMethod);
static::
assertSame('test',
$appPaymentMethod->
getAppName());
static::
assertSame('myMethod',
$appPaymentMethod->
getIdentifier());
static::
assertSame('https://payment.app/payment/process',
$appPaymentMethod->
getPayUrl());
static::
assertSame('https://payment.app/payment/finalize',
$appPaymentMethod->
getFinalizeUrl());
}