-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PNR_Info service #13
base: mass-refactoring
Are you sure you want to change the base?
PNR_Info service #13
Changes from 1 commit
8173691
7cb307c
6ae820c
cf6e1f6
bbecf3b
c90777b
cfcb2c0
074d09d
9a13392
4804268
1eb476d
1c0bdf7
e924a5b
6af3efe
6048cf5
c9b4a60
3a8d88e
89d0479
3b955a5
9e29012
69652c3
52b9b98
6a2edef
cac9f47
8dcb91d
c251e9d
9ee8a84
0bbdbe9
af2a79d
1886525
83b7c9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,6 +164,8 @@ func (s *SOAP4Client) Call(soapUrl, soapAction, messageId string, query, reply i | |
return nil, err | ||
} | ||
|
||
fmt.Println("XML Response: ", string(rawbody)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. это в логи нужно. дебагом |
||
|
||
err = s.Logger.Push("inc", soapAction, string(rawbody)) | ||
if err != nil { | ||
_, _ = fmt.Fprintf(os.Stderr, "Failed to fire hook log_response: %v\n", err) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,14 @@ | ||
package configuration | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. не нужен конфиг тут от слова совсем! |
||
|
||
import ( | ||
"encoding/base64" | ||
"log" | ||
"os" | ||
var Config ConfigType | ||
|
||
"github.com/microparts/configuration-golang" | ||
"github.com/microparts/errors-go" | ||
"github.com/microparts/logs-go" | ||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
type connectionConfig struct { | ||
URL string `yaml:"url"` | ||
WSAP string `yaml:"wsap"` | ||
Originator string `yaml:"originator"` | ||
Password string `yaml:"password"` | ||
PasswordRaw string | ||
PinCode string `yaml:"pin_code"` | ||
VatURL string `yaml:"vat_url"` | ||
VatSOAPURL string `yaml:"vat_soap_url"` | ||
VatOfficeID string `yaml:"vat_office_id"` | ||
VatSign string `yaml:"vat_sign"` | ||
} | ||
|
||
type amadeusConfig struct { | ||
Connection connectionConfig `yaml:"connection"` | ||
MaxRecommendations int `yaml:"max_recommendations"` | ||
} | ||
|
||
type httpConfig struct { | ||
Host string `yaml:"host"` | ||
Port string `yaml:"port"` | ||
type ConfigType struct { | ||
Formats formatsConfig | ||
Provider string | ||
} | ||
|
||
type formatsConfig struct { | ||
Time string `yaml:"time"` | ||
Date string `yaml:"date"` | ||
XMLDate string `yaml:"xml_date"` | ||
} | ||
|
||
// CfgType service config structure | ||
type CfgType struct { | ||
Amadeus amadeusConfig `yaml:"amadeus"` | ||
HTTP httpConfig `yaml:"http"` | ||
Formats formatsConfig `yaml:"formats"` | ||
Queue queueConfig `yaml:"queue"` | ||
Log *logs.Config `yaml:"log"` | ||
Settings SettingsConfig `yaml:"settings"` | ||
Notifications NotificationsConfig `yaml:"notifications"` | ||
} | ||
|
||
type queueConfig struct { | ||
PubSub PubSubConfig `yaml:"pubsub"` | ||
} | ||
|
||
// PubSubConfig PubSub Config | ||
type PubSubConfig struct { | ||
Host string `yaml:"host"` | ||
ProjectID string `yaml:"project_id"` | ||
Topic string `yaml:"topic"` | ||
Subscription string `yaml:"subscription"` | ||
Key string `yaml:"key"` | ||
} | ||
|
||
// SettingsConfig Settings Config | ||
type SettingsConfig struct { | ||
FoidRequreAirlines []string `yaml:"foid_require_airlines"` | ||
RemoveDuplicateAirlines bool `yaml:"remove_duplicate_airlines"` | ||
MaxAttemptsCancelVoid int `yaml:"max_attempts_cancel_void"` | ||
MaxAttemptsDocIssuance int `yaml:"max_attempts_doc_issuance"` | ||
MaxAttemptsPNRRET int `yaml:"max_attempts_pnr_ret"` | ||
MaxAttemptsPNRADD int `yaml:"max_attempts_pnr_add"` | ||
IssueExpire int `yaml:"issue_expire"` | ||
BookingRequestsDelay int `yaml:"booking_requests_delay"` | ||
IssueRequestsDelay int `yaml:"issue_requests_delay"` | ||
FareRulesParagraphsToShow []string `yaml:"fare_rules_paragraphs_to_show"` | ||
FareQualifierList []string `yaml:"fare_qualifier_list"` | ||
} | ||
|
||
type NotificationsConfig struct { | ||
ErrorMessageEmail string `yaml:"error_message_email"` | ||
MailFrom string `yaml:"mail_from"` | ||
Queue PubSubConfig `yaml:"pubsub"` | ||
} | ||
|
||
var ( | ||
// Provider is current service | ||
Provider = "amadeus" | ||
) | ||
|
||
var Config *CfgType | ||
|
||
// InitConfig initialize config data | ||
func InitConfig() error { | ||
configPath := config.GetEnv("CONFIG_PATH", "") | ||
configBytes, err := config.ReadConfigs(configPath) | ||
if errors.HasErrors(err) { | ||
log.Printf("[config] read error: %+v", err) | ||
return err | ||
} | ||
|
||
err = yaml.Unmarshal(configBytes, &Config) | ||
if errors.HasErrors(err) { | ||
log.Printf("[config] unmarshal error for bytes: %+v", configBytes) | ||
return err | ||
} | ||
// | ||
// structs.TimeFormat = func() string { | ||
// return Config.Formats.Time | ||
// } | ||
// | ||
// structs.DateFormat = func() string { | ||
// return Config.Formats.Date | ||
// } | ||
|
||
if pwdBytes, err := base64.StdEncoding.DecodeString(Config.Amadeus.Connection.Password); err == nil { | ||
Config.Amadeus.Connection.PasswordRaw = string(pwdBytes) | ||
} else { | ||
log.Println("Error decoding password. Is it not encrypted in bass64?") | ||
os.Exit(-1) | ||
} | ||
|
||
return nil | ||
Time string | ||
Date string | ||
XMLDate string | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -630,7 +630,7 @@ func ParseReply(request *search.SearchRequest, reply *Response) (*search.SearchR | |
|
||
var recommendation = &search.Recommendation{ | ||
ID: recommendationID, | ||
Provider: configuration.Provider, | ||
Provider: configuration.Config.Provider, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Конфиг не нужен. из свойств клиента брать. |
||
Class: recClass, | ||
ItinerarySegments: routesSegments, | ||
ValidatingAirline: structsCommon.Airline{}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не надо так. Опции -- для опций. Тут не нужно передавать структурой целой конфиг. Если нужен формат -- сделай "setTimeFormat" функцию и всё. По-дефолту формат в свойство клиента и переопределяй опцией.