{"push_id":912194108,"size":4,"distinct_size":4,"ref":"refs/heads/kohasuomi3.16","head":"460ee53bf45d8d8b78e21e47912377258e23898b","before":"83d4089c1a6dca9c301ef95e4136acc603120563","commits":[{"sha":"bbf99ef29e80ea6856df55fb7f3c379ce6d10954","author":{"email":"6a4cb1879b6a6af10764a539873a476e337bd6f1@student.uef.fi","name":"Lari Taskula"},"message":"KD#377 - CPU / Ceepos integration. Integrate cash registers (POS) into Koha.\n\nThis commit integrates Ceepos cash registers into Koha. The basic idea is to\nconstruct a payment from Koha accountlines and send it to the cash register\nwhere it will be either accepted or cancelled. CPU will notify Koha the payment\nstatus. After this, Koha modifies the accountlines accordingly and creates a\nnew accountline of type \"Pay\".\n\nChanges in views for staff client are kept minimal. This patch does not\ninclude OPAC payments and has nothing to do with OPAC at all.\n\nKey features are:\n  - Create Koha::Object for transactions called \"PaymentTransactions\".\n  - Stop using C4::Accounts default functions because they are confusing. Instead,\n    create a new subroutine that combines all four C4::Accounts way of payment.\n    The new subroutine \"completes\" a transaction, i.e. after payment is successful,\n    it makes an old-style Koha-payment so that Koha is in sync with the cash\n    register system. Call by $transaction->CompletePayment();\n  - members/paycollect.pl creates a new transaction and sends it via Ajax using the\n    subroutine C4::OPLIB::CPUIntegration::SendPayment()\n  - REST endpoint for getting a transaction:\n      - /api/v1/pos/cpu/{invoicenumber} GET\n  - REST endpoint for receiving reports from CPU:\n      - /api/v1/pos/cpu/{invoicenumber}/report POST\n  - System preferences\n      - cpuitemnumbers: YAML config that maps Koha accountlines itemtypes to actual\n                        cash register codes.\n      - POSIntegration: turn the whole integration on/off.\n  - Does not use the integration for branches that have not mapped Koha-items to\n    CPU items in \"cpuitemnumbers\"\nConfigurations to get started:\n  - koha-conf.xml introduces new settings for CPU (pos->CPU):\n      - source: Source key provided by CPU\n      - secretKey: Secret key to construct a SHA-256 hash from input\n      - url: address to CPU\n      - modle: defines the mode for response type (1: synchronous, 2: asynchronous)\n      - notificationAddress: address where we want to receive the payment report\n      - also paths for ssl certificate (CPU requires this)\n  - System preferences\n     - mentioned in key features above. Set them up to get started.\n\nStep-by-step description of how it all works:\n\nStaff member enters Borrower's Fines and goes to \"Pay fines\" tab. For any fine in\nthe table, he clicks \"Pay\". He is then given an option to define the total amount\nfor the payment. THE WHOLE AMOUNT IN THE INPUT BOX MUST BE PAID AT CASH REGISTER!\nHe then selects an office (if there is none, he clicks \"Add new office\" and enters\nthe office code number). Then he clicks \"Confirm\".\n\nHere's where the integration really starts to take action.\n\nIn members/paycollect.pl, we call C4::OPLIB::CPUIntegration::InitializePayment()\nwith the selected fines. If the staff member did not define any specific items,\nInitializePayment() will choose which items will be paid. InitializePayment()\nwill create a new row into payments_transactions table. The items that belong\nto this payment, are added into payments_transactions_accountlines with detailed\nprice for each item.\n\nAfter that, a new view for the staff member is presented. This is the screen that\nshows when the payment is pending. AJAX call is made to the page itself\n(/cgi-bin/koha/members/paycollect.pl). Then, Koha sends the payment to CPU from\nC4::OPLIB::CPUIntegration::SendPayment().\n\nWhen the payment is completed, CPU responds to Koha's long-polling call. If the call\nis timed out, the completion of a payment is made when CPU sends a report to REST API.\nLong-polling POST timeout is set at 5 minutes. The payment is completed by calling\n$transaction->CompletePayment(\"paid\"). This subroutine modifies amountoutstanding of\nall of the items in accountlines related to the payment. It then creates a new line\ninto accountlines with the type \"Pay\" and sets the amount equal to the amount that\nwas paid. We now have successful payment. The events are also logged.\n\nPayment can be also reverted via the cash register. In this case, we call\n$transaction->RevertPayment() and it will revert the payment.\n\nTo install:\n1. Apply patch\n2. Run atomicupdater\n3. Install SSL certificates delivered by CPU.\n4. Edit koha-conf. Add parameters given by CPU and paths to SSL certificates.\n5. Edit koha-httpd. Block access to NotificationAddress from others except CPU.\n6. Restart koha-api-daemon.\n7. Set system preferences\n7.1 cpuitemnumbers: Map Koha itemtypes (accountlines.accounttype) into Ceepos itemnumbers\n                    for each library. If not defined for library, integration is considered\n                    offline in that library.\n7.2 POSIntegration -> CPU integration\n\nAlso make sure there will be no conflicts with payment ids. Payment IDs are unique! Payment id\nis the transaction_id in payments_transactions table.\n\nTo use:\n1. Make sure Ulkop. liityntä is enabled in Ceepos.\n2. Make sure all connections are open between Koha and CPU server.\n3. Go to pay Patron's payments. Add a new Office (possibly equal to cash register number).\n   This office will stay in browser's cookie until it is deleted.\n4. Select the Office and pay the fine.\n5. Click Ulkop. liityntä (or SHIFT+F7) in Ceepos\n6. You should see the fine in Ceepos. Proceed with the cash register as before.\n7. After payment is complete, Koha will be notified automatically. You don't have to worry\n   about anything. Just make sure the payment is correctly marked into Borrower's account.\n\nSee KD#377 in Redmine for more detailed description.","distinct":true,"url":"https://api.github.com/repos/KohaSuomi/kohasuomi/commits/bbf99ef29e80ea6856df55fb7f3c379ce6d10954"},{"sha":"350631a2ffd635fc448ab9d3d7cb3426eb659abf","author":{"email":"6a4cb1879b6a6af10764a539873a476e337bd6f1@student.uef.fi","name":"Lari Taskula"},"message":"Bug 13906 (follow-up) - New TestObjectFactory for creating fines into accountlines","distinct":true,"url":"https://api.github.com/repos/KohaSuomi/kohasuomi/commits/350631a2ffd635fc448ab9d3d7cb3426eb659abf"},{"sha":"923c4dd94e2b0ee10dd0defcdcffd12bc6df3739","author":{"email":"6a4cb1879b6a6af10764a539873a476e337bd6f1@student.uef.fi","name":"Lari Taskula"},"message":"Bug 14536 (follow-up) - New PageObjects for handling Fines","distinct":true,"url":"https://api.github.com/repos/KohaSuomi/kohasuomi/commits/923c4dd94e2b0ee10dd0defcdcffd12bc6df3739"},{"sha":"460ee53bf45d8d8b78e21e47912377258e23898b","author":{"email":"6a4cb1879b6a6af10764a539873a476e337bd6f1@student.uef.fi","name":"Lari Taskula"},"message":"KD#377 - Integration tests for CPU integration\n\nRequires connection to a server with CPU cash register system automatic simulator\ninstalled. This tool is delivered by CPU.","distinct":true,"url":"https://api.github.com/repos/KohaSuomi/kohasuomi/commits/460ee53bf45d8d8b78e21e47912377258e23898b"}]}