Skip to content

Commit

Permalink
fix bug with seats handling in email template
Browse files Browse the repository at this point in the history
  • Loading branch information
shareoc committed Dec 17, 2024
1 parent 94a4fa4 commit 49ba42c
Show file tree
Hide file tree
Showing 4 changed files with 243 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ <h1 style="color:#484848;font-size:26px;line-height:1.3;font-weight:700">{{t "Bo
<tr>
<td>
<td>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{t "BookingAcceptedRequest.PriceBreakdownHourly" "{amount,number,::.00} {currency} x {multiplier, number} {multiplier, plural, one {hour} other {hours}}" amount=unit-price.amount currency=unit-price.currency multiplier=units}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{t "BookingAcceptedRequest.SeatsQuantity" "Seats x {multiplier, number}" multiplier=seats}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{t "BookingAcceptedRequest.PriceBreakdownHourlyWithSeats" "{amount, number, ::.00} {currency} × {multiplier, number} {multiplier, plural, one {hour} other {hours}} x {seats, number} {seats, plural, one {seat} other {seats}}" amount=unit-price.amount currency=unit-price.currency multiplier=units seats=seats}}</p>

</td>
<td style="text-align:right">
Expand Down Expand Up @@ -172,8 +171,7 @@ <h1 style="color:#484848;font-size:26px;line-height:1.3;font-weight:700">{{t "Bo
<tr>
<td>
<td>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{t "BookingAcceptedRequest.PriceBreakdownDaily" "{amount,number,::.00} {currency} x {multiplier, number} {multiplier, plural, one {day} other {days}}" amount=unit-price.amount currency=unit-price.currency multiplier=units}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{t "BookingAcceptedRequest.SeatsQuantity" "Seats x {multiplier, number}" multiplier=seats}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{t "BookingAcceptedRequest.PriceBreakdownDailyWithSeats" "{amount, number, ::.00} {currency} × {multiplier, number} {multiplier, plural, one {day} other {days}} x {seats, number} {seats, plural, one {seat} other {seats}}" amount=unit-price.amount currency=unit-price.currency multiplier=units seats=seats}}</p>
</td>
<td style="text-align:right">
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{> format-money money=line-total}}</p>
Expand Down Expand Up @@ -203,8 +201,7 @@ <h1 style="color:#484848;font-size:26px;line-height:1.3;font-weight:700">{{t "Bo
<tr>
<td>
<td>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{t "BookingAcceptedRequest.PriceBreakdownNightly" "{amount,number,::.00} {currency} x {multiplier, number} {multiplier, plural, one {night} other {nights}}" amount=unit-price.amount currency=unit-price.currency multiplier=units}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{t "BookingAcceptedRequest.SeatsQuantity" "Seats x {multiplier, number}" multiplier=seats}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{t "BookingAcceptedRequest.PriceBreakdownNightlyWithSeats" "{amount, number, ::.00} {currency} × {multiplier, number} {multiplier, plural, one {night} other {nights}} x {seats, number} {seats, plural, one {seat} other {seats}}" amount=unit-price.amount currency=unit-price.currency multiplier=units seats=seats}}</p>
</td>
<td style="text-align:right">
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{> format-money money=line-total}}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,8 @@ <h1 style="color:#484848;font-size:26px;line-height:1.3;font-weight:700">{{t "Bo
<td>
<td>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">

{{t "BookingMoneyPaid.PriceBreakdownHourly" "{amount,number,::.00} {currency} x {multiplier, number} {multiplier, plural, one {hour} other {hours}}" amount=unit-price.amount currency=unit-price.currency multiplier=units}}

{{t "BookingMoneyPaid.PriceBreakdownHourlyWithSeats" "{amount, number, ::.00} {currency} × {multiplier, number} {multiplier, plural, one {hour} other {hours}} x {seats, number} {seats, plural, one {seat} other {seats}}" amount=unit-price.amount currency=unit-price.currency multiplier=units seats=seats}}
</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{t "BookingMoneyPaid.SeatsQuantity" "Seats x {multiplier, number}" multiplier=seats}}</p>
</td>
<td style="text-align:right">
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{> format-money money=line-total}}</p>
Expand Down Expand Up @@ -180,8 +177,7 @@ <h1 style="color:#484848;font-size:26px;line-height:1.3;font-weight:700">{{t "Bo
<tr>
<td>
<td>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingMoneyPaid.PriceBreakdownDaily" "{amount,number,::.00} {currency} x {multiplier, number} {multiplier, plural, one {day} other {days}}" amount=unit-price.amount currency=unit-price.currency multiplier=units}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingMoneyPaid.SeatsQuantity" "Seats x {multiplier, number}" multiplier=seats}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingMoneyPaid.PriceBreakdownDailyWithSeats" "{amount, number, ::.00} {currency} × {multiplier, number} {multiplier, plural, one {day} other {days}} x {seats, number} {seats, plural, one {seat} other {seats}}" amount=unit-price.amount currency=unit-price.currency multiplier=units seats=seats}}</p>
</td>
<td style="text-align:right">
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{> format-money money=line-total}}</p>
Expand Down Expand Up @@ -211,8 +207,7 @@ <h1 style="color:#484848;font-size:26px;line-height:1.3;font-weight:700">{{t "Bo
<tr>
<td>
<td>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingMoneyPaid.PriceBreakdownNightly" "{amount,number,::.00} {currency} x {multiplier, number} {multiplier, plural, one {night} other {nights}}" amount=unit-price.amount currency=unit-price.currency multiplier=units}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingMoneyPaid.SeatsQuantity" "Seats x {multiplier, number}" multiplier=seats}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingMoneyPaid.PriceBreakdownNightlyWithSeats" "{amount, number, ::.00} {currency} × {multiplier, number} {multiplier, plural, one {night} other {nights}} x {seats, number} {seats, plural, one {seat} other {seats}}" amount=unit-price.amount currency=unit-price.currency multiplier=units seats=seats}}</p>
</td>
<td style="text-align:right">
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{> format-money money=line-total}}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ <h1 style="color:#484848;font-size:26px;line-height:1.3;font-weight:700">{{t "Bo
<tr>
<td>
<td>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingNewRequest.PriceForHoursQuantity" "{amount, number, ::.00} {currency} × {units, number} {units, plural, one {hour} other {hours}}" amount=unit-price.amount currency=unit-price.currency units=units}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848">{{t "BookingNewRequest.SeatsQuantity" "Seats × {seats, number}" seats=seats}}</p>

<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingNewRequest.PriceForHoursQuantityWithSeats" "{amount, number, ::.00} {currency} × {units, number} {units, plural, one {hour} other {hours}} x {seats, number} {seats, plural, one {seat} other {seats}}" amount=unit-price.amount currency=unit-price.currency units=units seats=seats}}</p>
</td>
<td style="text-align:right">
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{> format-money money=line-total}}</p>
Expand Down Expand Up @@ -164,8 +164,7 @@ <h1 style="color:#484848;font-size:26px;line-height:1.3;font-weight:700">{{t "Bo
<tr>
<td>
<td>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingNewRequest.PriceForDaysQuantity" "{amount, number, ::.00} {currency} × {units, number} {units, plural, one {day} other {days}}" amount=unit-price.amount currency=unit-price.currency units=quantity}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingNewRequest.SeatsQuantity" "Seats × {seats, number}" seats=seats}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingNewRequest.PriceForDaysQuantityWithSeats" "{amount, number, ::.00} {currency} × {units, number} {units, plural, one {day} other {days}} x {seats, number} {seats, plural, one {seat} other {seats}}" amount=unit-price.amount currency=unit-price.currency units=units seats=seats}}</p>
</td>
<td style="text-align:right">
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{> format-money money=line-total}}</p>
Expand Down Expand Up @@ -195,8 +194,8 @@ <h1 style="color:#484848;font-size:26px;line-height:1.3;font-weight:700">{{t "Bo
<tr>
<td>
<td>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingNewRequest.PriceForNightsQuantity" "{amount, number, ::.00} {currency} × {units, number} {units, plural, one {night} other {nights}}" amount=unit-price.amount currency=unit-price.currency units=units}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingNewRequest.SeatsQuantity" "Seats × {seats, number}" seats=seats}}</p>
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{t "BookingNewRequest.PriceForNightsQuantityWithSeats" "{amount, number, ::.00} {currency} × {units, number} {units, plural, one {night} other {nights}} x {seats, number} {seats, plural, one {seat} other {seats}}" amount=unit-price.amount currency=unit-price.currency units=units seats=seats}}</p>

</td>
<td style="text-align:right">
<p style="font-size:16px;line-height:1.4;margin:16px 0;color:#484848;margin-bottom:1px">{{> format-money money=line-total}}</p>
Expand Down
232 changes: 232 additions & 0 deletions ext/transaction-processes/default-booking/templates/context.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
{
"recipient" : {
"id" : "fd180cc2-a99c-4e43-b960-9b94daec5265",
"first-name" : "Joe",
"last-name" : "Dunphy",
"display-name" : "Joe D",
"public-data" : {
"phoneNumberVerified" : true
},
"protected-data" : {
"phoneNumber" : "123456"
},
"private-data" : {
"language" : "en"
},
"metadata" : {
"membership" : "premium"
}
},
"recipient-role" : "provider",
"other-party" : {
"id" : "ef7f40d5-da66-489a-957b-641313b68204",
"first-name" : "Jane",
"last-name" : "Pritchett",
"display-name" : "Jane P",
"public-data" : {
"phoneNumberVerified" : true
},
"protected-data" : {
"phoneNumber" : "789101112"
},
"private-data" : {
"language" : "fr"
},
"metadata" : {
"membership" : "standard"
}
},
"marketplace" : {
"name" : "Bikesoil",
"url" : "https://www.sharetribe.com"
},
"transaction" : {
"booking" : {
"start" : {
"year" : 2017,
"month" : 12,
"day" : 1,
"hours" : 0,
"minutes" : 0,
"seconds" : 0,
"milliseconds" : 0
},
"end" : {
"year" : 2017,
"month" : 12,
"day" : 12,
"hours" : 0,
"minutes" : 0,
"seconds" : 0,
"milliseconds" : 0
},
"displayStart" : {
"year" : 2017,
"month" : 12,
"day" : 1,
"hours" : 0,
"minutes" : 0,
"seconds" : 0,
"milliseconds" : 0
},
"displayEnd" : {
"year" : 2017,
"month" : 12,
"day" : 12,
"hours" : 0,
"minutes" : 0,
"seconds" : 0,
"milliseconds" : 0
},
"seats": 2,
"state": "accepted"
},
"stock-reservation": {
"state": "accepted",
"quantity": 2
},
"listing" : {
"id" : "d892dfe6-9407-4400-9e81-8100d7a87b7f",
"title" : "Wooden sauna",
"private-data" : { },
"public-data" : { },
"metadata" : { },
"availability-plan" : {
"type" : "availability-plan/time",
"timezone" : "Europe/Helsinki"
},
"current-stock": {
"quantity": 10
}
},
"delayed-transition" : {
"run-at" : {
"year" : 2017,
"month" : 11,
"day" : 29,
"hours" : 0,
"minutes" : 0,
"seconds" : 0,
"milliseconds" : 0
}
},
"payout-total" : {
"amount" : 810,
"currency" : "USD"
},
"customer" : {
"id" : "ef7f40d5-da66-489a-957b-641313b68204",
"first-name" : "Jane",
"last-name" : "Pritchett",
"display-name" : "Jane P",
"public-data" : {
"phoneNumberVerified" : true
},
"protected-data" : {
"phoneNumber" : "789101112"
},
"private-data" : {
"language" : "fr"
},
"metadata" : {
"membership" : "standard"
}
},
"payin-total" : {
"amount" : 900,
"currency" : "USD"
},
"id" : "d8893061-c860-4e44-8d4d-61587a497e6e",
"reviews" : [ {
"subject" : {
"id" : "ef7f40d5-da66-489a-957b-641313b68204",
"first-name" : "Jane",
"last-name" : "Pritchett",
"display-name" : "Jane P",
"public-data" : {
"phoneNumberVerified" : true
},
"protected-data" : {
"phoneNumber" : "789101112"
},
"private-data" : {
"language" : "fr"
},
"metadata" : {
"membership" : "standard"
}
},
"content" : "Well done, customer Jane P!"
}, {
"subject" : {
"id" : "fd180cc2-a99c-4e43-b960-9b94daec5265",
"first-name" : "Joe",
"last-name" : "Dunphy",
"display-name" : "Joe D",
"public-data" : {
"phoneNumberVerified" : true
},
"protected-data" : {
"phoneNumber" : "123456"
},
"private-data" : {
"language" : "en"
},
"metadata" : {
"membership" : "premium"
}
},
"content" : "Good job, provider Joe D!"
} ],
"tx-line-items" : [
{
"code": "line-item/day",
"unit-price": { "amount": 2400, "currency": "USD" },
"units": 4,
"seats": 2,
"quantity": 6,
"include-for": [ "customer", "provider" ],
"line-total" : {
"amount" : 900,
"currency" : "USD"
}
},
{
"code" : "line-item/provider-commission",
"unit-price" : {
"amount" : 900,
"currency" : "USD"
},
"line-total" : {
"amount" : -90,
"currency" : "USD"
},
"include-for" : [ "provider" ],
"percentage" : -10
} ],
"provider" : {
"id" : "fd180cc2-a99c-4e43-b960-9b94daec5265",
"first-name" : "Joe",
"last-name" : "Dunphy",
"display-name" : "Joe D",
"public-data" : {
"phoneNumberVerified" : true
},
"protected-data" : {
"phoneNumber" : "123456"
},
"private-data" : {
"language" : "en"
},
"metadata" : {
"membership" : "premium"
}
},
"protected-data": {
"customerPhoneNumber": "123456"
},
"metadata": {
"discountCode": "abc-123"
}
}
}

0 comments on commit 49ba42c

Please sign in to comment.