Commit a9b3513b authored by Mattias Lundmark's avatar Mattias Lundmark Committed by Benjamin Rokseth
Browse files

DEICH-1332 handling isReturned status for delivered loans with fines

parent bc886259
......@@ -117,14 +117,13 @@ module.exports = (app) => {
const responseCode = jsonResponse.ProcessResponse.ResponseCode
const transactionId = jsonResponse.ProcessResponse.TransactionId
// Get all loans from koha
const loansRes = await fetch(`http://xkoha:8081/api/v1/patrons/${request.session.borrowerNumber}/loansandreservations`)
const loans = await loansRes.json()
// Extend all loans with isPurresak
let successfulExtends = []
let failedExtends = []
for(let loan of loans.loans) {
const successfulExtends = []
const failedExtends = []
for (const loan of loans.loans) {
if (loan.isPurresak) {
const extendRes = await fetch(`http://xkoha:8081/api/v1/checkouts/${loan.id}`, {
method: 'PUT'
......@@ -151,7 +150,7 @@ module.exports = (app) => {
body: `nets_id=${encodeURIComponent(transactionId)}`
})
const kohaResJson = await kohaRes.json()
console.log(kohaResJson)
response.send({
transactionId: transactionId,
responseCode: responseCode,
......
......@@ -379,7 +379,12 @@ class UserLoans extends React.Component {
</div>
{item.isPurresak &&
<div className="flex-col extend-msg fine-info">
<p><FormattedMessage {...messages.loanWithFine} /></p>
<p>
<FormattedMessage {...messages.loanWithFine} />
{item.isReturned &&
<span><br/>Levert</span>
}
</p>
</div>
}
{item.isKemnersak &&
......@@ -463,7 +468,7 @@ class UserLoans extends React.Component {
return (
<ClickableElement onClickAction={this.props.loanActions.startPayFine} onClickArguments={[purreId, location]} >
<button className="small-blue-btn pay-fine-button"
disabled={false}
disabled={hasKemner}
data-automation-id="UserLoans_pay_fine_button">
<FormattedMessage {...messages.payFineButtonText} />
</button>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment