Repository navigation
π v2.0.1 - Complete IPN Implementation & List Operations Enhancement
π Overview
This patch release completes the implementation of IPN (Instant Payment Notification) endpoints and enhances List operations with comprehensive search capabilities. All Request classes now fully match the OpenAPI specification with type-safe DTOs and Enums.
β οΈ BREAKING CHANGES
Note: These breaking changes were introduced in v2.0.0 and are documented here for reference. If you're upgrading from v2.0.0 to v2.0.1, there are no additional breaking changes.
IPN Request Classes
IpnSetupRequest
v2.0.0 (Previous): Only 2 parameters (incomplete implementation)
$request = new IpnSetupRequest(
url: 'https://yoursite.com/webhook',
ipnPassword: 'secret123'
);v2.0.1 (Current): Complete with 9 parameters
$request = new IpnSetupRequest(
ipnUrl: 'https://yoursite.com/webhook',
name: 'My Platform',
productIds: 'all',
domainId: 'my-platform',
categories: [IpnTransactionCategory::ORDERS, IpnTransactionCategory::AFFILIATIONS],
transactions: [IpnTransactionType::PAYMENT, IpnTransactionType::REFUND],
timing: IpnTiming::DELAYED,
shaPassphrase: 'random',
newsletterSendPolicy: IpnNewsletterSendPolicy::SEND_IF_OPTIN
);- β Changed from 2 parameters to 9 comprehensive parameters
- β Added type-safe Enums for categories, transactions, timing, and newsletter policy
- β
Renamed
urlβipnUrl, removedipnPassword
IpnInfoRequest
v2.0.0 (Previous): HTTP POST, no parameters
$response = $api->ipn()->info(); // Incompletev2.0.1 (Current): HTTP GET with optional filter
$request = new IpnInfoRequest(domainId: 'my-platform'); // HTTP GET
$response = $api->ipn()->info($request);- β Changed from HTTP POST to HTTP GET
- β
Added optional
domainIdparameter for filtering
IpnDeleteRequest
v2.0.0 (Previous): HTTP POST, no parameters
$request = new IpnDeleteRequest(); // Incomplete
$response = $api->ipn()->delete($request);v2.0.1 (Current): HTTP DELETE with required domainId
$response = $api->ipn()->delete('my-platform'); // HTTP DELETE, required domainId- β Changed from HTTP POST to HTTP DELETE
- β
Now requires
domainIdparameter (string) - β
IpnResource::delete()signature changed fromdelete(?IpnDeleteRequest)todelete(string $domainId)
List Request Classes
ListPurchasesRequest
v2.0.0 (Previous): Basic 4 parameters
$request = new ListPurchasesRequest(
productId: 123,
buyerEmail: 'buyer@example.com',
fromDate: '2025-01-01',
toDate: '2025-12-31'
);v2.0.1 (Current): Enhanced with 8 comprehensive parameters
$search = new PurchaseSearchData(
productId: 123,
email: 'buyer@example.com',
role: 'buyer'
);
$request = new ListPurchasesRequest(
from: '2025-01-01',
to: '2025-12-31',
search: $search,
sortBy: PurchaseSortBy::DATE,
sortOrder: SortOrder::DESC,
loadTransactions: true,
pageNo: 1,
pageSize: 500
);- β Replaced 4 basic parameters with 8 comprehensive parameters
- β
Introduced
PurchaseSearchDataDTO with 13 search criteria - β
Added type-safe
PurchaseSortByandSortOrderEnums - β
Added pagination support (
pageNo,pageSize) - β
Added
loadTransactionsflag for detailed data
ListProductsRequest
v2.0.0 (Previous): Parameters not matching OpenAPI spec
$request = new ListProductsRequest(
productType: 'digital',
onlyPublished: true
);v2.0.1 (Current): Corrected to match OpenAPI spec
$request = new ListProductsRequest(
sortBy: ProductSortBy::NAME
);- β
Simplified to single
sortByparameter withProductSortByEnum - β
Removed
productTypeandonlyPublished(not in OpenAPI spec)
ListTransactionsRequest
v2.0.0 (Previous): Generic arrays, no type safety
$request = new ListTransactionsRequest(
search: ['product_id' => 123], // Generic array
sort: ['date' => 'desc'] // Generic array
);v2.0.1 (Current): Type-safe with DTOs and Enums
$search = new TransactionSearchData(
productId: 123,
email: 'buyer@example.com'
);
$request = new ListTransactionsRequest(
from: '2025-01-01',
to: '2025-12-31',
search: $search,
sortBy: TransactionSortBy::DATE,
sortOrder: SortOrder::DESC
);- β
Replaced generic arrays with
TransactionSearchDataDTO - β
Added type-safe
TransactionSortByandSortOrderEnums
β¨ New Features
π― 5 New Enums for Type Safety
-
SortOrder- Universal sort directionASC,DESC
-
PurchaseSortBy- Purchase list sortingDATE,EARNING,AMOUNT
-
ProductSortBy- Product list sortingNAME,GROUP
-
TransactionSortBy- Transaction list sortingDATE,EARNING,AMOUNT
-
OrderType- Live vs Test ordersLIVE,TEST
All Enums implement StringBackedEnum interface with StringBackedEnumTrait for consistency.
π¦ 2 New DTOs for Structured Search
-
PurchaseSearchData- 13 search criteriarole,productId,firstName,lastName,emailhasAffiliate,affiliateName,orderType,payMethodbillingType,transactionType,currency,purchaseId
-
TransactionSearchData- 12 search criteria- Same as
PurchaseSearchDataminusorderType
- Same as
Both extend AbstractDataTransferObject with toArray() method.
π Documentation Updates
Updated documentation for all IPN endpoints:
- β
ipnSetup.md- Complete rewrite with all 9 parameters and Enum examples - β
ipnInfo.md- Updated withdomainIdparameter and HTTP GET method - β
ipnDelete.md- Updated with requireddomainIdparameter and HTTP DELETE method
All docs now include:
- Modern named arguments syntax
- Type-safe Enum usage examples
- Breaking changes warnings
- Error handling examples
π§ͺ Quality Assurance
- β 1137/1137 Unit Tests Passing (2271 assertions)
- β PHPStan Level 9: 0 errors (653 files analyzed)
- β PHP CS Fixer: 0 violations (PSR-12 compliant)
- β 6 Test Files Completely Rewritten with comprehensive coverage
π§ Migration Guide
For users upgrading from v2.0.0 β v2.0.1
Good news! If you're already on v2.0.0, you only need to update your IPN and List operations code to use the new comprehensive parameters. The breaking changes were already introduced in v2.0.0.
Step 1: Update IPN Setup
// v2.0.0 (Incomplete)
$api->ipn()->setup(
url: 'https://example.com/webhook',
ipnPassword: 'secret'
);
// v2.0.1 (Complete)
use GoSuccess\Digistore24\Api\Enum\IpnTiming;
use GoSuccess\Digistore24\Api\Enum\IpnTransactionType;
$api->ipn()->setup(new IpnSetupRequest(
ipnUrl: 'https://example.com/webhook',
name: 'My Platform',
productIds: 'all',
timing: IpnTiming::BEFORE_THANKYOU,
transactions: [IpnTransactionType::PAYMENT, IpnTransactionType::REFUND]
));Step 2: Update IPN Delete
// v2.0.0 (Incomplete)
$api->ipn()->delete(new IpnDeleteRequest());
// v2.0.1 (Complete)
$api->ipn()->delete('my-platform'); // Direct string parameterStep 3: Update List Purchases
// v2.0.0 (Basic)
$api->purchase()->list(
productId: 123,
buyerEmail: 'test@example.com'
);
// v2.0.1 (Enhanced)
use GoSuccess\Digistore24\Api\DTO\PurchaseSearchData;
use GoSuccess\Digistore24\Api\Enum\PurchaseSortBy;
use GoSuccess\Digistore24\Api\Enum\SortOrder;
$search = new PurchaseSearchData(
productId: 123,
email: 'test@example.com'
);
$api->purchase()->list(new ListPurchasesRequest(
search: $search,
sortBy: PurchaseSortBy::DATE,
sortOrder: SortOrder::DESC
));π¦ Files Changed
24 files changed: 824 insertions(+), 214 deletions(-)
New Files (7)
src/DTO/PurchaseSearchData.phpsrc/DTO/TransactionSearchData.phpsrc/Enum/OrderType.phpsrc/Enum/ProductSortBy.phpsrc/Enum/PurchaseSortBy.phpsrc/Enum/SortOrder.phpsrc/Enum/TransactionSortBy.php
Modified Files (17)
- Request Classes:
IpnSetupRequest,IpnInfoRequest,IpnDeleteRequest,ListPurchasesRequest,ListProductsRequest,ListTransactionsRequest - Resource:
IpnResource - Tests: 6 test files completely rewritten
- Documentation:
ipnSetup.md,ipnInfo.md,ipnDelete.md
π‘ Notes
- This release prioritizes type safety over backward compatibility
- All changes validated against OpenAPI specification
- OpenAPI spec contained errors (e.g.,
IpnNewsletterSendPolicyvalues) - corrected based on actual API behavior - Default values preserved for optional parameters (e.g., last 24 hours for date ranges)
- Parameter naming changed from snake_case to camelCase for PHP conventions
Full Changelog: v2.0.0...v2.0.1