Skip to content

Add groundClose method for Ground End of Day Close API#3

Merged
freshlogic merged 6 commits into
mainfrom
add-close
May 15, 2026
Merged

Add groundClose method for Ground End of Day Close API#3
freshlogic merged 6 commits into
mainfrom
add-close

Conversation

@farhatraiyan
Copy link
Copy Markdown
Collaborator

@farhatraiyan farhatraiyan commented May 14, 2026

Summary

  • Add groundClose(closeRequest, options) — calls the FedEx Ground End of Day Close API (PUT /ship/v1/endofday/). Same passthrough pattern as the other methods: caller supplies the full request body, the package forwards it verbatim.
  • Includes 1 live sandbox test and 4 mocked tests (verbatim body forwarding, customer_transaction_id header + PUT method, 200-with-errors envelope, non-2xx response).
  • Version bumped to 0.4.0.

Migration notes for fulfillment-service

The SOAP groundclose call maps to REST as follows:

SOAP REST
Account number via client constructor accountNumber: { value } in request body
TimeUpToWhichShipmentsAreToBeClosed (ISO datetime) closeDate (YYYY-MM-DD date only)
(implicit) closeReqType: 'GCDR'
(implicit) groundServiceCategory: 'GROUND'

SmartPost close has no REST equivalent

The FedEx REST Close API (/ship/v1/endofday/) only supports Ground close (GCDR). There is no SPCLOSE or SmartPost-specific close operation. The fulfillment-service's smartpostclose cron (fedEx.js:68) will need a different approach when migrating off SOAP.

Other callouts

  • HTTP method is PUT, not POSTPOST on the same endpoint is for reprinting end-of-day documents (RGCDR), not closing. This is unusual for a create-like operation and easy to get wrong.
  • closeDate is date-only — the SOAP field accepted a full ISO datetime; the REST field is YYYY-MM-DD. The test uses new Date().toISOString().slice(0, 10).
  • Trailing slash on endpoint — the official spec uses /ship/v1/endofday/ (with trailing slash). Requests without it may behave differently.

Test plan

  • Live sandbox test passes (groundClose with GCDR against apis-sandbox.fedex.com)
  • 4 mocked unit tests pass (body forwarding, headers/method, error envelope, non-2xx)
  • All 42 tests pass (26 existing + 16 new including live + mocked)
  • ESLint clean
  • Methods, tests, README sections, and keywords are alphabetized

🤖 Generated with Claude Code

farhatraiyan and others added 3 commits May 14, 2026 10:00
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…CCLOSE, rename to groundClose

The FedEx Ground End of Day Close API uses PUT /ship/v1/endofday/ for close
operations (POST is for reprinting). The closeReqType is GCDR, and
groundServiceCategory + closeDate are required fields. There is no
SmartPost-specific close in the REST API. Renamed method from close to
groundClose to match the API scope and align with fulfillment-service
consumption patterns. All methods, tests, and docs are alphabetized.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coveralls
Copy link
Copy Markdown

coveralls commented May 14, 2026

Coverage Report for CI Build 25896737409

Coverage remained the same at 100.0%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 46 of 46 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 279
Covered Lines: 279
Line Coverage: 100.0%
Relevant Branches: 43
Covered Branches: 43
Branch Coverage: 100.0%
Branches in Coverage %: Yes
Coverage Strength: 14.67 hits per line

💛 - Coveralls

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
farhatraiyan and others added 2 commits May 14, 2026 16:17
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mirrors the FedEx API name ("Ground End of Day Close") in the method
symbol the same way the other methods do (cancelShipment, createShipment,
etc.).

- index.js: this.groundClose -> this.groundEndOfDayClose
- README.md / CHANGELOG.md: section heading + code examples
- test/index.js: outer test() block names + fedex.* call sites
- package.json: keyword "ground-close" -> "ground-end-of-day-close"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@freshlogic freshlogic merged commit a5e3bf8 into main May 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants