Skip to content

Commit

Permalink
Merge pull request #233 from vtex-apps/fix/addHolidays
Browse files Browse the repository at this point in the history
Fix/add holidays
  • Loading branch information
lucvysk authored Dec 19, 2023
2 parents b272a44 + a696fd9 commit cddcb95
Showing 5 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- https avoiding tls

## [0.14.0] - 2023-12-14

### Added
2 changes: 1 addition & 1 deletion checkout-ui-custom/checkout6-custom.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion checkout-ui-custom/src/_js/_v.custom.checkout.ui.js
Original file line number Diff line number Diff line change
@@ -569,10 +569,15 @@ class checkoutCustom {
)

let bdHolidays = 0
if(_this._holidays) {
if(_this._holidays ) {
bdHolidays = _this.holidaysBetweenDates(new Date(), d, _this._holidays.map( hd => hd.startDate.split("T")[0] ))
}

if(
_this._holidays &&
_this._holidays.name=="Error"
) bdHolidays = 0

let dhd = new Date()
if(bdHolidays) {
dhd = new Date(dhd.getTime())
6 changes: 3 additions & 3 deletions node/middlewares/holidays.ts
Original file line number Diff line number Diff line change
@@ -12,11 +12,12 @@ export async function holidays(ctx: Context) {

// const { consultantId } = await json(req)

const holidaysUrl = `https://${account}.vtexcommercestable.com.br/api/logistics/pvt/configuration/holidays`
const holidaysUrl = `http://${account}.vtexcommercestable.com.br/api/logistics/pvt/configuration/holidays`

const { data: _holidays } = await axios.get(holidaysUrl, {
headers: {
VtexIdclientAutCookie: authToken,
'VtexIdclientAutCookie': authToken,
'X-Vtex-Use-Https': 'true'
},
})

@@ -26,7 +27,6 @@ export async function holidays(ctx: Context) {
let result = _holidays;
if(!holidays) result = "no holidays"


ctx.response.status = 200
ctx.response.body = result
}
2 changes: 1 addition & 1 deletion node/templates/checkout6-custom.js

Large diffs are not rendered by default.

0 comments on commit cddcb95

Please sign in to comment.