mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* Move all public connectors to ce/plugins * Update tooling to account for new go modules under ce * Ensure we test all CE plugins in CI * Move Dummypay to ce/plugins for simplicity's sake in the generation scripts * Use versioned pkg/domain in plugins * Ensure that renovate updates all CE plugins in a single PR when pkg/domain tags are pushed to github * Ensure Justfile commands work over all CE plugins * Copy ce plugin go.mods in dev.Dockerfile * Only add a go.mod for new plugins if they are ce * Ensure generated generic client structs are named correctly for submodule * Add coverprofile for each ce plugin * Add set -e for Justfile for loops over plugins * Infer go version from flake.nix in connector template tool
33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
package client
|
|
|
|
import "time"
|
|
|
|
// ConvertPowensTimeToUTC converts a date string to UTC, assuming it is in Europe/Paris
|
|
// Powens sends date fields in Europe/Paris timezone (without offset).
|
|
// Parse in that location and convert to UTC for a consistent internal representation.
|
|
func ConvertPowensTimeToUTC(input string, format string) (time.Time, error) {
|
|
loc, err := time.LoadLocation("Europe/Paris")
|
|
if err != nil {
|
|
return time.Time{}, err
|
|
}
|
|
|
|
tm, err := time.ParseInLocation(format, input, loc)
|
|
if err != nil {
|
|
return time.Time{}, err
|
|
}
|
|
return tm.UTC(), nil
|
|
}
|
|
|
|
// ConvertUTCToPowensTime converts a date in UTC to Powens string format, while making sure
|
|
// that format is in Europe/Paris timezone (without offset).
|
|
// Powens expects naive local time strings (Europe/Paris) like "2006-01-02 15:04:05".
|
|
// We therefore convert the UTC time to Europe/Paris and format it without any offset.
|
|
func ConvertUTCToPowensTime(input time.Time, format string) (string, error) {
|
|
loc, err := time.LoadLocation("Europe/Paris")
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
paris := input.In(loc)
|
|
return paris.Format(format), nil
|
|
}
|