diff --git a/README.md b/README.md index 02a3013..7cd441b 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,8 @@ $result = SimplePay::payment()->finish(new FinishRequest( currency: Currency::HUF, transactionId: $transactionId, orderRef: 'ORDER-2026-001', - approveTotal: 25400, + amount: 25400, // the amount to capture (approveTotal) + originalTotal: 25400, // the authorized amount )); ``` @@ -189,7 +190,7 @@ $result = SimplePay::payment()->refund(new RefundRequest( currency: Currency::HUF, transactionId: $transactionId, orderRef: 'ORDER-2026-001', - refundTotal: 25400, + amount: 25400, )); // Partial refund @@ -197,7 +198,7 @@ $result = SimplePay::payment()->refund(new RefundRequest( currency: Currency::HUF, transactionId: $transactionId, orderRef: 'ORDER-2026-001', - refundTotal: 10000, + amount: 10000, )); ``` @@ -381,11 +382,11 @@ Available events (all receive `IpnMessage` DTO): The `IpnMessage` DTO contains: ```php -$event->ipnMessage->orderRef; // Your order reference -$event->ipnMessage->transactionId; // SimplePay transaction ID -$event->ipnMessage->status; // PaymentStatus enum -$event->ipnMessage->paymentMethod; // PaymentMethod enum -$event->ipnMessage->cardMask; // Masked card number +$event->ipn->orderRef; // Your order reference +$event->ipn->transactionId; // SimplePay transaction ID +$event->ipn->status; // PaymentStatus enum +$event->ipn->paymentMethod; // Payment method as a string, e.g. "CARD" +$event->ipn->cardMask; // Masked card number ``` ## Back URL Handling @@ -429,7 +430,7 @@ Always use enum cases instead of raw strings: - **`PaymentStatus`** -- `INIT`, `FINISHED`, `AUTHORIZED`, `NOTAUTHORIZED`, `INPAYMENT`, `CANCELLED`, `TIMEOUT`, `INFRAUD`, `FRAUD`, `REFUND`, `REVERSED` - **`BackEvent`** -- `SUCCESS`, `FAIL`, `CANCEL`, `TIMEOUT`, `PENDING` (Request to Pay) - **`TransactionType`** -- `CIT` (Customer Initiated), `MIT` (Merchant Initiated), `REC` (Recurring) -- **`ErrorCode`** -- 358+ error codes with Hungarian descriptions +- **`ErrorCode`** -- 350+ error codes with Hungarian descriptions ## Error Handling diff --git a/examples/en/query-refund-cancel.md b/examples/en/query-refund-cancel.md index e70703c..87dfb8f 100644 --- a/examples/en/query-refund-cancel.md +++ b/examples/en/query-refund-cancel.md @@ -88,26 +88,29 @@ For transactions started with `twoStep: true`, use `finish()` to capture the aut ```php use Netipar\SimplePay\Facades\SimplePay; use Netipar\SimplePay\Enums\Currency; +use Netipar\SimplePay\Dto\FinishRequest; // Capture the full authorized amount -$finish = SimplePay::payment()->finish( +$finish = SimplePay::payment()->finish(new FinishRequest( currency: Currency::HUF, transactionId: 123456, - amount: 5000, orderRef: 'ORDER-PREAUTH-001', -); + amount: 5000, // the amount to capture + originalTotal: 5000, // the authorized amount +)); ``` You can also capture a partial amount (less than the originally authorized total): ```php // Capture only a portion of the authorized amount -$finish = SimplePay::payment()->finish( +$finish = SimplePay::payment()->finish(new FinishRequest( currency: Currency::HUF, transactionId: 123456, - amount: 3000, // Less than the original 5000 orderRef: 'ORDER-PREAUTH-001', -); + amount: 3000, // Less than the original 5000 + originalTotal: 5000, +)); ``` ## Error Handling diff --git a/examples/hu/lekerdezes-es-sztorno.md b/examples/hu/lekerdezes-es-sztorno.md index 29bb011..ab023fd 100644 --- a/examples/hu/lekerdezes-es-sztorno.md +++ b/examples/hu/lekerdezes-es-sztorno.md @@ -94,12 +94,15 @@ $cancel = SimplePay::payment()->cancel( Ha a fizetést kétlépcsős módban indítottad (`twoStep: true`), a zárolt összeget a `finish()` metódussal terhelheted: ```php -$finish = SimplePay::payment()->finish( +use Netipar\SimplePay\Dto\FinishRequest; + +$finish = SimplePay::payment()->finish(new FinishRequest( currency: Currency::HUF, transactionId: 123456, orderRef: 'ORDER-PREAUTH-001', - amount: 15000, -); + amount: 15000, // a terhelendő összeg + originalTotal: 15000, // a zárolt összeg +)); ``` A `finish()` meghívásakor az összeg lehet kisebb is, mint az eredetileg zárolt összeg (részleges terhelés). @@ -107,12 +110,13 @@ A `finish()` meghívásakor az összeg lehet kisebb is, mint az eredetileg záro ```php // Eredetileg 15000 Ft zárolt // Csak 12000 Ft terhelése -$finish = SimplePay::payment()->finish( +$finish = SimplePay::payment()->finish(new FinishRequest( currency: Currency::HUF, transactionId: 123456, orderRef: 'ORDER-PREAUTH-001', amount: 12000, -); + originalTotal: 15000, +)); ``` ## Hibakezelés diff --git a/resources/boost/skills/simplepay-development/SKILL.md b/resources/boost/skills/simplepay-development/SKILL.md index 0a217ff..cb4c872 100644 --- a/resources/boost/skills/simplepay-development/SKILL.md +++ b/resources/boost/skills/simplepay-development/SKILL.md @@ -57,14 +57,16 @@ use Netipar\SimplePay\Facades\SimplePay; $request = new PaymentRequest( currency: Currency::HUF, - customerEmail: 'customer@example.com', + total: 6000, orderRef: 'ORDER-001', + customerEmail: 'customer@example.com', + language: 'HU', + url: route('simplepay.back'), items: [ new Item(title: 'Product name', price: 1000, quantity: 1), - new Item(title: 'Service', price: 2500, quantity: 2, tax: '27'), + new Item(title: 'Service', price: 2500, quantity: 2, tax: 27), ], methods: [PaymentMethod::CARD], - url: route('payment.back'), invoice: new Address( name: 'Customer Kft.', country: 'HU', @@ -78,7 +80,7 @@ $response = SimplePay::payment()->start($request); // $response->transactionId (int) // $response->paymentUrl (string) — redirect user here -// $response->timeout (string) +// $response->timeout (?string) return redirect($response->paymentUrl); ``` @@ -92,11 +94,13 @@ use Netipar\SimplePay\Dto\FinishRequest; // Step 1: authorize $request = new PaymentRequest( currency: Currency::HUF, - customerEmail: 'customer@example.com', + total: 5000, orderRef: 'ORDER-002', + customerEmail: 'customer@example.com', + language: 'HU', + url: route('simplepay.back'), items: [new Item(title: 'Product', price: 5000, quantity: 1)], methods: [PaymentMethod::CARD], - url: route('payment.back'), twoStep: true, ); $response = SimplePay::payment()->start($request); @@ -105,8 +109,9 @@ $response = SimplePay::payment()->start($request); $finish = new FinishRequest( currency: Currency::HUF, transactionId: $response->transactionId, - originalTotal: 5000, - approveTotal: 5000, + orderRef: 'ORDER-002', + amount: 5000, // the amount to capture (sent as approveTotal) + originalTotal: 5000, // the authorized amount ); $finishResponse = SimplePay::payment()->finish($finish); // $finishResponse->transactionId, $finishResponse->total @@ -143,7 +148,7 @@ class HandleSuccessfulPayment $ipn->orderRef; // string $ipn->transactionId; // int $ipn->status; // PaymentStatus enum - $ipn->paymentMethod; // PaymentMethod enum + $ipn->paymentMethod; // ?string, e.g. "CARD" $ipn->finishDate; // ?string } } @@ -197,7 +202,8 @@ use Netipar\SimplePay\Dto\RefundRequest; $request = new RefundRequest( currency: Currency::HUF, transactionId: 123456789, - refundTotal: 1000, + orderRef: 'ORDER-001', + amount: 1000, // sent as refundTotal ); $response = SimplePay::payment()->refund($request);