From 6a2fcc81279540e60934fbe6d1f5e4289233abe5 Mon Sep 17 00:00:00 2001 From: harakeishi Date: Wed, 12 Jun 2024 16:57:36 +0900 Subject: [PATCH] ADD `PUT /payments/{id}/auth` --- api/oas_client_gen.go | 128 ++ api/oas_handlers_gen.go | 168 +++ api/oas_interfaces_gen.go | 4 + api/oas_json_gen.go | 2094 +++++++++++++++++++++++++++--- api/oas_parameters_gen.go | 65 + api/oas_request_decoders_gen.go | 71 + api/oas_request_encoders_gen.go | 14 + api/oas_response_decoders_gen.go | 94 ++ api/oas_response_encoders_gen.go | 33 + api/oas_router_gen.go | 128 +- api/oas_schemas_gen.go | 1877 +++++++++++++++++++++++--- api/oas_server_gen.go | 4 + api/oas_unimplemented_gen.go | 7 + api/oas_validators_gen.go | 458 +++++++ spec/openapi3.yml | 201 +++ 15 files changed, 4937 insertions(+), 409 deletions(-) diff --git a/api/oas_client_gen.go b/api/oas_client_gen.go index 0d31939..a49c089 100644 --- a/api/oas_client_gen.go +++ b/api/oas_client_gen.go @@ -59,6 +59,10 @@ type Invoker interface { // // GET /payments PaymentsGet(ctx context.Context, params PaymentsGetParams) (PaymentsGetRes, error) + // PaymentsIDAuthPut invokes PUT /payments/{id}/auth operation. + // + // PUT /payments/{id}/auth + PaymentsIDAuthPut(ctx context.Context, request PaymentsIDAuthPutReq, params PaymentsIDAuthPutParams) (PaymentsIDAuthPutRes, error) // PaymentsIDCancelPut invokes PUT /payments/{id}/cancel operation. // // PUT /payments/{id}/cancel @@ -1561,6 +1565,130 @@ func (c *Client) sendPaymentsGet(ctx context.Context, params PaymentsGetParams) return result, nil } +// PaymentsIDAuthPut invokes PUT /payments/{id}/auth operation. +// +// PUT /payments/{id}/auth +func (c *Client) PaymentsIDAuthPut(ctx context.Context, request PaymentsIDAuthPutReq, params PaymentsIDAuthPutParams) (PaymentsIDAuthPutRes, error) { + res, err := c.sendPaymentsIDAuthPut(ctx, request, params) + return res, err +} + +func (c *Client) sendPaymentsIDAuthPut(ctx context.Context, request PaymentsIDAuthPutReq, params PaymentsIDAuthPutParams) (res PaymentsIDAuthPutRes, err error) { + otelAttrs := []attribute.KeyValue{ + semconv.HTTPMethodKey.String("PUT"), + semconv.HTTPRouteKey.String("/payments/{id}/auth"), + } + + // Run stopwatch. + startTime := time.Now() + defer func() { + // Use floating point division here for higher precision (instead of Millisecond method). + elapsedDuration := time.Since(startTime) + c.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + }() + + // Increment request counter. + c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) + + // Start a span for this request. + ctx, span := c.cfg.Tracer.Start(ctx, "PaymentsIDAuthPut", + trace.WithAttributes(otelAttrs...), + clientSpanKind, + ) + // Track stage for error reporting. + var stage string + defer func() { + if err != nil { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + c.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) + } + span.End() + }() + + stage = "BuildURL" + u := uri.Clone(c.requestURL(ctx)) + var pathParts [3]string + pathParts[0] = "/payments/" + { + // Encode "id" parameter. + e := uri.NewPathEncoder(uri.PathEncoderConfig{ + Param: "id", + Style: uri.PathStyleSimple, + Explode: false, + }) + if err := func() error { + return e.EncodeValue(conv.StringToString(params.ID)) + }(); err != nil { + return res, errors.Wrap(err, "encode path") + } + encoded, err := e.Result() + if err != nil { + return res, errors.Wrap(err, "encode path") + } + pathParts[1] = encoded + } + pathParts[2] = "/auth" + uri.AddPathParts(u, pathParts[:]...) + + stage = "EncodeRequest" + r, err := ht.NewRequest(ctx, "PUT", u) + if err != nil { + return res, errors.Wrap(err, "create request") + } + if err := encodePaymentsIDAuthPutRequest(request, r); err != nil { + return res, errors.Wrap(err, "encode request") + } + + { + type bitset = [1]uint8 + var satisfied bitset + { + stage = "Security:BearerAuth" + switch err := c.securityBearerAuth(ctx, "PaymentsIDAuthPut", r); { + case err == nil: // if NO error + satisfied[0] |= 1 << 0 + case errors.Is(err, ogenerrors.ErrSkipClientSecurity): + // Skip this security. + default: + return res, errors.Wrap(err, "security \"BearerAuth\"") + } + } + + if ok := func() bool { + nextRequirement: + for _, requirement := range []bitset{ + {0b00000001}, + } { + for i, mask := range requirement { + if satisfied[i]&mask != mask { + continue nextRequirement + } + } + return true + } + return false + }(); !ok { + return res, ogenerrors.ErrSecurityRequirementIsNotSatisfied + } + } + + stage = "SendRequest" + resp, err := c.cfg.Client.Do(r) + if err != nil { + return res, errors.Wrap(err, "do request") + } + defer resp.Body.Close() + + stage = "DecodeResponse" + result, err := decodePaymentsIDAuthPutResponse(resp) + if err != nil { + return res, errors.Wrap(err, "decode response") + } + + return result, nil +} + // PaymentsIDCancelPut invokes PUT /payments/{id}/cancel operation. // // PUT /payments/{id}/cancel diff --git a/api/oas_handlers_gen.go b/api/oas_handlers_gen.go index d0ebf6f..a4d2013 100644 --- a/api/oas_handlers_gen.go +++ b/api/oas_handlers_gen.go @@ -1495,6 +1495,174 @@ func (s *Server) handlePaymentsGetRequest(args [0]string, argsEscaped bool, w ht } } +// handlePaymentsIDAuthPutRequest handles PUT /payments/{id}/auth operation. +// +// PUT /payments/{id}/auth +func (s *Server) handlePaymentsIDAuthPutRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + semconv.HTTPMethodKey.String("PUT"), + semconv.HTTPRouteKey.String("/payments/{id}/auth"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "PaymentsIDAuthPut", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Add Labeler to context. + labeler := &Labeler{attrs: otelAttrs} + ctx = contextWithLabeler(ctx, labeler) + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + attrOpt := metric.WithAttributeSet(labeler.AttributeSet()) + + // Increment request counter. + s.requests.Add(ctx, 1, attrOpt) + + // Use floating point division here for higher precision (instead of Millisecond method). + s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), attrOpt) + }() + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, metric.WithAttributeSet(labeler.AttributeSet())) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "PaymentsIDAuthPut", + ID: "", + } + ) + { + type bitset = [1]uint8 + var satisfied bitset + { + sctx, ok, err := s.securityBearerAuth(ctx, "PaymentsIDAuthPut", r) + if err != nil { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Security: "BearerAuth", + Err: err, + } + defer recordError("Security:BearerAuth", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + if ok { + satisfied[0] |= 1 << 0 + ctx = sctx + } + } + + if ok := func() bool { + nextRequirement: + for _, requirement := range []bitset{ + {0b00000001}, + } { + for i, mask := range requirement { + if satisfied[i]&mask != mask { + continue nextRequirement + } + } + return true + } + return false + }(); !ok { + err = &ogenerrors.SecurityError{ + OperationContext: opErrContext, + Err: ogenerrors.ErrSecurityRequirementIsNotSatisfied, + } + defer recordError("Security", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + } + params, err := decodePaymentsIDAuthPutParams(args, argsEscaped, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + defer recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + request, close, err := s.decodePaymentsIDAuthPutRequest(r) + if err != nil { + err = &ogenerrors.DecodeRequestError{ + OperationContext: opErrContext, + Err: err, + } + defer recordError("DecodeRequest", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + defer func() { + if err := close(); err != nil { + recordError("CloseRequest", err) + } + }() + + var response PaymentsIDAuthPutRes + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "PaymentsIDAuthPut", + OperationSummary: "", + OperationID: "", + Body: request, + Params: middleware.Parameters{ + { + Name: "id", + In: "path", + }: params.ID, + }, + Raw: r, + } + + type ( + Request = PaymentsIDAuthPutReq + Params = PaymentsIDAuthPutParams + Response = PaymentsIDAuthPutRes + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackPaymentsIDAuthPutParams, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.PaymentsIDAuthPut(ctx, request, params) + return response, err + }, + ) + } else { + response, err = s.h.PaymentsIDAuthPut(ctx, request, params) + } + if err != nil { + defer recordError("Internal", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + if err := encodePaymentsIDAuthPutResponse(response, w, span); err != nil { + defer recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + // handlePaymentsIDCancelPutRequest handles PUT /payments/{id}/cancel operation. // // PUT /payments/{id}/cancel diff --git a/api/oas_interfaces_gen.go b/api/oas_interfaces_gen.go index 93bdc19..b875cc7 100644 --- a/api/oas_interfaces_gen.go +++ b/api/oas_interfaces_gen.go @@ -37,6 +37,10 @@ type PaymentsGetRes interface { paymentsGetRes() } +type PaymentsIDAuthPutRes interface { + paymentsIDAuthPutRes() +} + type PaymentsIDCancelPutRes interface { paymentsIDCancelPutRes() } diff --git a/api/oas_json_gen.go b/api/oas_json_gen.go index de8b1bd..6688c89 100644 --- a/api/oas_json_gen.go +++ b/api/oas_json_gen.go @@ -2356,6 +2356,202 @@ func (s *OptInt) UnmarshalJSON(data []byte) error { return s.Decode(d) } +// Encode encodes PaymentAuthCardResponseMethod as json. +func (o OptNilPaymentAuthCardResponseMethod) Encode(e *jx.Encoder) { + if !o.Set { + return + } + if o.Null { + e.Null() + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentAuthCardResponseMethod from json. +func (o *OptNilPaymentAuthCardResponseMethod) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptNilPaymentAuthCardResponseMethod to nil") + } + if d.Next() == jx.Null { + if err := d.Null(); err != nil { + return err + } + + var v PaymentAuthCardResponseMethod + o.Value = v + o.Set = true + o.Null = true + return nil + } + o.Set = true + o.Null = false + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptNilPaymentAuthCardResponseMethod) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptNilPaymentAuthCardResponseMethod) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentAuthCardResponseTds2Status as json. +func (o OptNilPaymentAuthCardResponseTds2Status) Encode(e *jx.Encoder) { + if !o.Set { + return + } + if o.Null { + e.Null() + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentAuthCardResponseTds2Status from json. +func (o *OptNilPaymentAuthCardResponseTds2Status) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptNilPaymentAuthCardResponseTds2Status to nil") + } + if d.Next() == jx.Null { + if err := d.Null(); err != nil { + return err + } + + var v PaymentAuthCardResponseTds2Status + o.Value = v + o.Set = true + o.Null = true + return nil + } + o.Set = true + o.Null = false + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptNilPaymentAuthCardResponseTds2Status) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptNilPaymentAuthCardResponseTds2Status) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentAuthCardResponseTds2Type as json. +func (o OptNilPaymentAuthCardResponseTds2Type) Encode(e *jx.Encoder) { + if !o.Set { + return + } + if o.Null { + e.Null() + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentAuthCardResponseTds2Type from json. +func (o *OptNilPaymentAuthCardResponseTds2Type) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptNilPaymentAuthCardResponseTds2Type to nil") + } + if d.Next() == jx.Null { + if err := d.Null(); err != nil { + return err + } + + var v PaymentAuthCardResponseTds2Type + o.Value = v + o.Set = true + o.Null = true + return nil + } + o.Set = true + o.Null = false + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptNilPaymentAuthCardResponseTds2Type) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptNilPaymentAuthCardResponseTds2Type) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentAuthCardResponseTdsType as json. +func (o OptNilPaymentAuthCardResponseTdsType) Encode(e *jx.Encoder) { + if !o.Set { + return + } + if o.Null { + e.Null() + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentAuthCardResponseTdsType from json. +func (o *OptNilPaymentAuthCardResponseTdsType) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptNilPaymentAuthCardResponseTdsType to nil") + } + if d.Next() == jx.Null { + if err := d.Null(); err != nil { + return err + } + + var v PaymentAuthCardResponseTdsType + o.Value = v + o.Set = true + o.Null = true + return nil + } + o.Set = true + o.Null = false + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptNilPaymentAuthCardResponseTdsType) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptNilPaymentAuthCardResponseTdsType) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + // Encode encodes PaymentCancelCardResponseMethod as json. func (o OptNilPaymentCancelCardResponseMethod) Encode(e *jx.Encoder) { if !o.Set { @@ -4122,18 +4318,18 @@ func (s *OptNilString) UnmarshalJSON(data []byte) error { return s.Decode(d) } -// Encode encodes PaymentCancelCardResponseJobCode as json. -func (o OptPaymentCancelCardResponseJobCode) Encode(e *jx.Encoder) { +// Encode encodes PaymentAuthCardPayTimes as json. +func (o OptPaymentAuthCardPayTimes) Encode(e *jx.Encoder) { if !o.Set { return } e.Str(string(o.Value)) } -// Decode decodes PaymentCancelCardResponseJobCode from json. -func (o *OptPaymentCancelCardResponseJobCode) Decode(d *jx.Decoder) error { +// Decode decodes PaymentAuthCardPayTimes from json. +func (o *OptPaymentAuthCardPayTimes) Decode(d *jx.Decoder) error { if o == nil { - return errors.New("invalid: unable to decode OptPaymentCancelCardResponseJobCode to nil") + return errors.New("invalid: unable to decode OptPaymentAuthCardPayTimes to nil") } o.Set = true if err := o.Value.Decode(d); err != nil { @@ -4143,30 +4339,30 @@ func (o *OptPaymentCancelCardResponseJobCode) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentCancelCardResponseJobCode) MarshalJSON() ([]byte, error) { +func (s OptPaymentAuthCardPayTimes) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentCancelCardResponseJobCode) UnmarshalJSON(data []byte) error { +func (s *OptPaymentAuthCardPayTimes) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentCancelCardResponsePayType as json. -func (o OptPaymentCancelCardResponsePayType) Encode(e *jx.Encoder) { +// Encode encodes PaymentAuthCardResponseJobCode as json. +func (o OptPaymentAuthCardResponseJobCode) Encode(e *jx.Encoder) { if !o.Set { return } e.Str(string(o.Value)) } -// Decode decodes PaymentCancelCardResponsePayType from json. -func (o *OptPaymentCancelCardResponsePayType) Decode(d *jx.Decoder) error { +// Decode decodes PaymentAuthCardResponseJobCode from json. +func (o *OptPaymentAuthCardResponseJobCode) Decode(d *jx.Decoder) error { if o == nil { - return errors.New("invalid: unable to decode OptPaymentCancelCardResponsePayType to nil") + return errors.New("invalid: unable to decode OptPaymentAuthCardResponseJobCode to nil") } o.Set = true if err := o.Value.Decode(d); err != nil { @@ -4176,30 +4372,30 @@ func (o *OptPaymentCancelCardResponsePayType) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentCancelCardResponsePayType) MarshalJSON() ([]byte, error) { +func (s OptPaymentAuthCardResponseJobCode) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentCancelCardResponsePayType) UnmarshalJSON(data []byte) error { +func (s *OptPaymentAuthCardResponseJobCode) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentCancelCardResponseStatus as json. -func (o OptPaymentCancelCardResponseStatus) Encode(e *jx.Encoder) { +// Encode encodes PaymentAuthCardResponsePayType as json. +func (o OptPaymentAuthCardResponsePayType) Encode(e *jx.Encoder) { if !o.Set { return } e.Str(string(o.Value)) } -// Decode decodes PaymentCancelCardResponseStatus from json. -func (o *OptPaymentCancelCardResponseStatus) Decode(d *jx.Decoder) error { +// Decode decodes PaymentAuthCardResponsePayType from json. +func (o *OptPaymentAuthCardResponsePayType) Decode(d *jx.Decoder) error { if o == nil { - return errors.New("invalid: unable to decode OptPaymentCancelCardResponseStatus to nil") + return errors.New("invalid: unable to decode OptPaymentAuthCardResponsePayType to nil") } o.Set = true if err := o.Value.Decode(d); err != nil { @@ -4209,30 +4405,30 @@ func (o *OptPaymentCancelCardResponseStatus) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentCancelCardResponseStatus) MarshalJSON() ([]byte, error) { +func (s OptPaymentAuthCardResponsePayType) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentCancelCardResponseStatus) UnmarshalJSON(data []byte) error { +func (s *OptPaymentAuthCardResponsePayType) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentCardResponseJobCode as json. -func (o OptPaymentCardResponseJobCode) Encode(e *jx.Encoder) { +// Encode encodes PaymentAuthCardResponseStatus as json. +func (o OptPaymentAuthCardResponseStatus) Encode(e *jx.Encoder) { if !o.Set { return } e.Str(string(o.Value)) } -// Decode decodes PaymentCardResponseJobCode from json. -func (o *OptPaymentCardResponseJobCode) Decode(d *jx.Decoder) error { +// Decode decodes PaymentAuthCardResponseStatus from json. +func (o *OptPaymentAuthCardResponseStatus) Decode(d *jx.Decoder) error { if o == nil { - return errors.New("invalid: unable to decode OptPaymentCardResponseJobCode to nil") + return errors.New("invalid: unable to decode OptPaymentAuthCardResponseStatus to nil") } o.Set = true if err := o.Value.Decode(d); err != nil { @@ -4242,30 +4438,30 @@ func (o *OptPaymentCardResponseJobCode) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentCardResponseJobCode) MarshalJSON() ([]byte, error) { +func (s OptPaymentAuthCardResponseStatus) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentCardResponseJobCode) UnmarshalJSON(data []byte) error { +func (s *OptPaymentAuthCardResponseStatus) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentCardResponsePayType as json. -func (o OptPaymentCardResponsePayType) Encode(e *jx.Encoder) { +// Encode encodes PaymentCancelCardResponseJobCode as json. +func (o OptPaymentCancelCardResponseJobCode) Encode(e *jx.Encoder) { if !o.Set { return } e.Str(string(o.Value)) } -// Decode decodes PaymentCardResponsePayType from json. -func (o *OptPaymentCardResponsePayType) Decode(d *jx.Decoder) error { +// Decode decodes PaymentCancelCardResponseJobCode from json. +func (o *OptPaymentCancelCardResponseJobCode) Decode(d *jx.Decoder) error { if o == nil { - return errors.New("invalid: unable to decode OptPaymentCardResponsePayType to nil") + return errors.New("invalid: unable to decode OptPaymentCancelCardResponseJobCode to nil") } o.Set = true if err := o.Value.Decode(d); err != nil { @@ -4275,30 +4471,30 @@ func (o *OptPaymentCardResponsePayType) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentCardResponsePayType) MarshalJSON() ([]byte, error) { +func (s OptPaymentCancelCardResponseJobCode) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentCardResponsePayType) UnmarshalJSON(data []byte) error { +func (s *OptPaymentCancelCardResponseJobCode) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentCardResponseStatus as json. -func (o OptPaymentCardResponseStatus) Encode(e *jx.Encoder) { +// Encode encodes PaymentCancelCardResponsePayType as json. +func (o OptPaymentCancelCardResponsePayType) Encode(e *jx.Encoder) { if !o.Set { return } e.Str(string(o.Value)) } -// Decode decodes PaymentCardResponseStatus from json. -func (o *OptPaymentCardResponseStatus) Decode(d *jx.Decoder) error { +// Decode decodes PaymentCancelCardResponsePayType from json. +func (o *OptPaymentCancelCardResponsePayType) Decode(d *jx.Decoder) error { if o == nil { - return errors.New("invalid: unable to decode OptPaymentCardResponseStatus to nil") + return errors.New("invalid: unable to decode OptPaymentCancelCardResponsePayType to nil") } o.Set = true if err := o.Value.Decode(d); err != nil { @@ -4308,30 +4504,30 @@ func (o *OptPaymentCardResponseStatus) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentCardResponseStatus) MarshalJSON() ([]byte, error) { +func (s OptPaymentCancelCardResponsePayType) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentCardResponseStatus) UnmarshalJSON(data []byte) error { +func (s *OptPaymentCancelCardResponsePayType) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentCardTdsType as json. -func (o OptPaymentCardTdsType) Encode(e *jx.Encoder) { +// Encode encodes PaymentCancelCardResponseStatus as json. +func (o OptPaymentCancelCardResponseStatus) Encode(e *jx.Encoder) { if !o.Set { return } e.Str(string(o.Value)) } -// Decode decodes PaymentCardTdsType from json. -func (o *OptPaymentCardTdsType) Decode(d *jx.Decoder) error { +// Decode decodes PaymentCancelCardResponseStatus from json. +func (o *OptPaymentCancelCardResponseStatus) Decode(d *jx.Decoder) error { if o == nil { - return errors.New("invalid: unable to decode OptPaymentCardTdsType to nil") + return errors.New("invalid: unable to decode OptPaymentCancelCardResponseStatus to nil") } o.Set = true if err := o.Value.Decode(d); err != nil { @@ -4341,30 +4537,30 @@ func (o *OptPaymentCardTdsType) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentCardTdsType) MarshalJSON() ([]byte, error) { +func (s OptPaymentCancelCardResponseStatus) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentCardTdsType) UnmarshalJSON(data []byte) error { +func (s *OptPaymentCancelCardResponseStatus) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentDirectdebitResponsePayType as json. -func (o OptPaymentDirectdebitResponsePayType) Encode(e *jx.Encoder) { +// Encode encodes PaymentCardResponseJobCode as json. +func (o OptPaymentCardResponseJobCode) Encode(e *jx.Encoder) { if !o.Set { return } e.Str(string(o.Value)) } -// Decode decodes PaymentDirectdebitResponsePayType from json. -func (o *OptPaymentDirectdebitResponsePayType) Decode(d *jx.Decoder) error { +// Decode decodes PaymentCardResponseJobCode from json. +func (o *OptPaymentCardResponseJobCode) Decode(d *jx.Decoder) error { if o == nil { - return errors.New("invalid: unable to decode OptPaymentDirectdebitResponsePayType to nil") + return errors.New("invalid: unable to decode OptPaymentCardResponseJobCode to nil") } o.Set = true if err := o.Value.Decode(d); err != nil { @@ -4374,28 +4570,160 @@ func (o *OptPaymentDirectdebitResponsePayType) Decode(d *jx.Decoder) error { } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentDirectdebitResponsePayType) MarshalJSON() ([]byte, error) { +func (s OptPaymentCardResponseJobCode) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentDirectdebitResponsePayType) UnmarshalJSON(data []byte) error { +func (s *OptPaymentCardResponseJobCode) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentDirectdebitResponseResultCode as json. -func (o OptPaymentDirectdebitResponseResultCode) Encode(e *jx.Encoder) { +// Encode encodes PaymentCardResponsePayType as json. +func (o OptPaymentCardResponsePayType) Encode(e *jx.Encoder) { if !o.Set { return } e.Str(string(o.Value)) } -// Decode decodes PaymentDirectdebitResponseResultCode from json. -func (o *OptPaymentDirectdebitResponseResultCode) Decode(d *jx.Decoder) error { +// Decode decodes PaymentCardResponsePayType from json. +func (o *OptPaymentCardResponsePayType) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptPaymentCardResponsePayType to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptPaymentCardResponsePayType) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptPaymentCardResponsePayType) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentCardResponseStatus as json. +func (o OptPaymentCardResponseStatus) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentCardResponseStatus from json. +func (o *OptPaymentCardResponseStatus) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptPaymentCardResponseStatus to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptPaymentCardResponseStatus) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptPaymentCardResponseStatus) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentCardTdsType as json. +func (o OptPaymentCardTdsType) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentCardTdsType from json. +func (o *OptPaymentCardTdsType) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptPaymentCardTdsType to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptPaymentCardTdsType) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptPaymentCardTdsType) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentDirectdebitResponsePayType as json. +func (o OptPaymentDirectdebitResponsePayType) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentDirectdebitResponsePayType from json. +func (o *OptPaymentDirectdebitResponsePayType) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptPaymentDirectdebitResponsePayType to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptPaymentDirectdebitResponsePayType) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptPaymentDirectdebitResponsePayType) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentDirectdebitResponseResultCode as json. +func (o OptPaymentDirectdebitResponseResultCode) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentDirectdebitResponseResultCode from json. +func (o *OptPaymentDirectdebitResponseResultCode) Decode(d *jx.Decoder) error { if o == nil { return errors.New("invalid: unable to decode OptPaymentDirectdebitResponseResultCode to nil") } @@ -4787,296 +5115,1578 @@ func (o OptPaymentMethodDirectDebitResponseDirectdebitAccountType) Encode(e *jx. if !o.Set { return } - e.Str(string(o.Value)) -} + e.Str(string(o.Value)) +} + +// Decode decodes PaymentMethodDirectDebitResponseDirectdebitAccountType from json. +func (o *OptPaymentMethodDirectDebitResponseDirectdebitAccountType) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseDirectdebitAccountType to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptPaymentMethodDirectDebitResponseDirectdebitAccountType) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptPaymentMethodDirectDebitResponseDirectdebitAccountType) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentMethodDirectDebitResponseDirectdebitApplicationType as json. +func (o OptPaymentMethodDirectDebitResponseDirectdebitApplicationType) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentMethodDirectDebitResponseDirectdebitApplicationType from json. +func (o *OptPaymentMethodDirectDebitResponseDirectdebitApplicationType) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseDirectdebitApplicationType to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptPaymentMethodDirectDebitResponseDirectdebitApplicationType) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptPaymentMethodDirectDebitResponseDirectdebitApplicationType) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentMethodDirectDebitResponseDirectdebitBankType as json. +func (o OptPaymentMethodDirectDebitResponseDirectdebitBankType) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentMethodDirectDebitResponseDirectdebitBankType from json. +func (o *OptPaymentMethodDirectDebitResponseDirectdebitBankType) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseDirectdebitBankType to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptPaymentMethodDirectDebitResponseDirectdebitBankType) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptPaymentMethodDirectDebitResponseDirectdebitBankType) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentMethodDirectDebitResponseDirectdebitLastResultCode as json. +func (o OptPaymentMethodDirectDebitResponseDirectdebitLastResultCode) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentMethodDirectDebitResponseDirectdebitLastResultCode from json. +func (o *OptPaymentMethodDirectDebitResponseDirectdebitLastResultCode) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseDirectdebitLastResultCode to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptPaymentMethodDirectDebitResponseDirectdebitLastResultCode) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptPaymentMethodDirectDebitResponseDirectdebitLastResultCode) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentMethodDirectDebitResponseDirectdebitPaperApplication as json. +func (o OptPaymentMethodDirectDebitResponseDirectdebitPaperApplication) Encode(e *jx.Encoder) { + if !o.Set { + return + } + o.Value.Encode(e) +} + +// Decode decodes PaymentMethodDirectDebitResponseDirectdebitPaperApplication from json. +func (o *OptPaymentMethodDirectDebitResponseDirectdebitPaperApplication) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseDirectdebitPaperApplication to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptPaymentMethodDirectDebitResponseDirectdebitPaperApplication) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptPaymentMethodDirectDebitResponseDirectdebitPaperApplication) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentMethodDirectDebitResponsePayType as json. +func (o OptPaymentMethodDirectDebitResponsePayType) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentMethodDirectDebitResponsePayType from json. +func (o *OptPaymentMethodDirectDebitResponsePayType) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponsePayType to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptPaymentMethodDirectDebitResponsePayType) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptPaymentMethodDirectDebitResponsePayType) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentMethodDirectDebitResponseRedirectURLAccessedFlag as json. +func (o OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentMethodDirectDebitResponseRedirectURLAccessedFlag from json. +func (o *OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentMethodDirectDebitResponseStatus as json. +func (o OptPaymentMethodDirectDebitResponseStatus) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes PaymentMethodDirectDebitResponseStatus from json. +func (o *OptPaymentMethodDirectDebitResponseStatus) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseStatus to nil") + } + o.Set = true + if err := o.Value.Decode(d); err != nil { + return err + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptPaymentMethodDirectDebitResponseStatus) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptPaymentMethodDirectDebitResponseStatus) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes string as json. +func (o OptString) Encode(e *jx.Encoder) { + if !o.Set { + return + } + e.Str(string(o.Value)) +} + +// Decode decodes string from json. +func (o *OptString) Decode(d *jx.Decoder) error { + if o == nil { + return errors.New("invalid: unable to decode OptString to nil") + } + o.Set = true + v, err := d.Str() + if err != nil { + return err + } + o.Value = string(v) + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s OptString) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *OptString) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *PaymentAuthCard) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *PaymentAuthCard) encodeFields(e *jx.Encoder) { + { + e.FieldStart("pay_type") + s.PayType.Encode(e) + } + { + e.FieldStart("access_id") + e.Str(s.AccessID) + } + { + e.FieldStart("method") + s.Method.Encode(e) + } + { + if s.PayTimes.Set { + e.FieldStart("pay_times") + s.PayTimes.Encode(e) + } + } +} + +var jsonFieldsNameOfPaymentAuthCard = [4]string{ + 0: "pay_type", + 1: "access_id", + 2: "method", + 3: "pay_times", +} + +// Decode decodes PaymentAuthCard from json. +func (s *PaymentAuthCard) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentAuthCard to nil") + } + var requiredBitSet [1]uint8 + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "pay_type": + requiredBitSet[0] |= 1 << 0 + if err := func() error { + if err := s.PayType.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"pay_type\"") + } + case "access_id": + requiredBitSet[0] |= 1 << 1 + if err := func() error { + v, err := d.Str() + s.AccessID = string(v) + if err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"access_id\"") + } + case "method": + requiredBitSet[0] |= 1 << 2 + if err := func() error { + if err := s.Method.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"method\"") + } + case "pay_times": + if err := func() error { + s.PayTimes.Reset() + if err := s.PayTimes.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"pay_times\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode PaymentAuthCard") + } + // Validate required fields. + var failures []validate.FieldError + for i, mask := range [1]uint8{ + 0b00000111, + } { + if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { + // Mask only required fields and check equality to mask using XOR. + // + // If XOR result is not zero, result is not equal to expected, so some fields are missed. + // Bits of fields which would be set are actually bits of missed fields. + missed := bits.OnesCount8(result) + for bitN := 0; bitN < missed; bitN++ { + bitIdx := bits.TrailingZeros8(result) + fieldIdx := i*8 + bitIdx + var name string + if fieldIdx < len(jsonFieldsNameOfPaymentAuthCard) { + name = jsonFieldsNameOfPaymentAuthCard[fieldIdx] + } else { + name = strconv.Itoa(fieldIdx) + } + failures = append(failures, validate.FieldError{ + Name: name, + Error: validate.ErrFieldRequired, + }) + // Reset bit. + result &^= 1 << bitIdx + } + } + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s *PaymentAuthCard) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *PaymentAuthCard) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentAuthCardMethod as json. +func (s PaymentAuthCardMethod) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes PaymentAuthCardMethod from json. +func (s *PaymentAuthCardMethod) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentAuthCardMethod to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch PaymentAuthCardMethod(v) { + case PaymentAuthCardMethod1: + *s = PaymentAuthCardMethod1 + case PaymentAuthCardMethod2: + *s = PaymentAuthCardMethod2 + case PaymentAuthCardMethod5: + *s = PaymentAuthCardMethod5 + default: + *s = PaymentAuthCardMethod(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s PaymentAuthCardMethod) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *PaymentAuthCardMethod) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentAuthCardPayTimes as json. +func (s PaymentAuthCardPayTimes) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes PaymentAuthCardPayTimes from json. +func (s *PaymentAuthCardPayTimes) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentAuthCardPayTimes to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch PaymentAuthCardPayTimes(v) { + case PaymentAuthCardPayTimes3: + *s = PaymentAuthCardPayTimes3 + case PaymentAuthCardPayTimes5: + *s = PaymentAuthCardPayTimes5 + case PaymentAuthCardPayTimes6: + *s = PaymentAuthCardPayTimes6 + case PaymentAuthCardPayTimes10: + *s = PaymentAuthCardPayTimes10 + case PaymentAuthCardPayTimes12: + *s = PaymentAuthCardPayTimes12 + case PaymentAuthCardPayTimes15: + *s = PaymentAuthCardPayTimes15 + case PaymentAuthCardPayTimes18: + *s = PaymentAuthCardPayTimes18 + case PaymentAuthCardPayTimes20: + *s = PaymentAuthCardPayTimes20 + case PaymentAuthCardPayTimes24: + *s = PaymentAuthCardPayTimes24 + default: + *s = PaymentAuthCardPayTimes(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s PaymentAuthCardPayTimes) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *PaymentAuthCardPayTimes) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentAuthCardPayType as json. +func (s PaymentAuthCardPayType) Encode(e *jx.Encoder) { + e.Str(string(s)) +} + +// Decode decodes PaymentAuthCardPayType from json. +func (s *PaymentAuthCardPayType) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentAuthCardPayType to nil") + } + v, err := d.StrBytes() + if err != nil { + return err + } + // Try to use constant string. + switch PaymentAuthCardPayType(v) { + case PaymentAuthCardPayTypeCard: + *s = PaymentAuthCardPayTypeCard + default: + *s = PaymentAuthCardPayType(v) + } + + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s PaymentAuthCardPayType) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *PaymentAuthCardPayType) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode implements json.Marshaler. +func (s *PaymentAuthCardResponse) Encode(e *jx.Encoder) { + e.ObjStart() + s.encodeFields(e) + e.ObjEnd() +} + +// encodeFields encodes fields. +func (s *PaymentAuthCardResponse) encodeFields(e *jx.Encoder) { + { + if s.ShopID.Set { + e.FieldStart("shop_id") + s.ShopID.Encode(e) + } + } + { + if s.ID.Set { + e.FieldStart("id") + s.ID.Encode(e) + } + } + { + if s.PayType.Set { + e.FieldStart("pay_type") + s.PayType.Encode(e) + } + } + { + if s.Status.Set { + e.FieldStart("status") + s.Status.Encode(e) + } + } + { + if s.AccessID.Set { + e.FieldStart("access_id") + s.AccessID.Encode(e) + } + } + { + if s.ProcessDate.Set { + e.FieldStart("process_date") + s.ProcessDate.Encode(e) + } + } + { + if s.JobCode.Set { + e.FieldStart("job_code") + s.JobCode.Encode(e) + } + } + { + if s.ItemCode.Set { + e.FieldStart("item_code") + s.ItemCode.Encode(e) + } + } + { + if s.Amount.Set { + e.FieldStart("amount") + s.Amount.Encode(e) + } + } + { + if s.Tax.Set { + e.FieldStart("tax") + s.Tax.Encode(e) + } + } + { + if s.TotalAmount.Set { + e.FieldStart("total_amount") + s.TotalAmount.Encode(e) + } + } + { + if s.CustomerGroupID.Set { + e.FieldStart("customer_group_id") + s.CustomerGroupID.Encode(e) + } + } + { + if s.CustomerID.Set { + e.FieldStart("customer_id") + s.CustomerID.Encode(e) + } + } + { + if s.CardNo.Set { + e.FieldStart("card_no") + s.CardNo.Encode(e) + } + } + { + if s.CardID.Set { + e.FieldStart("card_id") + s.CardID.Encode(e) + } + } + { + if s.Expire.Set { + e.FieldStart("expire") + s.Expire.Encode(e) + } + } + { + if s.HolderName.Set { + e.FieldStart("holder_name") + s.HolderName.Encode(e) + } + } + { + if s.CardNoHash.Set { + e.FieldStart("card_no_hash") + s.CardNoHash.Encode(e) + } + } + { + if s.Method.Set { + e.FieldStart("method") + s.Method.Encode(e) + } + } + { + if s.PayTimes.Set { + e.FieldStart("pay_times") + s.PayTimes.Encode(e) + } + } + { + if s.Forward.Set { + e.FieldStart("forward") + s.Forward.Encode(e) + } + } + { + if s.Issuer.Set { + e.FieldStart("issuer") + s.Issuer.Encode(e) + } + } + { + if s.TransactionID.Set { + e.FieldStart("transaction_id") + s.TransactionID.Encode(e) + } + } + { + if s.Approve.Set { + e.FieldStart("approve") + s.Approve.Encode(e) + } + } + { + if s.AuthMaxDate.Set { + e.FieldStart("auth_max_date") + s.AuthMaxDate.Encode(e) + } + } + { + if s.ClientField1.Set { + e.FieldStart("client_field_1") + s.ClientField1.Encode(e) + } + } + { + if s.ClientField2.Set { + e.FieldStart("client_field_2") + s.ClientField2.Encode(e) + } + } + { + if s.ClientField3.Set { + e.FieldStart("client_field_3") + s.ClientField3.Encode(e) + } + } + { + if s.TdsType.Set { + e.FieldStart("tds_type") + s.TdsType.Encode(e) + } + } + { + if s.Tds2Type.Set { + e.FieldStart("tds2_type") + s.Tds2Type.Encode(e) + } + } + { + if s.Tds2RetURL.Set { + e.FieldStart("tds2_ret_url") + s.Tds2RetURL.Encode(e) + } + } + { + if s.Tds2Status.Set { + e.FieldStart("tds2_status") + s.Tds2Status.Encode(e) + } + } + { + if s.MerchantName.Set { + e.FieldStart("merchant_name") + s.MerchantName.Encode(e) + } + } + { + if s.SendURL.Set { + e.FieldStart("send_url") + s.SendURL.Encode(e) + } + } + { + if s.SubscriptionID.Set { + e.FieldStart("subscription_id") + s.SubscriptionID.Encode(e) + } + } + { + if s.Brand.Set { + e.FieldStart("brand") + s.Brand.Encode(e) + } + } + { + if s.ErrorCode.Set { + e.FieldStart("error_code") + s.ErrorCode.Encode(e) + } + } + { + if s.Created.Set { + e.FieldStart("created") + s.Created.Encode(e) + } + } + { + if s.Updated.Set { + e.FieldStart("updated") + s.Updated.Encode(e) + } + } +} + +var jsonFieldsNameOfPaymentAuthCardResponse = [39]string{ + 0: "shop_id", + 1: "id", + 2: "pay_type", + 3: "status", + 4: "access_id", + 5: "process_date", + 6: "job_code", + 7: "item_code", + 8: "amount", + 9: "tax", + 10: "total_amount", + 11: "customer_group_id", + 12: "customer_id", + 13: "card_no", + 14: "card_id", + 15: "expire", + 16: "holder_name", + 17: "card_no_hash", + 18: "method", + 19: "pay_times", + 20: "forward", + 21: "issuer", + 22: "transaction_id", + 23: "approve", + 24: "auth_max_date", + 25: "client_field_1", + 26: "client_field_2", + 27: "client_field_3", + 28: "tds_type", + 29: "tds2_type", + 30: "tds2_ret_url", + 31: "tds2_status", + 32: "merchant_name", + 33: "send_url", + 34: "subscription_id", + 35: "brand", + 36: "error_code", + 37: "created", + 38: "updated", +} + +// Decode decodes PaymentAuthCardResponse from json. +func (s *PaymentAuthCardResponse) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentAuthCardResponse to nil") + } + + if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { + switch string(k) { + case "shop_id": + if err := func() error { + s.ShopID.Reset() + if err := s.ShopID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"shop_id\"") + } + case "id": + if err := func() error { + s.ID.Reset() + if err := s.ID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"id\"") + } + case "pay_type": + if err := func() error { + s.PayType.Reset() + if err := s.PayType.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"pay_type\"") + } + case "status": + if err := func() error { + s.Status.Reset() + if err := s.Status.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"status\"") + } + case "access_id": + if err := func() error { + s.AccessID.Reset() + if err := s.AccessID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"access_id\"") + } + case "process_date": + if err := func() error { + s.ProcessDate.Reset() + if err := s.ProcessDate.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"process_date\"") + } + case "job_code": + if err := func() error { + s.JobCode.Reset() + if err := s.JobCode.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"job_code\"") + } + case "item_code": + if err := func() error { + s.ItemCode.Reset() + if err := s.ItemCode.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"item_code\"") + } + case "amount": + if err := func() error { + s.Amount.Reset() + if err := s.Amount.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"amount\"") + } + case "tax": + if err := func() error { + s.Tax.Reset() + if err := s.Tax.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"tax\"") + } + case "total_amount": + if err := func() error { + s.TotalAmount.Reset() + if err := s.TotalAmount.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"total_amount\"") + } + case "customer_group_id": + if err := func() error { + s.CustomerGroupID.Reset() + if err := s.CustomerGroupID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"customer_group_id\"") + } + case "customer_id": + if err := func() error { + s.CustomerID.Reset() + if err := s.CustomerID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"customer_id\"") + } + case "card_no": + if err := func() error { + s.CardNo.Reset() + if err := s.CardNo.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"card_no\"") + } + case "card_id": + if err := func() error { + s.CardID.Reset() + if err := s.CardID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"card_id\"") + } + case "expire": + if err := func() error { + s.Expire.Reset() + if err := s.Expire.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"expire\"") + } + case "holder_name": + if err := func() error { + s.HolderName.Reset() + if err := s.HolderName.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"holder_name\"") + } + case "card_no_hash": + if err := func() error { + s.CardNoHash.Reset() + if err := s.CardNoHash.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"card_no_hash\"") + } + case "method": + if err := func() error { + s.Method.Reset() + if err := s.Method.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"method\"") + } + case "pay_times": + if err := func() error { + s.PayTimes.Reset() + if err := s.PayTimes.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"pay_times\"") + } + case "forward": + if err := func() error { + s.Forward.Reset() + if err := s.Forward.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"forward\"") + } + case "issuer": + if err := func() error { + s.Issuer.Reset() + if err := s.Issuer.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"issuer\"") + } + case "transaction_id": + if err := func() error { + s.TransactionID.Reset() + if err := s.TransactionID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"transaction_id\"") + } + case "approve": + if err := func() error { + s.Approve.Reset() + if err := s.Approve.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"approve\"") + } + case "auth_max_date": + if err := func() error { + s.AuthMaxDate.Reset() + if err := s.AuthMaxDate.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"auth_max_date\"") + } + case "client_field_1": + if err := func() error { + s.ClientField1.Reset() + if err := s.ClientField1.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"client_field_1\"") + } + case "client_field_2": + if err := func() error { + s.ClientField2.Reset() + if err := s.ClientField2.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"client_field_2\"") + } + case "client_field_3": + if err := func() error { + s.ClientField3.Reset() + if err := s.ClientField3.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"client_field_3\"") + } + case "tds_type": + if err := func() error { + s.TdsType.Reset() + if err := s.TdsType.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"tds_type\"") + } + case "tds2_type": + if err := func() error { + s.Tds2Type.Reset() + if err := s.Tds2Type.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"tds2_type\"") + } + case "tds2_ret_url": + if err := func() error { + s.Tds2RetURL.Reset() + if err := s.Tds2RetURL.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"tds2_ret_url\"") + } + case "tds2_status": + if err := func() error { + s.Tds2Status.Reset() + if err := s.Tds2Status.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"tds2_status\"") + } + case "merchant_name": + if err := func() error { + s.MerchantName.Reset() + if err := s.MerchantName.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"merchant_name\"") + } + case "send_url": + if err := func() error { + s.SendURL.Reset() + if err := s.SendURL.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"send_url\"") + } + case "subscription_id": + if err := func() error { + s.SubscriptionID.Reset() + if err := s.SubscriptionID.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"subscription_id\"") + } + case "brand": + if err := func() error { + s.Brand.Reset() + if err := s.Brand.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"brand\"") + } + case "error_code": + if err := func() error { + s.ErrorCode.Reset() + if err := s.ErrorCode.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"error_code\"") + } + case "created": + if err := func() error { + s.Created.Reset() + if err := s.Created.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"created\"") + } + case "updated": + if err := func() error { + s.Updated.Reset() + if err := s.Updated.Decode(d); err != nil { + return err + } + return nil + }(); err != nil { + return errors.Wrap(err, "decode field \"updated\"") + } + default: + return d.Skip() + } + return nil + }); err != nil { + return errors.Wrap(err, "decode PaymentAuthCardResponse") + } -// Decode decodes PaymentMethodDirectDebitResponseDirectdebitAccountType from json. -func (o *OptPaymentMethodDirectDebitResponseDirectdebitAccountType) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseDirectdebitAccountType to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } return nil } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentMethodDirectDebitResponseDirectdebitAccountType) MarshalJSON() ([]byte, error) { +func (s *PaymentAuthCardResponse) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentMethodDirectDebitResponseDirectdebitAccountType) UnmarshalJSON(data []byte) error { +func (s *PaymentAuthCardResponse) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentMethodDirectDebitResponseDirectdebitApplicationType as json. -func (o OptPaymentMethodDirectDebitResponseDirectdebitApplicationType) Encode(e *jx.Encoder) { - if !o.Set { - return - } - e.Str(string(o.Value)) +// Encode encodes PaymentAuthCardResponseJobCode as json. +func (s PaymentAuthCardResponseJobCode) Encode(e *jx.Encoder) { + e.Str(string(s)) } -// Decode decodes PaymentMethodDirectDebitResponseDirectdebitApplicationType from json. -func (o *OptPaymentMethodDirectDebitResponseDirectdebitApplicationType) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseDirectdebitApplicationType to nil") +// Decode decodes PaymentAuthCardResponseJobCode from json. +func (s *PaymentAuthCardResponseJobCode) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentAuthCardResponseJobCode to nil") } - o.Set = true - if err := o.Value.Decode(d); err != nil { + v, err := d.StrBytes() + if err != nil { return err } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentMethodDirectDebitResponseDirectdebitApplicationType) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentMethodDirectDebitResponseDirectdebitApplicationType) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes PaymentMethodDirectDebitResponseDirectdebitBankType as json. -func (o OptPaymentMethodDirectDebitResponseDirectdebitBankType) Encode(e *jx.Encoder) { - if !o.Set { - return + // Try to use constant string. + switch PaymentAuthCardResponseJobCode(v) { + case PaymentAuthCardResponseJobCodeCHECK: + *s = PaymentAuthCardResponseJobCodeCHECK + case PaymentAuthCardResponseJobCodeAUTH: + *s = PaymentAuthCardResponseJobCodeAUTH + case PaymentAuthCardResponseJobCodeCAPTURE: + *s = PaymentAuthCardResponseJobCodeCAPTURE + case PaymentAuthCardResponseJobCodeSALES: + *s = PaymentAuthCardResponseJobCodeSALES + case PaymentAuthCardResponseJobCodeCANCEL: + *s = PaymentAuthCardResponseJobCodeCANCEL + default: + *s = PaymentAuthCardResponseJobCode(v) } - e.Str(string(o.Value)) -} -// Decode decodes PaymentMethodDirectDebitResponseDirectdebitBankType from json. -func (o *OptPaymentMethodDirectDebitResponseDirectdebitBankType) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseDirectdebitBankType to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } return nil } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentMethodDirectDebitResponseDirectdebitBankType) MarshalJSON() ([]byte, error) { +func (s PaymentAuthCardResponseJobCode) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentMethodDirectDebitResponseDirectdebitBankType) UnmarshalJSON(data []byte) error { +func (s *PaymentAuthCardResponseJobCode) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentMethodDirectDebitResponseDirectdebitLastResultCode as json. -func (o OptPaymentMethodDirectDebitResponseDirectdebitLastResultCode) Encode(e *jx.Encoder) { - if !o.Set { - return - } - e.Str(string(o.Value)) +// Encode encodes PaymentAuthCardResponseMethod as json. +func (s PaymentAuthCardResponseMethod) Encode(e *jx.Encoder) { + e.Str(string(s)) } -// Decode decodes PaymentMethodDirectDebitResponseDirectdebitLastResultCode from json. -func (o *OptPaymentMethodDirectDebitResponseDirectdebitLastResultCode) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseDirectdebitLastResultCode to nil") +// Decode decodes PaymentAuthCardResponseMethod from json. +func (s *PaymentAuthCardResponseMethod) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentAuthCardResponseMethod to nil") } - o.Set = true - if err := o.Value.Decode(d); err != nil { + v, err := d.StrBytes() + if err != nil { return err } + // Try to use constant string. + switch PaymentAuthCardResponseMethod(v) { + case PaymentAuthCardResponseMethod1: + *s = PaymentAuthCardResponseMethod1 + case PaymentAuthCardResponseMethod2: + *s = PaymentAuthCardResponseMethod2 + case PaymentAuthCardResponseMethod5: + *s = PaymentAuthCardResponseMethod5 + default: + *s = PaymentAuthCardResponseMethod(v) + } + return nil } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentMethodDirectDebitResponseDirectdebitLastResultCode) MarshalJSON() ([]byte, error) { +func (s PaymentAuthCardResponseMethod) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentMethodDirectDebitResponseDirectdebitLastResultCode) UnmarshalJSON(data []byte) error { +func (s *PaymentAuthCardResponseMethod) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentMethodDirectDebitResponseDirectdebitPaperApplication as json. -func (o OptPaymentMethodDirectDebitResponseDirectdebitPaperApplication) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) +// Encode encodes PaymentAuthCardResponsePayType as json. +func (s PaymentAuthCardResponsePayType) Encode(e *jx.Encoder) { + e.Str(string(s)) } -// Decode decodes PaymentMethodDirectDebitResponseDirectdebitPaperApplication from json. -func (o *OptPaymentMethodDirectDebitResponseDirectdebitPaperApplication) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseDirectdebitPaperApplication to nil") +// Decode decodes PaymentAuthCardResponsePayType from json. +func (s *PaymentAuthCardResponsePayType) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentAuthCardResponsePayType to nil") } - o.Set = true - if err := o.Value.Decode(d); err != nil { + v, err := d.StrBytes() + if err != nil { return err } + // Try to use constant string. + switch PaymentAuthCardResponsePayType(v) { + case PaymentAuthCardResponsePayTypeCard: + *s = PaymentAuthCardResponsePayTypeCard + default: + *s = PaymentAuthCardResponsePayType(v) + } + return nil } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentMethodDirectDebitResponseDirectdebitPaperApplication) MarshalJSON() ([]byte, error) { +func (s PaymentAuthCardResponsePayType) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentMethodDirectDebitResponseDirectdebitPaperApplication) UnmarshalJSON(data []byte) error { +func (s *PaymentAuthCardResponsePayType) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentMethodDirectDebitResponsePayType as json. -func (o OptPaymentMethodDirectDebitResponsePayType) Encode(e *jx.Encoder) { - if !o.Set { - return - } - e.Str(string(o.Value)) +// Encode encodes PaymentAuthCardResponseStatus as json. +func (s PaymentAuthCardResponseStatus) Encode(e *jx.Encoder) { + e.Str(string(s)) } -// Decode decodes PaymentMethodDirectDebitResponsePayType from json. -func (o *OptPaymentMethodDirectDebitResponsePayType) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponsePayType to nil") +// Decode decodes PaymentAuthCardResponseStatus from json. +func (s *PaymentAuthCardResponseStatus) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentAuthCardResponseStatus to nil") } - o.Set = true - if err := o.Value.Decode(d); err != nil { + v, err := d.StrBytes() + if err != nil { return err } + // Try to use constant string. + switch PaymentAuthCardResponseStatus(v) { + case PaymentAuthCardResponseStatusUNPROCESSED: + *s = PaymentAuthCardResponseStatusUNPROCESSED + case PaymentAuthCardResponseStatusCHECKED: + *s = PaymentAuthCardResponseStatusCHECKED + case PaymentAuthCardResponseStatusAUTHORIZED: + *s = PaymentAuthCardResponseStatusAUTHORIZED + case PaymentAuthCardResponseStatusCAPTURED: + *s = PaymentAuthCardResponseStatusCAPTURED + case PaymentAuthCardResponseStatusCANCELED: + *s = PaymentAuthCardResponseStatusCANCELED + case PaymentAuthCardResponseStatusAUTHENTICATED: + *s = PaymentAuthCardResponseStatusAUTHENTICATED + default: + *s = PaymentAuthCardResponseStatus(v) + } + return nil } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentMethodDirectDebitResponsePayType) MarshalJSON() ([]byte, error) { +func (s PaymentAuthCardResponseStatus) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentMethodDirectDebitResponsePayType) UnmarshalJSON(data []byte) error { +func (s *PaymentAuthCardResponseStatus) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentMethodDirectDebitResponseRedirectURLAccessedFlag as json. -func (o OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) Encode(e *jx.Encoder) { - if !o.Set { - return - } - e.Str(string(o.Value)) +// Encode encodes PaymentAuthCardResponseTds2Status as json. +func (s PaymentAuthCardResponseTds2Status) Encode(e *jx.Encoder) { + e.Str(string(s)) } -// Decode decodes PaymentMethodDirectDebitResponseRedirectURLAccessedFlag from json. -func (o *OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag to nil") +// Decode decodes PaymentAuthCardResponseTds2Status from json. +func (s *PaymentAuthCardResponseTds2Status) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentAuthCardResponseTds2Status to nil") } - o.Set = true - if err := o.Value.Decode(d); err != nil { + v, err := d.StrBytes() + if err != nil { return err } + // Try to use constant string. + switch PaymentAuthCardResponseTds2Status(v) { + case PaymentAuthCardResponseTds2StatusAUTHENTICATING: + *s = PaymentAuthCardResponseTds2StatusAUTHENTICATING + case PaymentAuthCardResponseTds2StatusCHALLENGE: + *s = PaymentAuthCardResponseTds2StatusCHALLENGE + case PaymentAuthCardResponseTds2StatusAUTHENTICATED: + *s = PaymentAuthCardResponseTds2StatusAUTHENTICATED + default: + *s = PaymentAuthCardResponseTds2Status(v) + } + return nil } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) MarshalJSON() ([]byte, error) { +func (s PaymentAuthCardResponseTds2Status) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) UnmarshalJSON(data []byte) error { +func (s *PaymentAuthCardResponseTds2Status) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes PaymentMethodDirectDebitResponseStatus as json. -func (o OptPaymentMethodDirectDebitResponseStatus) Encode(e *jx.Encoder) { - if !o.Set { - return - } - e.Str(string(o.Value)) +// Encode encodes PaymentAuthCardResponseTds2Type as json. +func (s PaymentAuthCardResponseTds2Type) Encode(e *jx.Encoder) { + e.Str(string(s)) } -// Decode decodes PaymentMethodDirectDebitResponseStatus from json. -func (o *OptPaymentMethodDirectDebitResponseStatus) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptPaymentMethodDirectDebitResponseStatus to nil") +// Decode decodes PaymentAuthCardResponseTds2Type from json. +func (s *PaymentAuthCardResponseTds2Type) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentAuthCardResponseTds2Type to nil") } - o.Set = true - if err := o.Value.Decode(d); err != nil { + v, err := d.StrBytes() + if err != nil { return err } + // Try to use constant string. + switch PaymentAuthCardResponseTds2Type(v) { + case PaymentAuthCardResponseTds2Type2: + *s = PaymentAuthCardResponseTds2Type2 + case PaymentAuthCardResponseTds2Type3: + *s = PaymentAuthCardResponseTds2Type3 + default: + *s = PaymentAuthCardResponseTds2Type(v) + } + return nil } // MarshalJSON implements stdjson.Marshaler. -func (s OptPaymentMethodDirectDebitResponseStatus) MarshalJSON() ([]byte, error) { +func (s PaymentAuthCardResponseTds2Type) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptPaymentMethodDirectDebitResponseStatus) UnmarshalJSON(data []byte) error { +func (s *PaymentAuthCardResponseTds2Type) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } -// Encode encodes string as json. -func (o OptString) Encode(e *jx.Encoder) { - if !o.Set { - return - } - e.Str(string(o.Value)) +// Encode encodes PaymentAuthCardResponseTdsType as json. +func (s PaymentAuthCardResponseTdsType) Encode(e *jx.Encoder) { + e.Str(string(s)) } -// Decode decodes string from json. -func (o *OptString) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptString to nil") +// Decode decodes PaymentAuthCardResponseTdsType from json. +func (s *PaymentAuthCardResponseTdsType) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentAuthCardResponseTdsType to nil") } - o.Set = true - v, err := d.Str() + v, err := d.StrBytes() if err != nil { return err } - o.Value = string(v) + // Try to use constant string. + switch PaymentAuthCardResponseTdsType(v) { + case PaymentAuthCardResponseTdsType0: + *s = PaymentAuthCardResponseTdsType0 + case PaymentAuthCardResponseTdsType2: + *s = PaymentAuthCardResponseTdsType2 + default: + *s = PaymentAuthCardResponseTdsType(v) + } + return nil } // MarshalJSON implements stdjson.Marshaler. -func (s OptString) MarshalJSON() ([]byte, error) { +func (s PaymentAuthCardResponseTdsType) MarshalJSON() ([]byte, error) { e := jx.Encoder{} s.Encode(&e) return e.Bytes(), nil } // UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptString) UnmarshalJSON(data []byte) error { +func (s *PaymentAuthCardResponseTdsType) UnmarshalJSON(data []byte) error { d := jx.DecodeBytes(data) return s.Decode(d) } @@ -16804,6 +18414,84 @@ func (s *PaymentsGetOKListItem) UnmarshalJSON(data []byte) error { return s.Decode(d) } +// Encode encodes PaymentsIDAuthPutOK as json. +func (s PaymentsIDAuthPutOK) Encode(e *jx.Encoder) { + switch s.Type { + case PaymentAuthCardResponsePaymentsIDAuthPutOK: + s.PaymentAuthCardResponse.Encode(e) + } +} + +// Decode decodes PaymentsIDAuthPutOK from json. +func (s *PaymentsIDAuthPutOK) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentsIDAuthPutOK to nil") + } + // Sum type type_discriminator. + switch t := d.Next(); t { + case jx.Object: + if err := s.PaymentAuthCardResponse.Decode(d); err != nil { + return err + } + s.Type = PaymentAuthCardResponsePaymentsIDAuthPutOK + default: + return errors.Errorf("unexpected json type %q", t) + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s PaymentsIDAuthPutOK) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *PaymentsIDAuthPutOK) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + +// Encode encodes PaymentsIDAuthPutReq as json. +func (s PaymentsIDAuthPutReq) Encode(e *jx.Encoder) { + switch s.Type { + case PaymentAuthCardPaymentsIDAuthPutReq: + s.PaymentAuthCard.Encode(e) + } +} + +// Decode decodes PaymentsIDAuthPutReq from json. +func (s *PaymentsIDAuthPutReq) Decode(d *jx.Decoder) error { + if s == nil { + return errors.New("invalid: unable to decode PaymentsIDAuthPutReq to nil") + } + // Sum type type_discriminator. + switch t := d.Next(); t { + case jx.Object: + if err := s.PaymentAuthCard.Decode(d); err != nil { + return err + } + s.Type = PaymentAuthCardPaymentsIDAuthPutReq + default: + return errors.Errorf("unexpected json type %q", t) + } + return nil +} + +// MarshalJSON implements stdjson.Marshaler. +func (s PaymentsIDAuthPutReq) MarshalJSON() ([]byte, error) { + e := jx.Encoder{} + s.Encode(&e) + return e.Bytes(), nil +} + +// UnmarshalJSON implements stdjson.Unmarshaler. +func (s *PaymentsIDAuthPutReq) UnmarshalJSON(data []byte) error { + d := jx.DecodeBytes(data) + return s.Decode(d) +} + // Encode encodes PaymentsIDCancelPutOK as json. func (s PaymentsIDCancelPutOK) Encode(e *jx.Encoder) { switch s.Type { diff --git a/api/oas_parameters_gen.go b/api/oas_parameters_gen.go index 3321405..2bdd195 100644 --- a/api/oas_parameters_gen.go +++ b/api/oas_parameters_gen.go @@ -1645,6 +1645,71 @@ func decodePaymentsGetParams(args [0]string, argsEscaped bool, r *http.Request) return params, nil } +// PaymentsIDAuthPutParams is parameters of PUT /payments/{id}/auth operation. +type PaymentsIDAuthPutParams struct { + ID string +} + +func unpackPaymentsIDAuthPutParams(packed middleware.Parameters) (params PaymentsIDAuthPutParams) { + { + key := middleware.ParameterKey{ + Name: "id", + In: "path", + } + params.ID = packed[key].(string) + } + return params +} + +func decodePaymentsIDAuthPutParams(args [1]string, argsEscaped bool, r *http.Request) (params PaymentsIDAuthPutParams, _ error) { + // Decode path: id. + if err := func() error { + param := args[0] + if argsEscaped { + unescaped, err := url.PathUnescape(args[0]) + if err != nil { + return errors.Wrap(err, "unescape path") + } + param = unescaped + } + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.ID = c + return nil + }(); err != nil { + return err + } + } else { + return validate.ErrFieldRequired + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "id", + In: "path", + Err: err, + } + } + return params, nil +} + // PaymentsIDCancelPutParams is parameters of PUT /payments/{id}/cancel operation. type PaymentsIDCancelPutParams struct { ID string diff --git a/api/oas_request_decoders_gen.go b/api/oas_request_decoders_gen.go index c947f4a..e292869 100644 --- a/api/oas_request_decoders_gen.go +++ b/api/oas_request_decoders_gen.go @@ -149,6 +149,77 @@ func (s *Server) decodeCustomersPostRequest(r *http.Request) ( } } +func (s *Server) decodePaymentsIDAuthPutRequest(r *http.Request) ( + req PaymentsIDAuthPutReq, + close func() error, + rerr error, +) { + var closers []func() error + close = func() error { + var merr error + // Close in reverse order, to match defer behavior. + for i := len(closers) - 1; i >= 0; i-- { + c := closers[i] + merr = multierr.Append(merr, c()) + } + return merr + } + defer func() { + if rerr != nil { + rerr = multierr.Append(rerr, close()) + } + }() + ct, _, err := mime.ParseMediaType(r.Header.Get("Content-Type")) + if err != nil { + return req, close, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + if r.ContentLength == 0 { + return req, close, validate.ErrBodyRequired + } + buf, err := io.ReadAll(r.Body) + if err != nil { + return req, close, err + } + + if len(buf) == 0 { + return req, close, validate.ErrBodyRequired + } + + d := jx.DecodeBytes(buf) + + var request PaymentsIDAuthPutReq + if err := func() error { + if err := request.Decode(d); err != nil { + return err + } + if err := d.Skip(); err != io.EOF { + return errors.New("unexpected trailing data") + } + return nil + }(); err != nil { + err = &ogenerrors.DecodeBodyError{ + ContentType: ct, + Body: buf, + Err: err, + } + return req, close, err + } + if err := func() error { + if err := request.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return req, close, errors.Wrap(err, "validate") + } + return request, close, nil + default: + return req, close, validate.InvalidContentType(ct) + } +} + func (s *Server) decodePaymentsIDCancelPutRequest(r *http.Request) ( req PaymentsIDCancelPutReq, close func() error, diff --git a/api/oas_request_encoders_gen.go b/api/oas_request_encoders_gen.go index 5eb68cc..d72295a 100644 --- a/api/oas_request_encoders_gen.go +++ b/api/oas_request_encoders_gen.go @@ -39,6 +39,20 @@ func encodeCustomersPostRequest( return nil } +func encodePaymentsIDAuthPutRequest( + req PaymentsIDAuthPutReq, + r *http.Request, +) error { + const contentType = "application/json" + e := new(jx.Encoder) + { + req.Encode(e) + } + encoded := e.Bytes() + ht.SetBody(r, bytes.NewReader(encoded), contentType) + return nil +} + func encodePaymentsIDCancelPutRequest( req PaymentsIDCancelPutReq, r *http.Request, diff --git a/api/oas_response_decoders_gen.go b/api/oas_response_decoders_gen.go index 444c23f..964eee3 100644 --- a/api/oas_response_decoders_gen.go +++ b/api/oas_response_decoders_gen.go @@ -815,6 +815,100 @@ func decodePaymentsGetResponse(resp *http.Response) (res PaymentsGetRes, _ error return res, validate.UnexpectedStatusCode(resp.StatusCode) } +func decodePaymentsIDAuthPutResponse(resp *http.Response) (res PaymentsIDAuthPutRes, _ error) { + switch resp.StatusCode { + case 200: + // Code 200. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + buf, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + d := jx.DecodeBytes(buf) + + var response PaymentsIDAuthPutOK + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + if err := d.Skip(); err != io.EOF { + return errors.New("unexpected trailing data") + } + return nil + }(); err != nil { + err = &ogenerrors.DecodeBodyError{ + ContentType: ct, + Body: buf, + Err: err, + } + return res, err + } + // Validate response. + if err := func() error { + if err := response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "validate") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + case 400: + // Code 400. + ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return res, errors.Wrap(err, "parse media type") + } + switch { + case ct == "application/json": + buf, err := io.ReadAll(resp.Body) + if err != nil { + return res, err + } + d := jx.DecodeBytes(buf) + + var response ErrorResponse + if err := func() error { + if err := response.Decode(d); err != nil { + return err + } + if err := d.Skip(); err != io.EOF { + return errors.New("unexpected trailing data") + } + return nil + }(); err != nil { + err = &ogenerrors.DecodeBodyError{ + ContentType: ct, + Body: buf, + Err: err, + } + return res, err + } + // Validate response. + if err := func() error { + if err := response.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return res, errors.Wrap(err, "validate") + } + return &response, nil + default: + return res, validate.InvalidContentType(ct) + } + } + return res, validate.UnexpectedStatusCode(resp.StatusCode) +} + func decodePaymentsIDCancelPutResponse(resp *http.Response) (res PaymentsIDCancelPutRes, _ error) { switch resp.StatusCode { case 200: diff --git a/api/oas_response_encoders_gen.go b/api/oas_response_encoders_gen.go index 55de908..f2c3721 100644 --- a/api/oas_response_encoders_gen.go +++ b/api/oas_response_encoders_gen.go @@ -308,6 +308,39 @@ func encodePaymentsGetResponse(response PaymentsGetRes, w http.ResponseWriter, s } } +func encodePaymentsIDAuthPutResponse(response PaymentsIDAuthPutRes, w http.ResponseWriter, span trace.Span) error { + switch response := response.(type) { + case *PaymentsIDAuthPutOK: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := new(jx.Encoder) + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + case *ErrorResponse: + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.WriteHeader(400) + span.SetStatus(codes.Error, http.StatusText(400)) + + e := new(jx.Encoder) + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil + + default: + return errors.Errorf("unexpected response type: %T", response) + } +} + func encodePaymentsIDCancelPutResponse(response PaymentsIDCancelPutRes, w http.ResponseWriter, span trace.Span) error { switch response := response.(type) { case *PaymentsIDCancelPutOK: diff --git a/api/oas_router_gen.go b/api/oas_router_gen.go index ab04dc0..58dfa3d 100644 --- a/api/oas_router_gen.go +++ b/api/oas_router_gen.go @@ -282,26 +282,64 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } switch elem[0] { - case '/': // Prefix: "/cancel" + case '/': // Prefix: "/" origElem := elem - if l := len("/cancel"); len(elem) >= l && elem[0:l] == "/cancel" { + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { elem = elem[l:] } else { break } if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "PUT": - s.handlePaymentsIDCancelPutRequest([1]string{ - args[0], - }, elemIsEscaped, w, r) - default: - s.notAllowed(w, r, "PUT") + break + } + switch elem[0] { + case 'a': // Prefix: "auth" + origElem := elem + if l := len("auth"); len(elem) >= l && elem[0:l] == "auth" { + elem = elem[l:] + } else { + break } - return + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "PUT": + s.handlePaymentsIDAuthPutRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, "PUT") + } + + return + } + + elem = origElem + case 'c': // Prefix: "cancel" + origElem := elem + if l := len("cancel"); len(elem) >= l && elem[0:l] == "cancel" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "PUT": + s.handlePaymentsIDCancelPutRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, "PUT") + } + + return + } + + elem = origElem } elem = origElem @@ -663,28 +701,68 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) { } } switch elem[0] { - case '/': // Prefix: "/cancel" + case '/': // Prefix: "/" origElem := elem - if l := len("/cancel"); len(elem) >= l && elem[0:l] == "/cancel" { + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { elem = elem[l:] } else { break } if len(elem) == 0 { - // Leaf node. - switch method { - case "PUT": - r.name = "PaymentsIDCancelPut" - r.summary = "" - r.operationID = "" - r.pathPattern = "/payments/{id}/cancel" - r.args = args - r.count = 1 - return r, true - default: - return + break + } + switch elem[0] { + case 'a': // Prefix: "auth" + origElem := elem + if l := len("auth"); len(elem) >= l && elem[0:l] == "auth" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch method { + case "PUT": + r.name = "PaymentsIDAuthPut" + r.summary = "" + r.operationID = "" + r.pathPattern = "/payments/{id}/auth" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + + elem = origElem + case 'c': // Prefix: "cancel" + origElem := elem + if l := len("cancel"); len(elem) >= l && elem[0:l] == "cancel" { + elem = elem[l:] + } else { + break } + + if len(elem) == 0 { + // Leaf node. + switch method { + case "PUT": + r.name = "PaymentsIDCancelPut" + r.summary = "" + r.operationID = "" + r.pathPattern = "/payments/{id}/cancel" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + + elem = origElem } elem = origElem diff --git a/api/oas_schemas_gen.go b/api/oas_schemas_gen.go index e9c43a9..9a57e4a 100644 --- a/api/oas_schemas_gen.go +++ b/api/oas_schemas_gen.go @@ -1074,6 +1074,7 @@ func (*ErrorResponse) customersCustomerIDPaymentMethodsPostRes() func (*ErrorResponse) customersIDDeleteRes() {} func (*ErrorResponse) customersIDGetRes() {} func (*ErrorResponse) customersPostRes() {} +func (*ErrorResponse) paymentsIDAuthPutRes() {} func (*ErrorResponse) paymentsIDCancelPutRes() {} func (*ErrorResponse) paymentsIDGetRes() {} func (*ErrorResponse) paymentsIDPutRes() {} @@ -1196,6 +1197,258 @@ func (o OptInt) Or(d int) int { return d } +// NewOptNilPaymentAuthCardResponseMethod returns new OptNilPaymentAuthCardResponseMethod with value set to v. +func NewOptNilPaymentAuthCardResponseMethod(v PaymentAuthCardResponseMethod) OptNilPaymentAuthCardResponseMethod { + return OptNilPaymentAuthCardResponseMethod{ + Value: v, + Set: true, + } +} + +// OptNilPaymentAuthCardResponseMethod is optional nullable PaymentAuthCardResponseMethod. +type OptNilPaymentAuthCardResponseMethod struct { + Value PaymentAuthCardResponseMethod + Set bool + Null bool +} + +// IsSet returns true if OptNilPaymentAuthCardResponseMethod was set. +func (o OptNilPaymentAuthCardResponseMethod) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptNilPaymentAuthCardResponseMethod) Reset() { + var v PaymentAuthCardResponseMethod + o.Value = v + o.Set = false + o.Null = false +} + +// SetTo sets value to v. +func (o *OptNilPaymentAuthCardResponseMethod) SetTo(v PaymentAuthCardResponseMethod) { + o.Set = true + o.Null = false + o.Value = v +} + +// IsSet returns true if value is Null. +func (o OptNilPaymentAuthCardResponseMethod) IsNull() bool { return o.Null } + +// SetNull sets value to null. +func (o *OptNilPaymentAuthCardResponseMethod) SetToNull() { + o.Set = true + o.Null = true + var v PaymentAuthCardResponseMethod + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptNilPaymentAuthCardResponseMethod) Get() (v PaymentAuthCardResponseMethod, ok bool) { + if o.Null { + return v, false + } + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptNilPaymentAuthCardResponseMethod) Or(d PaymentAuthCardResponseMethod) PaymentAuthCardResponseMethod { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptNilPaymentAuthCardResponseTds2Status returns new OptNilPaymentAuthCardResponseTds2Status with value set to v. +func NewOptNilPaymentAuthCardResponseTds2Status(v PaymentAuthCardResponseTds2Status) OptNilPaymentAuthCardResponseTds2Status { + return OptNilPaymentAuthCardResponseTds2Status{ + Value: v, + Set: true, + } +} + +// OptNilPaymentAuthCardResponseTds2Status is optional nullable PaymentAuthCardResponseTds2Status. +type OptNilPaymentAuthCardResponseTds2Status struct { + Value PaymentAuthCardResponseTds2Status + Set bool + Null bool +} + +// IsSet returns true if OptNilPaymentAuthCardResponseTds2Status was set. +func (o OptNilPaymentAuthCardResponseTds2Status) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptNilPaymentAuthCardResponseTds2Status) Reset() { + var v PaymentAuthCardResponseTds2Status + o.Value = v + o.Set = false + o.Null = false +} + +// SetTo sets value to v. +func (o *OptNilPaymentAuthCardResponseTds2Status) SetTo(v PaymentAuthCardResponseTds2Status) { + o.Set = true + o.Null = false + o.Value = v +} + +// IsSet returns true if value is Null. +func (o OptNilPaymentAuthCardResponseTds2Status) IsNull() bool { return o.Null } + +// SetNull sets value to null. +func (o *OptNilPaymentAuthCardResponseTds2Status) SetToNull() { + o.Set = true + o.Null = true + var v PaymentAuthCardResponseTds2Status + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptNilPaymentAuthCardResponseTds2Status) Get() (v PaymentAuthCardResponseTds2Status, ok bool) { + if o.Null { + return v, false + } + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptNilPaymentAuthCardResponseTds2Status) Or(d PaymentAuthCardResponseTds2Status) PaymentAuthCardResponseTds2Status { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptNilPaymentAuthCardResponseTds2Type returns new OptNilPaymentAuthCardResponseTds2Type with value set to v. +func NewOptNilPaymentAuthCardResponseTds2Type(v PaymentAuthCardResponseTds2Type) OptNilPaymentAuthCardResponseTds2Type { + return OptNilPaymentAuthCardResponseTds2Type{ + Value: v, + Set: true, + } +} + +// OptNilPaymentAuthCardResponseTds2Type is optional nullable PaymentAuthCardResponseTds2Type. +type OptNilPaymentAuthCardResponseTds2Type struct { + Value PaymentAuthCardResponseTds2Type + Set bool + Null bool +} + +// IsSet returns true if OptNilPaymentAuthCardResponseTds2Type was set. +func (o OptNilPaymentAuthCardResponseTds2Type) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptNilPaymentAuthCardResponseTds2Type) Reset() { + var v PaymentAuthCardResponseTds2Type + o.Value = v + o.Set = false + o.Null = false +} + +// SetTo sets value to v. +func (o *OptNilPaymentAuthCardResponseTds2Type) SetTo(v PaymentAuthCardResponseTds2Type) { + o.Set = true + o.Null = false + o.Value = v +} + +// IsSet returns true if value is Null. +func (o OptNilPaymentAuthCardResponseTds2Type) IsNull() bool { return o.Null } + +// SetNull sets value to null. +func (o *OptNilPaymentAuthCardResponseTds2Type) SetToNull() { + o.Set = true + o.Null = true + var v PaymentAuthCardResponseTds2Type + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptNilPaymentAuthCardResponseTds2Type) Get() (v PaymentAuthCardResponseTds2Type, ok bool) { + if o.Null { + return v, false + } + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptNilPaymentAuthCardResponseTds2Type) Or(d PaymentAuthCardResponseTds2Type) PaymentAuthCardResponseTds2Type { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptNilPaymentAuthCardResponseTdsType returns new OptNilPaymentAuthCardResponseTdsType with value set to v. +func NewOptNilPaymentAuthCardResponseTdsType(v PaymentAuthCardResponseTdsType) OptNilPaymentAuthCardResponseTdsType { + return OptNilPaymentAuthCardResponseTdsType{ + Value: v, + Set: true, + } +} + +// OptNilPaymentAuthCardResponseTdsType is optional nullable PaymentAuthCardResponseTdsType. +type OptNilPaymentAuthCardResponseTdsType struct { + Value PaymentAuthCardResponseTdsType + Set bool + Null bool +} + +// IsSet returns true if OptNilPaymentAuthCardResponseTdsType was set. +func (o OptNilPaymentAuthCardResponseTdsType) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptNilPaymentAuthCardResponseTdsType) Reset() { + var v PaymentAuthCardResponseTdsType + o.Value = v + o.Set = false + o.Null = false +} + +// SetTo sets value to v. +func (o *OptNilPaymentAuthCardResponseTdsType) SetTo(v PaymentAuthCardResponseTdsType) { + o.Set = true + o.Null = false + o.Value = v +} + +// IsSet returns true if value is Null. +func (o OptNilPaymentAuthCardResponseTdsType) IsNull() bool { return o.Null } + +// SetNull sets value to null. +func (o *OptNilPaymentAuthCardResponseTdsType) SetToNull() { + o.Set = true + o.Null = true + var v PaymentAuthCardResponseTdsType + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptNilPaymentAuthCardResponseTdsType) Get() (v PaymentAuthCardResponseTdsType, ok bool) { + if o.Null { + return v, false + } + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptNilPaymentAuthCardResponseTdsType) Or(d PaymentAuthCardResponseTdsType) PaymentAuthCardResponseTdsType { + if v, ok := o.Get(); ok { + return v + } + return d +} + // NewOptNilPaymentCancelCardResponseMethod returns new OptNilPaymentCancelCardResponseMethod with value set to v. func NewOptNilPaymentCancelCardResponseMethod(v PaymentCancelCardResponseMethod) OptNilPaymentCancelCardResponseMethod { return OptNilPaymentCancelCardResponseMethod{ @@ -3466,38 +3719,38 @@ func (o OptNilString) Or(d string) string { return d } -// NewOptPaymentCancelCardResponseJobCode returns new OptPaymentCancelCardResponseJobCode with value set to v. -func NewOptPaymentCancelCardResponseJobCode(v PaymentCancelCardResponseJobCode) OptPaymentCancelCardResponseJobCode { - return OptPaymentCancelCardResponseJobCode{ +// NewOptPaymentAuthCardPayTimes returns new OptPaymentAuthCardPayTimes with value set to v. +func NewOptPaymentAuthCardPayTimes(v PaymentAuthCardPayTimes) OptPaymentAuthCardPayTimes { + return OptPaymentAuthCardPayTimes{ Value: v, Set: true, } } -// OptPaymentCancelCardResponseJobCode is optional PaymentCancelCardResponseJobCode. -type OptPaymentCancelCardResponseJobCode struct { - Value PaymentCancelCardResponseJobCode +// OptPaymentAuthCardPayTimes is optional PaymentAuthCardPayTimes. +type OptPaymentAuthCardPayTimes struct { + Value PaymentAuthCardPayTimes Set bool } -// IsSet returns true if OptPaymentCancelCardResponseJobCode was set. -func (o OptPaymentCancelCardResponseJobCode) IsSet() bool { return o.Set } +// IsSet returns true if OptPaymentAuthCardPayTimes was set. +func (o OptPaymentAuthCardPayTimes) IsSet() bool { return o.Set } // Reset unsets value. -func (o *OptPaymentCancelCardResponseJobCode) Reset() { - var v PaymentCancelCardResponseJobCode +func (o *OptPaymentAuthCardPayTimes) Reset() { + var v PaymentAuthCardPayTimes o.Value = v o.Set = false } // SetTo sets value to v. -func (o *OptPaymentCancelCardResponseJobCode) SetTo(v PaymentCancelCardResponseJobCode) { +func (o *OptPaymentAuthCardPayTimes) SetTo(v PaymentAuthCardPayTimes) { o.Set = true o.Value = v } // Get returns value and boolean that denotes whether value was set. -func (o OptPaymentCancelCardResponseJobCode) Get() (v PaymentCancelCardResponseJobCode, ok bool) { +func (o OptPaymentAuthCardPayTimes) Get() (v PaymentAuthCardPayTimes, ok bool) { if !o.Set { return v, false } @@ -3505,45 +3758,45 @@ func (o OptPaymentCancelCardResponseJobCode) Get() (v PaymentCancelCardResponseJ } // Or returns value if set, or given parameter if does not. -func (o OptPaymentCancelCardResponseJobCode) Or(d PaymentCancelCardResponseJobCode) PaymentCancelCardResponseJobCode { +func (o OptPaymentAuthCardPayTimes) Or(d PaymentAuthCardPayTimes) PaymentAuthCardPayTimes { if v, ok := o.Get(); ok { return v } return d } -// NewOptPaymentCancelCardResponsePayType returns new OptPaymentCancelCardResponsePayType with value set to v. -func NewOptPaymentCancelCardResponsePayType(v PaymentCancelCardResponsePayType) OptPaymentCancelCardResponsePayType { - return OptPaymentCancelCardResponsePayType{ +// NewOptPaymentAuthCardResponseJobCode returns new OptPaymentAuthCardResponseJobCode with value set to v. +func NewOptPaymentAuthCardResponseJobCode(v PaymentAuthCardResponseJobCode) OptPaymentAuthCardResponseJobCode { + return OptPaymentAuthCardResponseJobCode{ Value: v, Set: true, } } -// OptPaymentCancelCardResponsePayType is optional PaymentCancelCardResponsePayType. -type OptPaymentCancelCardResponsePayType struct { - Value PaymentCancelCardResponsePayType +// OptPaymentAuthCardResponseJobCode is optional PaymentAuthCardResponseJobCode. +type OptPaymentAuthCardResponseJobCode struct { + Value PaymentAuthCardResponseJobCode Set bool } -// IsSet returns true if OptPaymentCancelCardResponsePayType was set. -func (o OptPaymentCancelCardResponsePayType) IsSet() bool { return o.Set } +// IsSet returns true if OptPaymentAuthCardResponseJobCode was set. +func (o OptPaymentAuthCardResponseJobCode) IsSet() bool { return o.Set } // Reset unsets value. -func (o *OptPaymentCancelCardResponsePayType) Reset() { - var v PaymentCancelCardResponsePayType +func (o *OptPaymentAuthCardResponseJobCode) Reset() { + var v PaymentAuthCardResponseJobCode o.Value = v o.Set = false } // SetTo sets value to v. -func (o *OptPaymentCancelCardResponsePayType) SetTo(v PaymentCancelCardResponsePayType) { +func (o *OptPaymentAuthCardResponseJobCode) SetTo(v PaymentAuthCardResponseJobCode) { o.Set = true o.Value = v } // Get returns value and boolean that denotes whether value was set. -func (o OptPaymentCancelCardResponsePayType) Get() (v PaymentCancelCardResponsePayType, ok bool) { +func (o OptPaymentAuthCardResponseJobCode) Get() (v PaymentAuthCardResponseJobCode, ok bool) { if !o.Set { return v, false } @@ -3551,45 +3804,45 @@ func (o OptPaymentCancelCardResponsePayType) Get() (v PaymentCancelCardResponseP } // Or returns value if set, or given parameter if does not. -func (o OptPaymentCancelCardResponsePayType) Or(d PaymentCancelCardResponsePayType) PaymentCancelCardResponsePayType { +func (o OptPaymentAuthCardResponseJobCode) Or(d PaymentAuthCardResponseJobCode) PaymentAuthCardResponseJobCode { if v, ok := o.Get(); ok { return v } return d } -// NewOptPaymentCancelCardResponseStatus returns new OptPaymentCancelCardResponseStatus with value set to v. -func NewOptPaymentCancelCardResponseStatus(v PaymentCancelCardResponseStatus) OptPaymentCancelCardResponseStatus { - return OptPaymentCancelCardResponseStatus{ +// NewOptPaymentAuthCardResponsePayType returns new OptPaymentAuthCardResponsePayType with value set to v. +func NewOptPaymentAuthCardResponsePayType(v PaymentAuthCardResponsePayType) OptPaymentAuthCardResponsePayType { + return OptPaymentAuthCardResponsePayType{ Value: v, Set: true, } } -// OptPaymentCancelCardResponseStatus is optional PaymentCancelCardResponseStatus. -type OptPaymentCancelCardResponseStatus struct { - Value PaymentCancelCardResponseStatus +// OptPaymentAuthCardResponsePayType is optional PaymentAuthCardResponsePayType. +type OptPaymentAuthCardResponsePayType struct { + Value PaymentAuthCardResponsePayType Set bool } -// IsSet returns true if OptPaymentCancelCardResponseStatus was set. -func (o OptPaymentCancelCardResponseStatus) IsSet() bool { return o.Set } +// IsSet returns true if OptPaymentAuthCardResponsePayType was set. +func (o OptPaymentAuthCardResponsePayType) IsSet() bool { return o.Set } // Reset unsets value. -func (o *OptPaymentCancelCardResponseStatus) Reset() { - var v PaymentCancelCardResponseStatus +func (o *OptPaymentAuthCardResponsePayType) Reset() { + var v PaymentAuthCardResponsePayType o.Value = v o.Set = false } // SetTo sets value to v. -func (o *OptPaymentCancelCardResponseStatus) SetTo(v PaymentCancelCardResponseStatus) { +func (o *OptPaymentAuthCardResponsePayType) SetTo(v PaymentAuthCardResponsePayType) { o.Set = true o.Value = v } // Get returns value and boolean that denotes whether value was set. -func (o OptPaymentCancelCardResponseStatus) Get() (v PaymentCancelCardResponseStatus, ok bool) { +func (o OptPaymentAuthCardResponsePayType) Get() (v PaymentAuthCardResponsePayType, ok bool) { if !o.Set { return v, false } @@ -3597,45 +3850,45 @@ func (o OptPaymentCancelCardResponseStatus) Get() (v PaymentCancelCardResponseSt } // Or returns value if set, or given parameter if does not. -func (o OptPaymentCancelCardResponseStatus) Or(d PaymentCancelCardResponseStatus) PaymentCancelCardResponseStatus { +func (o OptPaymentAuthCardResponsePayType) Or(d PaymentAuthCardResponsePayType) PaymentAuthCardResponsePayType { if v, ok := o.Get(); ok { return v } return d } -// NewOptPaymentCardResponseJobCode returns new OptPaymentCardResponseJobCode with value set to v. -func NewOptPaymentCardResponseJobCode(v PaymentCardResponseJobCode) OptPaymentCardResponseJobCode { - return OptPaymentCardResponseJobCode{ +// NewOptPaymentAuthCardResponseStatus returns new OptPaymentAuthCardResponseStatus with value set to v. +func NewOptPaymentAuthCardResponseStatus(v PaymentAuthCardResponseStatus) OptPaymentAuthCardResponseStatus { + return OptPaymentAuthCardResponseStatus{ Value: v, Set: true, } } -// OptPaymentCardResponseJobCode is optional PaymentCardResponseJobCode. -type OptPaymentCardResponseJobCode struct { - Value PaymentCardResponseJobCode +// OptPaymentAuthCardResponseStatus is optional PaymentAuthCardResponseStatus. +type OptPaymentAuthCardResponseStatus struct { + Value PaymentAuthCardResponseStatus Set bool } -// IsSet returns true if OptPaymentCardResponseJobCode was set. -func (o OptPaymentCardResponseJobCode) IsSet() bool { return o.Set } +// IsSet returns true if OptPaymentAuthCardResponseStatus was set. +func (o OptPaymentAuthCardResponseStatus) IsSet() bool { return o.Set } // Reset unsets value. -func (o *OptPaymentCardResponseJobCode) Reset() { - var v PaymentCardResponseJobCode +func (o *OptPaymentAuthCardResponseStatus) Reset() { + var v PaymentAuthCardResponseStatus o.Value = v o.Set = false } // SetTo sets value to v. -func (o *OptPaymentCardResponseJobCode) SetTo(v PaymentCardResponseJobCode) { +func (o *OptPaymentAuthCardResponseStatus) SetTo(v PaymentAuthCardResponseStatus) { o.Set = true o.Value = v } // Get returns value and boolean that denotes whether value was set. -func (o OptPaymentCardResponseJobCode) Get() (v PaymentCardResponseJobCode, ok bool) { +func (o OptPaymentAuthCardResponseStatus) Get() (v PaymentAuthCardResponseStatus, ok bool) { if !o.Set { return v, false } @@ -3643,29 +3896,213 @@ func (o OptPaymentCardResponseJobCode) Get() (v PaymentCardResponseJobCode, ok b } // Or returns value if set, or given parameter if does not. -func (o OptPaymentCardResponseJobCode) Or(d PaymentCardResponseJobCode) PaymentCardResponseJobCode { +func (o OptPaymentAuthCardResponseStatus) Or(d PaymentAuthCardResponseStatus) PaymentAuthCardResponseStatus { if v, ok := o.Get(); ok { return v } return d } -// NewOptPaymentCardResponsePayType returns new OptPaymentCardResponsePayType with value set to v. -func NewOptPaymentCardResponsePayType(v PaymentCardResponsePayType) OptPaymentCardResponsePayType { - return OptPaymentCardResponsePayType{ +// NewOptPaymentCancelCardResponseJobCode returns new OptPaymentCancelCardResponseJobCode with value set to v. +func NewOptPaymentCancelCardResponseJobCode(v PaymentCancelCardResponseJobCode) OptPaymentCancelCardResponseJobCode { + return OptPaymentCancelCardResponseJobCode{ Value: v, Set: true, } } -// OptPaymentCardResponsePayType is optional PaymentCardResponsePayType. -type OptPaymentCardResponsePayType struct { - Value PaymentCardResponsePayType +// OptPaymentCancelCardResponseJobCode is optional PaymentCancelCardResponseJobCode. +type OptPaymentCancelCardResponseJobCode struct { + Value PaymentCancelCardResponseJobCode Set bool } -// IsSet returns true if OptPaymentCardResponsePayType was set. -func (o OptPaymentCardResponsePayType) IsSet() bool { return o.Set } +// IsSet returns true if OptPaymentCancelCardResponseJobCode was set. +func (o OptPaymentCancelCardResponseJobCode) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptPaymentCancelCardResponseJobCode) Reset() { + var v PaymentCancelCardResponseJobCode + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptPaymentCancelCardResponseJobCode) SetTo(v PaymentCancelCardResponseJobCode) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptPaymentCancelCardResponseJobCode) Get() (v PaymentCancelCardResponseJobCode, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptPaymentCancelCardResponseJobCode) Or(d PaymentCancelCardResponseJobCode) PaymentCancelCardResponseJobCode { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptPaymentCancelCardResponsePayType returns new OptPaymentCancelCardResponsePayType with value set to v. +func NewOptPaymentCancelCardResponsePayType(v PaymentCancelCardResponsePayType) OptPaymentCancelCardResponsePayType { + return OptPaymentCancelCardResponsePayType{ + Value: v, + Set: true, + } +} + +// OptPaymentCancelCardResponsePayType is optional PaymentCancelCardResponsePayType. +type OptPaymentCancelCardResponsePayType struct { + Value PaymentCancelCardResponsePayType + Set bool +} + +// IsSet returns true if OptPaymentCancelCardResponsePayType was set. +func (o OptPaymentCancelCardResponsePayType) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptPaymentCancelCardResponsePayType) Reset() { + var v PaymentCancelCardResponsePayType + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptPaymentCancelCardResponsePayType) SetTo(v PaymentCancelCardResponsePayType) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptPaymentCancelCardResponsePayType) Get() (v PaymentCancelCardResponsePayType, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptPaymentCancelCardResponsePayType) Or(d PaymentCancelCardResponsePayType) PaymentCancelCardResponsePayType { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptPaymentCancelCardResponseStatus returns new OptPaymentCancelCardResponseStatus with value set to v. +func NewOptPaymentCancelCardResponseStatus(v PaymentCancelCardResponseStatus) OptPaymentCancelCardResponseStatus { + return OptPaymentCancelCardResponseStatus{ + Value: v, + Set: true, + } +} + +// OptPaymentCancelCardResponseStatus is optional PaymentCancelCardResponseStatus. +type OptPaymentCancelCardResponseStatus struct { + Value PaymentCancelCardResponseStatus + Set bool +} + +// IsSet returns true if OptPaymentCancelCardResponseStatus was set. +func (o OptPaymentCancelCardResponseStatus) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptPaymentCancelCardResponseStatus) Reset() { + var v PaymentCancelCardResponseStatus + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptPaymentCancelCardResponseStatus) SetTo(v PaymentCancelCardResponseStatus) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptPaymentCancelCardResponseStatus) Get() (v PaymentCancelCardResponseStatus, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptPaymentCancelCardResponseStatus) Or(d PaymentCancelCardResponseStatus) PaymentCancelCardResponseStatus { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptPaymentCardResponseJobCode returns new OptPaymentCardResponseJobCode with value set to v. +func NewOptPaymentCardResponseJobCode(v PaymentCardResponseJobCode) OptPaymentCardResponseJobCode { + return OptPaymentCardResponseJobCode{ + Value: v, + Set: true, + } +} + +// OptPaymentCardResponseJobCode is optional PaymentCardResponseJobCode. +type OptPaymentCardResponseJobCode struct { + Value PaymentCardResponseJobCode + Set bool +} + +// IsSet returns true if OptPaymentCardResponseJobCode was set. +func (o OptPaymentCardResponseJobCode) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptPaymentCardResponseJobCode) Reset() { + var v PaymentCardResponseJobCode + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptPaymentCardResponseJobCode) SetTo(v PaymentCardResponseJobCode) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptPaymentCardResponseJobCode) Get() (v PaymentCardResponseJobCode, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptPaymentCardResponseJobCode) Or(d PaymentCardResponseJobCode) PaymentCardResponseJobCode { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptPaymentCardResponsePayType returns new OptPaymentCardResponsePayType with value set to v. +func NewOptPaymentCardResponsePayType(v PaymentCardResponsePayType) OptPaymentCardResponsePayType { + return OptPaymentCardResponsePayType{ + Value: v, + Set: true, + } +} + +// OptPaymentCardResponsePayType is optional PaymentCardResponsePayType. +type OptPaymentCardResponsePayType struct { + Value PaymentCardResponsePayType + Set bool +} + +// IsSet returns true if OptPaymentCardResponsePayType was set. +func (o OptPaymentCardResponsePayType) IsSet() bool { return o.Set } // Reset unsets value. func (o *OptPaymentCardResponsePayType) Reset() { @@ -4624,180 +5061,1176 @@ func NewOptPaymentMethodDirectDebitResponsePayType(v PaymentMethodDirectDebitRes } } -// OptPaymentMethodDirectDebitResponsePayType is optional PaymentMethodDirectDebitResponsePayType. -type OptPaymentMethodDirectDebitResponsePayType struct { - Value PaymentMethodDirectDebitResponsePayType - Set bool -} +// OptPaymentMethodDirectDebitResponsePayType is optional PaymentMethodDirectDebitResponsePayType. +type OptPaymentMethodDirectDebitResponsePayType struct { + Value PaymentMethodDirectDebitResponsePayType + Set bool +} + +// IsSet returns true if OptPaymentMethodDirectDebitResponsePayType was set. +func (o OptPaymentMethodDirectDebitResponsePayType) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptPaymentMethodDirectDebitResponsePayType) Reset() { + var v PaymentMethodDirectDebitResponsePayType + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptPaymentMethodDirectDebitResponsePayType) SetTo(v PaymentMethodDirectDebitResponsePayType) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptPaymentMethodDirectDebitResponsePayType) Get() (v PaymentMethodDirectDebitResponsePayType, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptPaymentMethodDirectDebitResponsePayType) Or(d PaymentMethodDirectDebitResponsePayType) PaymentMethodDirectDebitResponsePayType { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag returns new OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag with value set to v. +func NewOptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag(v PaymentMethodDirectDebitResponseRedirectURLAccessedFlag) OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag { + return OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag{ + Value: v, + Set: true, + } +} + +// OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag is optional PaymentMethodDirectDebitResponseRedirectURLAccessedFlag. +type OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag struct { + Value PaymentMethodDirectDebitResponseRedirectURLAccessedFlag + Set bool +} + +// IsSet returns true if OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag was set. +func (o OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) Reset() { + var v PaymentMethodDirectDebitResponseRedirectURLAccessedFlag + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) SetTo(v PaymentMethodDirectDebitResponseRedirectURLAccessedFlag) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) Get() (v PaymentMethodDirectDebitResponseRedirectURLAccessedFlag, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) Or(d PaymentMethodDirectDebitResponseRedirectURLAccessedFlag) PaymentMethodDirectDebitResponseRedirectURLAccessedFlag { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptPaymentMethodDirectDebitResponseStatus returns new OptPaymentMethodDirectDebitResponseStatus with value set to v. +func NewOptPaymentMethodDirectDebitResponseStatus(v PaymentMethodDirectDebitResponseStatus) OptPaymentMethodDirectDebitResponseStatus { + return OptPaymentMethodDirectDebitResponseStatus{ + Value: v, + Set: true, + } +} + +// OptPaymentMethodDirectDebitResponseStatus is optional PaymentMethodDirectDebitResponseStatus. +type OptPaymentMethodDirectDebitResponseStatus struct { + Value PaymentMethodDirectDebitResponseStatus + Set bool +} + +// IsSet returns true if OptPaymentMethodDirectDebitResponseStatus was set. +func (o OptPaymentMethodDirectDebitResponseStatus) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptPaymentMethodDirectDebitResponseStatus) Reset() { + var v PaymentMethodDirectDebitResponseStatus + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptPaymentMethodDirectDebitResponseStatus) SetTo(v PaymentMethodDirectDebitResponseStatus) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptPaymentMethodDirectDebitResponseStatus) Get() (v PaymentMethodDirectDebitResponseStatus, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptPaymentMethodDirectDebitResponseStatus) Or(d PaymentMethodDirectDebitResponseStatus) PaymentMethodDirectDebitResponseStatus { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// NewOptString returns new OptString with value set to v. +func NewOptString(v string) OptString { + return OptString{ + Value: v, + Set: true, + } +} + +// OptString is optional string. +type OptString struct { + Value string + Set bool +} + +// IsSet returns true if OptString was set. +func (o OptString) IsSet() bool { return o.Set } + +// Reset unsets value. +func (o *OptString) Reset() { + var v string + o.Value = v + o.Set = false +} + +// SetTo sets value to v. +func (o *OptString) SetTo(v string) { + o.Set = true + o.Value = v +} + +// Get returns value and boolean that denotes whether value was set. +func (o OptString) Get() (v string, ok bool) { + if !o.Set { + return v, false + } + return o.Value, true +} + +// Or returns value if set, or given parameter if does not. +func (o OptString) Or(d string) string { + if v, ok := o.Get(); ok { + return v + } + return d +} + +// Ref: #/components/schemas/paymentAuthCard +type PaymentAuthCard struct { + PayType PaymentAuthCardPayType `json:"pay_type"` + AccessID string `json:"access_id"` + Method PaymentAuthCardMethod `json:"method"` + PayTimes OptPaymentAuthCardPayTimes `json:"pay_times"` +} + +// GetPayType returns the value of PayType. +func (s *PaymentAuthCard) GetPayType() PaymentAuthCardPayType { + return s.PayType +} + +// GetAccessID returns the value of AccessID. +func (s *PaymentAuthCard) GetAccessID() string { + return s.AccessID +} + +// GetMethod returns the value of Method. +func (s *PaymentAuthCard) GetMethod() PaymentAuthCardMethod { + return s.Method +} + +// GetPayTimes returns the value of PayTimes. +func (s *PaymentAuthCard) GetPayTimes() OptPaymentAuthCardPayTimes { + return s.PayTimes +} + +// SetPayType sets the value of PayType. +func (s *PaymentAuthCard) SetPayType(val PaymentAuthCardPayType) { + s.PayType = val +} + +// SetAccessID sets the value of AccessID. +func (s *PaymentAuthCard) SetAccessID(val string) { + s.AccessID = val +} + +// SetMethod sets the value of Method. +func (s *PaymentAuthCard) SetMethod(val PaymentAuthCardMethod) { + s.Method = val +} + +// SetPayTimes sets the value of PayTimes. +func (s *PaymentAuthCard) SetPayTimes(val OptPaymentAuthCardPayTimes) { + s.PayTimes = val +} + +type PaymentAuthCardMethod string + +const ( + PaymentAuthCardMethod1 PaymentAuthCardMethod = "1" + PaymentAuthCardMethod2 PaymentAuthCardMethod = "2" + PaymentAuthCardMethod5 PaymentAuthCardMethod = "5" +) + +// AllValues returns all PaymentAuthCardMethod values. +func (PaymentAuthCardMethod) AllValues() []PaymentAuthCardMethod { + return []PaymentAuthCardMethod{ + PaymentAuthCardMethod1, + PaymentAuthCardMethod2, + PaymentAuthCardMethod5, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s PaymentAuthCardMethod) MarshalText() ([]byte, error) { + switch s { + case PaymentAuthCardMethod1: + return []byte(s), nil + case PaymentAuthCardMethod2: + return []byte(s), nil + case PaymentAuthCardMethod5: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *PaymentAuthCardMethod) UnmarshalText(data []byte) error { + switch PaymentAuthCardMethod(data) { + case PaymentAuthCardMethod1: + *s = PaymentAuthCardMethod1 + return nil + case PaymentAuthCardMethod2: + *s = PaymentAuthCardMethod2 + return nil + case PaymentAuthCardMethod5: + *s = PaymentAuthCardMethod5 + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +type PaymentAuthCardPayTimes string + +const ( + PaymentAuthCardPayTimes3 PaymentAuthCardPayTimes = "3" + PaymentAuthCardPayTimes5 PaymentAuthCardPayTimes = "5" + PaymentAuthCardPayTimes6 PaymentAuthCardPayTimes = "6" + PaymentAuthCardPayTimes10 PaymentAuthCardPayTimes = "10" + PaymentAuthCardPayTimes12 PaymentAuthCardPayTimes = "12" + PaymentAuthCardPayTimes15 PaymentAuthCardPayTimes = "15" + PaymentAuthCardPayTimes18 PaymentAuthCardPayTimes = "18" + PaymentAuthCardPayTimes20 PaymentAuthCardPayTimes = "20" + PaymentAuthCardPayTimes24 PaymentAuthCardPayTimes = "24" +) + +// AllValues returns all PaymentAuthCardPayTimes values. +func (PaymentAuthCardPayTimes) AllValues() []PaymentAuthCardPayTimes { + return []PaymentAuthCardPayTimes{ + PaymentAuthCardPayTimes3, + PaymentAuthCardPayTimes5, + PaymentAuthCardPayTimes6, + PaymentAuthCardPayTimes10, + PaymentAuthCardPayTimes12, + PaymentAuthCardPayTimes15, + PaymentAuthCardPayTimes18, + PaymentAuthCardPayTimes20, + PaymentAuthCardPayTimes24, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s PaymentAuthCardPayTimes) MarshalText() ([]byte, error) { + switch s { + case PaymentAuthCardPayTimes3: + return []byte(s), nil + case PaymentAuthCardPayTimes5: + return []byte(s), nil + case PaymentAuthCardPayTimes6: + return []byte(s), nil + case PaymentAuthCardPayTimes10: + return []byte(s), nil + case PaymentAuthCardPayTimes12: + return []byte(s), nil + case PaymentAuthCardPayTimes15: + return []byte(s), nil + case PaymentAuthCardPayTimes18: + return []byte(s), nil + case PaymentAuthCardPayTimes20: + return []byte(s), nil + case PaymentAuthCardPayTimes24: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *PaymentAuthCardPayTimes) UnmarshalText(data []byte) error { + switch PaymentAuthCardPayTimes(data) { + case PaymentAuthCardPayTimes3: + *s = PaymentAuthCardPayTimes3 + return nil + case PaymentAuthCardPayTimes5: + *s = PaymentAuthCardPayTimes5 + return nil + case PaymentAuthCardPayTimes6: + *s = PaymentAuthCardPayTimes6 + return nil + case PaymentAuthCardPayTimes10: + *s = PaymentAuthCardPayTimes10 + return nil + case PaymentAuthCardPayTimes12: + *s = PaymentAuthCardPayTimes12 + return nil + case PaymentAuthCardPayTimes15: + *s = PaymentAuthCardPayTimes15 + return nil + case PaymentAuthCardPayTimes18: + *s = PaymentAuthCardPayTimes18 + return nil + case PaymentAuthCardPayTimes20: + *s = PaymentAuthCardPayTimes20 + return nil + case PaymentAuthCardPayTimes24: + *s = PaymentAuthCardPayTimes24 + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +type PaymentAuthCardPayType string + +const ( + PaymentAuthCardPayTypeCard PaymentAuthCardPayType = "Card" +) + +// AllValues returns all PaymentAuthCardPayType values. +func (PaymentAuthCardPayType) AllValues() []PaymentAuthCardPayType { + return []PaymentAuthCardPayType{ + PaymentAuthCardPayTypeCard, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s PaymentAuthCardPayType) MarshalText() ([]byte, error) { + switch s { + case PaymentAuthCardPayTypeCard: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *PaymentAuthCardPayType) UnmarshalText(data []byte) error { + switch PaymentAuthCardPayType(data) { + case PaymentAuthCardPayTypeCard: + *s = PaymentAuthCardPayTypeCard + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +// Ref: #/components/schemas/paymentAuthCardResponse +type PaymentAuthCardResponse struct { + ShopID OptString `json:"shop_id"` + ID OptString `json:"id"` + PayType OptPaymentAuthCardResponsePayType `json:"pay_type"` + Status OptPaymentAuthCardResponseStatus `json:"status"` + AccessID OptString `json:"access_id"` + ProcessDate OptString `json:"process_date"` + JobCode OptPaymentAuthCardResponseJobCode `json:"job_code"` + ItemCode OptString `json:"item_code"` + Amount OptInt `json:"amount"` + Tax OptInt `json:"tax"` + TotalAmount OptInt `json:"total_amount"` + CustomerGroupID OptNilString `json:"customer_group_id"` + CustomerID OptNilString `json:"customer_id"` + CardNo OptNilString `json:"card_no"` + CardID OptNilString `json:"card_id"` + Expire OptNilString `json:"expire"` + HolderName OptNilString `json:"holder_name"` + CardNoHash OptNilString `json:"card_no_hash"` + Method OptNilPaymentAuthCardResponseMethod `json:"method"` + PayTimes OptNilString `json:"pay_times"` + Forward OptNilString `json:"forward"` + Issuer OptNilString `json:"issuer"` + TransactionID OptNilString `json:"transaction_id"` + Approve OptNilString `json:"approve"` + AuthMaxDate OptNilString `json:"auth_max_date"` + ClientField1 OptNilString `json:"client_field_1"` + ClientField2 OptNilString `json:"client_field_2"` + ClientField3 OptNilString `json:"client_field_3"` + TdsType OptNilPaymentAuthCardResponseTdsType `json:"tds_type"` + Tds2Type OptNilPaymentAuthCardResponseTds2Type `json:"tds2_type"` + Tds2RetURL OptNilString `json:"tds2_ret_url"` + Tds2Status OptNilPaymentAuthCardResponseTds2Status `json:"tds2_status"` + MerchantName OptNilString `json:"merchant_name"` + SendURL OptNilString `json:"send_url"` + SubscriptionID OptNilString `json:"subscription_id"` + Brand OptString `json:"brand"` + ErrorCode OptNilString `json:"error_code"` + Created OptNilString `json:"created"` + Updated OptNilString `json:"updated"` +} + +// GetShopID returns the value of ShopID. +func (s *PaymentAuthCardResponse) GetShopID() OptString { + return s.ShopID +} + +// GetID returns the value of ID. +func (s *PaymentAuthCardResponse) GetID() OptString { + return s.ID +} + +// GetPayType returns the value of PayType. +func (s *PaymentAuthCardResponse) GetPayType() OptPaymentAuthCardResponsePayType { + return s.PayType +} + +// GetStatus returns the value of Status. +func (s *PaymentAuthCardResponse) GetStatus() OptPaymentAuthCardResponseStatus { + return s.Status +} + +// GetAccessID returns the value of AccessID. +func (s *PaymentAuthCardResponse) GetAccessID() OptString { + return s.AccessID +} + +// GetProcessDate returns the value of ProcessDate. +func (s *PaymentAuthCardResponse) GetProcessDate() OptString { + return s.ProcessDate +} + +// GetJobCode returns the value of JobCode. +func (s *PaymentAuthCardResponse) GetJobCode() OptPaymentAuthCardResponseJobCode { + return s.JobCode +} + +// GetItemCode returns the value of ItemCode. +func (s *PaymentAuthCardResponse) GetItemCode() OptString { + return s.ItemCode +} + +// GetAmount returns the value of Amount. +func (s *PaymentAuthCardResponse) GetAmount() OptInt { + return s.Amount +} + +// GetTax returns the value of Tax. +func (s *PaymentAuthCardResponse) GetTax() OptInt { + return s.Tax +} + +// GetTotalAmount returns the value of TotalAmount. +func (s *PaymentAuthCardResponse) GetTotalAmount() OptInt { + return s.TotalAmount +} + +// GetCustomerGroupID returns the value of CustomerGroupID. +func (s *PaymentAuthCardResponse) GetCustomerGroupID() OptNilString { + return s.CustomerGroupID +} + +// GetCustomerID returns the value of CustomerID. +func (s *PaymentAuthCardResponse) GetCustomerID() OptNilString { + return s.CustomerID +} + +// GetCardNo returns the value of CardNo. +func (s *PaymentAuthCardResponse) GetCardNo() OptNilString { + return s.CardNo +} + +// GetCardID returns the value of CardID. +func (s *PaymentAuthCardResponse) GetCardID() OptNilString { + return s.CardID +} + +// GetExpire returns the value of Expire. +func (s *PaymentAuthCardResponse) GetExpire() OptNilString { + return s.Expire +} + +// GetHolderName returns the value of HolderName. +func (s *PaymentAuthCardResponse) GetHolderName() OptNilString { + return s.HolderName +} + +// GetCardNoHash returns the value of CardNoHash. +func (s *PaymentAuthCardResponse) GetCardNoHash() OptNilString { + return s.CardNoHash +} + +// GetMethod returns the value of Method. +func (s *PaymentAuthCardResponse) GetMethod() OptNilPaymentAuthCardResponseMethod { + return s.Method +} + +// GetPayTimes returns the value of PayTimes. +func (s *PaymentAuthCardResponse) GetPayTimes() OptNilString { + return s.PayTimes +} + +// GetForward returns the value of Forward. +func (s *PaymentAuthCardResponse) GetForward() OptNilString { + return s.Forward +} + +// GetIssuer returns the value of Issuer. +func (s *PaymentAuthCardResponse) GetIssuer() OptNilString { + return s.Issuer +} + +// GetTransactionID returns the value of TransactionID. +func (s *PaymentAuthCardResponse) GetTransactionID() OptNilString { + return s.TransactionID +} + +// GetApprove returns the value of Approve. +func (s *PaymentAuthCardResponse) GetApprove() OptNilString { + return s.Approve +} + +// GetAuthMaxDate returns the value of AuthMaxDate. +func (s *PaymentAuthCardResponse) GetAuthMaxDate() OptNilString { + return s.AuthMaxDate +} + +// GetClientField1 returns the value of ClientField1. +func (s *PaymentAuthCardResponse) GetClientField1() OptNilString { + return s.ClientField1 +} + +// GetClientField2 returns the value of ClientField2. +func (s *PaymentAuthCardResponse) GetClientField2() OptNilString { + return s.ClientField2 +} + +// GetClientField3 returns the value of ClientField3. +func (s *PaymentAuthCardResponse) GetClientField3() OptNilString { + return s.ClientField3 +} + +// GetTdsType returns the value of TdsType. +func (s *PaymentAuthCardResponse) GetTdsType() OptNilPaymentAuthCardResponseTdsType { + return s.TdsType +} + +// GetTds2Type returns the value of Tds2Type. +func (s *PaymentAuthCardResponse) GetTds2Type() OptNilPaymentAuthCardResponseTds2Type { + return s.Tds2Type +} + +// GetTds2RetURL returns the value of Tds2RetURL. +func (s *PaymentAuthCardResponse) GetTds2RetURL() OptNilString { + return s.Tds2RetURL +} + +// GetTds2Status returns the value of Tds2Status. +func (s *PaymentAuthCardResponse) GetTds2Status() OptNilPaymentAuthCardResponseTds2Status { + return s.Tds2Status +} + +// GetMerchantName returns the value of MerchantName. +func (s *PaymentAuthCardResponse) GetMerchantName() OptNilString { + return s.MerchantName +} + +// GetSendURL returns the value of SendURL. +func (s *PaymentAuthCardResponse) GetSendURL() OptNilString { + return s.SendURL +} + +// GetSubscriptionID returns the value of SubscriptionID. +func (s *PaymentAuthCardResponse) GetSubscriptionID() OptNilString { + return s.SubscriptionID +} + +// GetBrand returns the value of Brand. +func (s *PaymentAuthCardResponse) GetBrand() OptString { + return s.Brand +} + +// GetErrorCode returns the value of ErrorCode. +func (s *PaymentAuthCardResponse) GetErrorCode() OptNilString { + return s.ErrorCode +} + +// GetCreated returns the value of Created. +func (s *PaymentAuthCardResponse) GetCreated() OptNilString { + return s.Created +} + +// GetUpdated returns the value of Updated. +func (s *PaymentAuthCardResponse) GetUpdated() OptNilString { + return s.Updated +} + +// SetShopID sets the value of ShopID. +func (s *PaymentAuthCardResponse) SetShopID(val OptString) { + s.ShopID = val +} + +// SetID sets the value of ID. +func (s *PaymentAuthCardResponse) SetID(val OptString) { + s.ID = val +} + +// SetPayType sets the value of PayType. +func (s *PaymentAuthCardResponse) SetPayType(val OptPaymentAuthCardResponsePayType) { + s.PayType = val +} + +// SetStatus sets the value of Status. +func (s *PaymentAuthCardResponse) SetStatus(val OptPaymentAuthCardResponseStatus) { + s.Status = val +} + +// SetAccessID sets the value of AccessID. +func (s *PaymentAuthCardResponse) SetAccessID(val OptString) { + s.AccessID = val +} + +// SetProcessDate sets the value of ProcessDate. +func (s *PaymentAuthCardResponse) SetProcessDate(val OptString) { + s.ProcessDate = val +} + +// SetJobCode sets the value of JobCode. +func (s *PaymentAuthCardResponse) SetJobCode(val OptPaymentAuthCardResponseJobCode) { + s.JobCode = val +} + +// SetItemCode sets the value of ItemCode. +func (s *PaymentAuthCardResponse) SetItemCode(val OptString) { + s.ItemCode = val +} + +// SetAmount sets the value of Amount. +func (s *PaymentAuthCardResponse) SetAmount(val OptInt) { + s.Amount = val +} + +// SetTax sets the value of Tax. +func (s *PaymentAuthCardResponse) SetTax(val OptInt) { + s.Tax = val +} + +// SetTotalAmount sets the value of TotalAmount. +func (s *PaymentAuthCardResponse) SetTotalAmount(val OptInt) { + s.TotalAmount = val +} + +// SetCustomerGroupID sets the value of CustomerGroupID. +func (s *PaymentAuthCardResponse) SetCustomerGroupID(val OptNilString) { + s.CustomerGroupID = val +} + +// SetCustomerID sets the value of CustomerID. +func (s *PaymentAuthCardResponse) SetCustomerID(val OptNilString) { + s.CustomerID = val +} + +// SetCardNo sets the value of CardNo. +func (s *PaymentAuthCardResponse) SetCardNo(val OptNilString) { + s.CardNo = val +} + +// SetCardID sets the value of CardID. +func (s *PaymentAuthCardResponse) SetCardID(val OptNilString) { + s.CardID = val +} + +// SetExpire sets the value of Expire. +func (s *PaymentAuthCardResponse) SetExpire(val OptNilString) { + s.Expire = val +} + +// SetHolderName sets the value of HolderName. +func (s *PaymentAuthCardResponse) SetHolderName(val OptNilString) { + s.HolderName = val +} + +// SetCardNoHash sets the value of CardNoHash. +func (s *PaymentAuthCardResponse) SetCardNoHash(val OptNilString) { + s.CardNoHash = val +} + +// SetMethod sets the value of Method. +func (s *PaymentAuthCardResponse) SetMethod(val OptNilPaymentAuthCardResponseMethod) { + s.Method = val +} + +// SetPayTimes sets the value of PayTimes. +func (s *PaymentAuthCardResponse) SetPayTimes(val OptNilString) { + s.PayTimes = val +} + +// SetForward sets the value of Forward. +func (s *PaymentAuthCardResponse) SetForward(val OptNilString) { + s.Forward = val +} + +// SetIssuer sets the value of Issuer. +func (s *PaymentAuthCardResponse) SetIssuer(val OptNilString) { + s.Issuer = val +} + +// SetTransactionID sets the value of TransactionID. +func (s *PaymentAuthCardResponse) SetTransactionID(val OptNilString) { + s.TransactionID = val +} + +// SetApprove sets the value of Approve. +func (s *PaymentAuthCardResponse) SetApprove(val OptNilString) { + s.Approve = val +} + +// SetAuthMaxDate sets the value of AuthMaxDate. +func (s *PaymentAuthCardResponse) SetAuthMaxDate(val OptNilString) { + s.AuthMaxDate = val +} + +// SetClientField1 sets the value of ClientField1. +func (s *PaymentAuthCardResponse) SetClientField1(val OptNilString) { + s.ClientField1 = val +} + +// SetClientField2 sets the value of ClientField2. +func (s *PaymentAuthCardResponse) SetClientField2(val OptNilString) { + s.ClientField2 = val +} + +// SetClientField3 sets the value of ClientField3. +func (s *PaymentAuthCardResponse) SetClientField3(val OptNilString) { + s.ClientField3 = val +} + +// SetTdsType sets the value of TdsType. +func (s *PaymentAuthCardResponse) SetTdsType(val OptNilPaymentAuthCardResponseTdsType) { + s.TdsType = val +} + +// SetTds2Type sets the value of Tds2Type. +func (s *PaymentAuthCardResponse) SetTds2Type(val OptNilPaymentAuthCardResponseTds2Type) { + s.Tds2Type = val +} + +// SetTds2RetURL sets the value of Tds2RetURL. +func (s *PaymentAuthCardResponse) SetTds2RetURL(val OptNilString) { + s.Tds2RetURL = val +} + +// SetTds2Status sets the value of Tds2Status. +func (s *PaymentAuthCardResponse) SetTds2Status(val OptNilPaymentAuthCardResponseTds2Status) { + s.Tds2Status = val +} + +// SetMerchantName sets the value of MerchantName. +func (s *PaymentAuthCardResponse) SetMerchantName(val OptNilString) { + s.MerchantName = val +} + +// SetSendURL sets the value of SendURL. +func (s *PaymentAuthCardResponse) SetSendURL(val OptNilString) { + s.SendURL = val +} + +// SetSubscriptionID sets the value of SubscriptionID. +func (s *PaymentAuthCardResponse) SetSubscriptionID(val OptNilString) { + s.SubscriptionID = val +} + +// SetBrand sets the value of Brand. +func (s *PaymentAuthCardResponse) SetBrand(val OptString) { + s.Brand = val +} + +// SetErrorCode sets the value of ErrorCode. +func (s *PaymentAuthCardResponse) SetErrorCode(val OptNilString) { + s.ErrorCode = val +} + +// SetCreated sets the value of Created. +func (s *PaymentAuthCardResponse) SetCreated(val OptNilString) { + s.Created = val +} + +// SetUpdated sets the value of Updated. +func (s *PaymentAuthCardResponse) SetUpdated(val OptNilString) { + s.Updated = val +} + +type PaymentAuthCardResponseJobCode string + +const ( + PaymentAuthCardResponseJobCodeCHECK PaymentAuthCardResponseJobCode = "CHECK" + PaymentAuthCardResponseJobCodeAUTH PaymentAuthCardResponseJobCode = "AUTH" + PaymentAuthCardResponseJobCodeCAPTURE PaymentAuthCardResponseJobCode = "CAPTURE" + PaymentAuthCardResponseJobCodeSALES PaymentAuthCardResponseJobCode = "SALES" + PaymentAuthCardResponseJobCodeCANCEL PaymentAuthCardResponseJobCode = "CANCEL" +) + +// AllValues returns all PaymentAuthCardResponseJobCode values. +func (PaymentAuthCardResponseJobCode) AllValues() []PaymentAuthCardResponseJobCode { + return []PaymentAuthCardResponseJobCode{ + PaymentAuthCardResponseJobCodeCHECK, + PaymentAuthCardResponseJobCodeAUTH, + PaymentAuthCardResponseJobCodeCAPTURE, + PaymentAuthCardResponseJobCodeSALES, + PaymentAuthCardResponseJobCodeCANCEL, + } +} + +// MarshalText implements encoding.TextMarshaler. +func (s PaymentAuthCardResponseJobCode) MarshalText() ([]byte, error) { + switch s { + case PaymentAuthCardResponseJobCodeCHECK: + return []byte(s), nil + case PaymentAuthCardResponseJobCodeAUTH: + return []byte(s), nil + case PaymentAuthCardResponseJobCodeCAPTURE: + return []byte(s), nil + case PaymentAuthCardResponseJobCodeSALES: + return []byte(s), nil + case PaymentAuthCardResponseJobCodeCANCEL: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *PaymentAuthCardResponseJobCode) UnmarshalText(data []byte) error { + switch PaymentAuthCardResponseJobCode(data) { + case PaymentAuthCardResponseJobCodeCHECK: + *s = PaymentAuthCardResponseJobCodeCHECK + return nil + case PaymentAuthCardResponseJobCodeAUTH: + *s = PaymentAuthCardResponseJobCodeAUTH + return nil + case PaymentAuthCardResponseJobCodeCAPTURE: + *s = PaymentAuthCardResponseJobCodeCAPTURE + return nil + case PaymentAuthCardResponseJobCodeSALES: + *s = PaymentAuthCardResponseJobCodeSALES + return nil + case PaymentAuthCardResponseJobCodeCANCEL: + *s = PaymentAuthCardResponseJobCodeCANCEL + return nil + default: + return errors.Errorf("invalid value: %q", data) + } +} + +type PaymentAuthCardResponseMethod string -// IsSet returns true if OptPaymentMethodDirectDebitResponsePayType was set. -func (o OptPaymentMethodDirectDebitResponsePayType) IsSet() bool { return o.Set } +const ( + PaymentAuthCardResponseMethod1 PaymentAuthCardResponseMethod = "1" + PaymentAuthCardResponseMethod2 PaymentAuthCardResponseMethod = "2" + PaymentAuthCardResponseMethod5 PaymentAuthCardResponseMethod = "5" +) -// Reset unsets value. -func (o *OptPaymentMethodDirectDebitResponsePayType) Reset() { - var v PaymentMethodDirectDebitResponsePayType - o.Value = v - o.Set = false +// AllValues returns all PaymentAuthCardResponseMethod values. +func (PaymentAuthCardResponseMethod) AllValues() []PaymentAuthCardResponseMethod { + return []PaymentAuthCardResponseMethod{ + PaymentAuthCardResponseMethod1, + PaymentAuthCardResponseMethod2, + PaymentAuthCardResponseMethod5, + } } -// SetTo sets value to v. -func (o *OptPaymentMethodDirectDebitResponsePayType) SetTo(v PaymentMethodDirectDebitResponsePayType) { - o.Set = true - o.Value = v +// MarshalText implements encoding.TextMarshaler. +func (s PaymentAuthCardResponseMethod) MarshalText() ([]byte, error) { + switch s { + case PaymentAuthCardResponseMethod1: + return []byte(s), nil + case PaymentAuthCardResponseMethod2: + return []byte(s), nil + case PaymentAuthCardResponseMethod5: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } } -// Get returns value and boolean that denotes whether value was set. -func (o OptPaymentMethodDirectDebitResponsePayType) Get() (v PaymentMethodDirectDebitResponsePayType, ok bool) { - if !o.Set { - return v, false +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *PaymentAuthCardResponseMethod) UnmarshalText(data []byte) error { + switch PaymentAuthCardResponseMethod(data) { + case PaymentAuthCardResponseMethod1: + *s = PaymentAuthCardResponseMethod1 + return nil + case PaymentAuthCardResponseMethod2: + *s = PaymentAuthCardResponseMethod2 + return nil + case PaymentAuthCardResponseMethod5: + *s = PaymentAuthCardResponseMethod5 + return nil + default: + return errors.Errorf("invalid value: %q", data) } - return o.Value, true } -// Or returns value if set, or given parameter if does not. -func (o OptPaymentMethodDirectDebitResponsePayType) Or(d PaymentMethodDirectDebitResponsePayType) PaymentMethodDirectDebitResponsePayType { - if v, ok := o.Get(); ok { - return v +type PaymentAuthCardResponsePayType string + +const ( + PaymentAuthCardResponsePayTypeCard PaymentAuthCardResponsePayType = "Card" +) + +// AllValues returns all PaymentAuthCardResponsePayType values. +func (PaymentAuthCardResponsePayType) AllValues() []PaymentAuthCardResponsePayType { + return []PaymentAuthCardResponsePayType{ + PaymentAuthCardResponsePayTypeCard, } - return d } -// NewOptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag returns new OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag with value set to v. -func NewOptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag(v PaymentMethodDirectDebitResponseRedirectURLAccessedFlag) OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag { - return OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag{ - Value: v, - Set: true, +// MarshalText implements encoding.TextMarshaler. +func (s PaymentAuthCardResponsePayType) MarshalText() ([]byte, error) { + switch s { + case PaymentAuthCardResponsePayTypeCard: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) } } -// OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag is optional PaymentMethodDirectDebitResponseRedirectURLAccessedFlag. -type OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag struct { - Value PaymentMethodDirectDebitResponseRedirectURLAccessedFlag - Set bool +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *PaymentAuthCardResponsePayType) UnmarshalText(data []byte) error { + switch PaymentAuthCardResponsePayType(data) { + case PaymentAuthCardResponsePayTypeCard: + *s = PaymentAuthCardResponsePayTypeCard + return nil + default: + return errors.Errorf("invalid value: %q", data) + } } -// IsSet returns true if OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag was set. -func (o OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) Reset() { - var v PaymentMethodDirectDebitResponseRedirectURLAccessedFlag - o.Value = v - o.Set = false -} +type PaymentAuthCardResponseStatus string -// SetTo sets value to v. -func (o *OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) SetTo(v PaymentMethodDirectDebitResponseRedirectURLAccessedFlag) { - o.Set = true - o.Value = v -} +const ( + PaymentAuthCardResponseStatusUNPROCESSED PaymentAuthCardResponseStatus = "UNPROCESSED" + PaymentAuthCardResponseStatusCHECKED PaymentAuthCardResponseStatus = "CHECKED" + PaymentAuthCardResponseStatusAUTHORIZED PaymentAuthCardResponseStatus = "AUTHORIZED" + PaymentAuthCardResponseStatusCAPTURED PaymentAuthCardResponseStatus = "CAPTURED" + PaymentAuthCardResponseStatusCANCELED PaymentAuthCardResponseStatus = "CANCELED" + PaymentAuthCardResponseStatusAUTHENTICATED PaymentAuthCardResponseStatus = "AUTHENTICATED" +) -// Get returns value and boolean that denotes whether value was set. -func (o OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) Get() (v PaymentMethodDirectDebitResponseRedirectURLAccessedFlag, ok bool) { - if !o.Set { - return v, false +// AllValues returns all PaymentAuthCardResponseStatus values. +func (PaymentAuthCardResponseStatus) AllValues() []PaymentAuthCardResponseStatus { + return []PaymentAuthCardResponseStatus{ + PaymentAuthCardResponseStatusUNPROCESSED, + PaymentAuthCardResponseStatusCHECKED, + PaymentAuthCardResponseStatusAUTHORIZED, + PaymentAuthCardResponseStatusCAPTURED, + PaymentAuthCardResponseStatusCANCELED, + PaymentAuthCardResponseStatusAUTHENTICATED, } - return o.Value, true } -// Or returns value if set, or given parameter if does not. -func (o OptPaymentMethodDirectDebitResponseRedirectURLAccessedFlag) Or(d PaymentMethodDirectDebitResponseRedirectURLAccessedFlag) PaymentMethodDirectDebitResponseRedirectURLAccessedFlag { - if v, ok := o.Get(); ok { - return v +// MarshalText implements encoding.TextMarshaler. +func (s PaymentAuthCardResponseStatus) MarshalText() ([]byte, error) { + switch s { + case PaymentAuthCardResponseStatusUNPROCESSED: + return []byte(s), nil + case PaymentAuthCardResponseStatusCHECKED: + return []byte(s), nil + case PaymentAuthCardResponseStatusAUTHORIZED: + return []byte(s), nil + case PaymentAuthCardResponseStatusCAPTURED: + return []byte(s), nil + case PaymentAuthCardResponseStatusCANCELED: + return []byte(s), nil + case PaymentAuthCardResponseStatusAUTHENTICATED: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) } - return d } -// NewOptPaymentMethodDirectDebitResponseStatus returns new OptPaymentMethodDirectDebitResponseStatus with value set to v. -func NewOptPaymentMethodDirectDebitResponseStatus(v PaymentMethodDirectDebitResponseStatus) OptPaymentMethodDirectDebitResponseStatus { - return OptPaymentMethodDirectDebitResponseStatus{ - Value: v, - Set: true, +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *PaymentAuthCardResponseStatus) UnmarshalText(data []byte) error { + switch PaymentAuthCardResponseStatus(data) { + case PaymentAuthCardResponseStatusUNPROCESSED: + *s = PaymentAuthCardResponseStatusUNPROCESSED + return nil + case PaymentAuthCardResponseStatusCHECKED: + *s = PaymentAuthCardResponseStatusCHECKED + return nil + case PaymentAuthCardResponseStatusAUTHORIZED: + *s = PaymentAuthCardResponseStatusAUTHORIZED + return nil + case PaymentAuthCardResponseStatusCAPTURED: + *s = PaymentAuthCardResponseStatusCAPTURED + return nil + case PaymentAuthCardResponseStatusCANCELED: + *s = PaymentAuthCardResponseStatusCANCELED + return nil + case PaymentAuthCardResponseStatusAUTHENTICATED: + *s = PaymentAuthCardResponseStatusAUTHENTICATED + return nil + default: + return errors.Errorf("invalid value: %q", data) } } -// OptPaymentMethodDirectDebitResponseStatus is optional PaymentMethodDirectDebitResponseStatus. -type OptPaymentMethodDirectDebitResponseStatus struct { - Value PaymentMethodDirectDebitResponseStatus - Set bool -} +type PaymentAuthCardResponseTds2Status string -// IsSet returns true if OptPaymentMethodDirectDebitResponseStatus was set. -func (o OptPaymentMethodDirectDebitResponseStatus) IsSet() bool { return o.Set } +const ( + PaymentAuthCardResponseTds2StatusAUTHENTICATING PaymentAuthCardResponseTds2Status = "AUTHENTICATING" + PaymentAuthCardResponseTds2StatusCHALLENGE PaymentAuthCardResponseTds2Status = "CHALLENGE" + PaymentAuthCardResponseTds2StatusAUTHENTICATED PaymentAuthCardResponseTds2Status = "AUTHENTICATED" +) -// Reset unsets value. -func (o *OptPaymentMethodDirectDebitResponseStatus) Reset() { - var v PaymentMethodDirectDebitResponseStatus - o.Value = v - o.Set = false +// AllValues returns all PaymentAuthCardResponseTds2Status values. +func (PaymentAuthCardResponseTds2Status) AllValues() []PaymentAuthCardResponseTds2Status { + return []PaymentAuthCardResponseTds2Status{ + PaymentAuthCardResponseTds2StatusAUTHENTICATING, + PaymentAuthCardResponseTds2StatusCHALLENGE, + PaymentAuthCardResponseTds2StatusAUTHENTICATED, + } } -// SetTo sets value to v. -func (o *OptPaymentMethodDirectDebitResponseStatus) SetTo(v PaymentMethodDirectDebitResponseStatus) { - o.Set = true - o.Value = v +// MarshalText implements encoding.TextMarshaler. +func (s PaymentAuthCardResponseTds2Status) MarshalText() ([]byte, error) { + switch s { + case PaymentAuthCardResponseTds2StatusAUTHENTICATING: + return []byte(s), nil + case PaymentAuthCardResponseTds2StatusCHALLENGE: + return []byte(s), nil + case PaymentAuthCardResponseTds2StatusAUTHENTICATED: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) + } } -// Get returns value and boolean that denotes whether value was set. -func (o OptPaymentMethodDirectDebitResponseStatus) Get() (v PaymentMethodDirectDebitResponseStatus, ok bool) { - if !o.Set { - return v, false +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *PaymentAuthCardResponseTds2Status) UnmarshalText(data []byte) error { + switch PaymentAuthCardResponseTds2Status(data) { + case PaymentAuthCardResponseTds2StatusAUTHENTICATING: + *s = PaymentAuthCardResponseTds2StatusAUTHENTICATING + return nil + case PaymentAuthCardResponseTds2StatusCHALLENGE: + *s = PaymentAuthCardResponseTds2StatusCHALLENGE + return nil + case PaymentAuthCardResponseTds2StatusAUTHENTICATED: + *s = PaymentAuthCardResponseTds2StatusAUTHENTICATED + return nil + default: + return errors.Errorf("invalid value: %q", data) } - return o.Value, true } -// Or returns value if set, or given parameter if does not. -func (o OptPaymentMethodDirectDebitResponseStatus) Or(d PaymentMethodDirectDebitResponseStatus) PaymentMethodDirectDebitResponseStatus { - if v, ok := o.Get(); ok { - return v +type PaymentAuthCardResponseTds2Type string + +const ( + PaymentAuthCardResponseTds2Type2 PaymentAuthCardResponseTds2Type = "2" + PaymentAuthCardResponseTds2Type3 PaymentAuthCardResponseTds2Type = "3" +) + +// AllValues returns all PaymentAuthCardResponseTds2Type values. +func (PaymentAuthCardResponseTds2Type) AllValues() []PaymentAuthCardResponseTds2Type { + return []PaymentAuthCardResponseTds2Type{ + PaymentAuthCardResponseTds2Type2, + PaymentAuthCardResponseTds2Type3, } - return d } -// NewOptString returns new OptString with value set to v. -func NewOptString(v string) OptString { - return OptString{ - Value: v, - Set: true, +// MarshalText implements encoding.TextMarshaler. +func (s PaymentAuthCardResponseTds2Type) MarshalText() ([]byte, error) { + switch s { + case PaymentAuthCardResponseTds2Type2: + return []byte(s), nil + case PaymentAuthCardResponseTds2Type3: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) } } -// OptString is optional string. -type OptString struct { - Value string - Set bool +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *PaymentAuthCardResponseTds2Type) UnmarshalText(data []byte) error { + switch PaymentAuthCardResponseTds2Type(data) { + case PaymentAuthCardResponseTds2Type2: + *s = PaymentAuthCardResponseTds2Type2 + return nil + case PaymentAuthCardResponseTds2Type3: + *s = PaymentAuthCardResponseTds2Type3 + return nil + default: + return errors.Errorf("invalid value: %q", data) + } } -// IsSet returns true if OptString was set. -func (o OptString) IsSet() bool { return o.Set } +type PaymentAuthCardResponseTdsType string -// Reset unsets value. -func (o *OptString) Reset() { - var v string - o.Value = v - o.Set = false -} +const ( + PaymentAuthCardResponseTdsType0 PaymentAuthCardResponseTdsType = "0" + PaymentAuthCardResponseTdsType2 PaymentAuthCardResponseTdsType = "2" +) -// SetTo sets value to v. -func (o *OptString) SetTo(v string) { - o.Set = true - o.Value = v +// AllValues returns all PaymentAuthCardResponseTdsType values. +func (PaymentAuthCardResponseTdsType) AllValues() []PaymentAuthCardResponseTdsType { + return []PaymentAuthCardResponseTdsType{ + PaymentAuthCardResponseTdsType0, + PaymentAuthCardResponseTdsType2, + } } -// Get returns value and boolean that denotes whether value was set. -func (o OptString) Get() (v string, ok bool) { - if !o.Set { - return v, false +// MarshalText implements encoding.TextMarshaler. +func (s PaymentAuthCardResponseTdsType) MarshalText() ([]byte, error) { + switch s { + case PaymentAuthCardResponseTdsType0: + return []byte(s), nil + case PaymentAuthCardResponseTdsType2: + return []byte(s), nil + default: + return nil, errors.Errorf("invalid value: %q", s) } - return o.Value, true } -// Or returns value if set, or given parameter if does not. -func (o OptString) Or(d string) string { - if v, ok := o.Get(); ok { - return v +// UnmarshalText implements encoding.TextUnmarshaler. +func (s *PaymentAuthCardResponseTdsType) UnmarshalText(data []byte) error { + switch PaymentAuthCardResponseTdsType(data) { + case PaymentAuthCardResponseTdsType0: + *s = PaymentAuthCardResponseTdsType0 + return nil + case PaymentAuthCardResponseTdsType2: + *s = PaymentAuthCardResponseTdsType2 + return nil + default: + return errors.Errorf("invalid value: %q", data) } - return d } // Ref: #/components/schemas/paymentCancelCard @@ -13113,6 +14546,88 @@ func (s *PaymentsGetOKListItem) SetUpdated(val OptString) { s.Updated = val } +// PaymentsIDAuthPutOK represents sum type. +type PaymentsIDAuthPutOK struct { + Type PaymentsIDAuthPutOKType // switch on this field + PaymentAuthCardResponse PaymentAuthCardResponse +} + +// PaymentsIDAuthPutOKType is oneOf type of PaymentsIDAuthPutOK. +type PaymentsIDAuthPutOKType string + +// Possible values for PaymentsIDAuthPutOKType. +const ( + PaymentAuthCardResponsePaymentsIDAuthPutOK PaymentsIDAuthPutOKType = "PaymentAuthCardResponse" +) + +// IsPaymentAuthCardResponse reports whether PaymentsIDAuthPutOK is PaymentAuthCardResponse. +func (s PaymentsIDAuthPutOK) IsPaymentAuthCardResponse() bool { + return s.Type == PaymentAuthCardResponsePaymentsIDAuthPutOK +} + +// SetPaymentAuthCardResponse sets PaymentsIDAuthPutOK to PaymentAuthCardResponse. +func (s *PaymentsIDAuthPutOK) SetPaymentAuthCardResponse(v PaymentAuthCardResponse) { + s.Type = PaymentAuthCardResponsePaymentsIDAuthPutOK + s.PaymentAuthCardResponse = v +} + +// GetPaymentAuthCardResponse returns PaymentAuthCardResponse and true boolean if PaymentsIDAuthPutOK is PaymentAuthCardResponse. +func (s PaymentsIDAuthPutOK) GetPaymentAuthCardResponse() (v PaymentAuthCardResponse, ok bool) { + if !s.IsPaymentAuthCardResponse() { + return v, false + } + return s.PaymentAuthCardResponse, true +} + +// NewPaymentAuthCardResponsePaymentsIDAuthPutOK returns new PaymentsIDAuthPutOK from PaymentAuthCardResponse. +func NewPaymentAuthCardResponsePaymentsIDAuthPutOK(v PaymentAuthCardResponse) PaymentsIDAuthPutOK { + var s PaymentsIDAuthPutOK + s.SetPaymentAuthCardResponse(v) + return s +} + +func (*PaymentsIDAuthPutOK) paymentsIDAuthPutRes() {} + +// PaymentsIDAuthPutReq represents sum type. +type PaymentsIDAuthPutReq struct { + Type PaymentsIDAuthPutReqType // switch on this field + PaymentAuthCard PaymentAuthCard +} + +// PaymentsIDAuthPutReqType is oneOf type of PaymentsIDAuthPutReq. +type PaymentsIDAuthPutReqType string + +// Possible values for PaymentsIDAuthPutReqType. +const ( + PaymentAuthCardPaymentsIDAuthPutReq PaymentsIDAuthPutReqType = "PaymentAuthCard" +) + +// IsPaymentAuthCard reports whether PaymentsIDAuthPutReq is PaymentAuthCard. +func (s PaymentsIDAuthPutReq) IsPaymentAuthCard() bool { + return s.Type == PaymentAuthCardPaymentsIDAuthPutReq +} + +// SetPaymentAuthCard sets PaymentsIDAuthPutReq to PaymentAuthCard. +func (s *PaymentsIDAuthPutReq) SetPaymentAuthCard(v PaymentAuthCard) { + s.Type = PaymentAuthCardPaymentsIDAuthPutReq + s.PaymentAuthCard = v +} + +// GetPaymentAuthCard returns PaymentAuthCard and true boolean if PaymentsIDAuthPutReq is PaymentAuthCard. +func (s PaymentsIDAuthPutReq) GetPaymentAuthCard() (v PaymentAuthCard, ok bool) { + if !s.IsPaymentAuthCard() { + return v, false + } + return s.PaymentAuthCard, true +} + +// NewPaymentAuthCardPaymentsIDAuthPutReq returns new PaymentsIDAuthPutReq from PaymentAuthCard. +func NewPaymentAuthCardPaymentsIDAuthPutReq(v PaymentAuthCard) PaymentsIDAuthPutReq { + var s PaymentsIDAuthPutReq + s.SetPaymentAuthCard(v) + return s +} + // PaymentsIDCancelPutOK represents sum type. type PaymentsIDCancelPutOK struct { Type PaymentsIDCancelPutOKType // switch on this field diff --git a/api/oas_server_gen.go b/api/oas_server_gen.go index dc05dd5..1a8a1a0 100644 --- a/api/oas_server_gen.go +++ b/api/oas_server_gen.go @@ -44,6 +44,10 @@ type Handler interface { // // GET /payments PaymentsGet(ctx context.Context, params PaymentsGetParams) (PaymentsGetRes, error) + // PaymentsIDAuthPut implements PUT /payments/{id}/auth operation. + // + // PUT /payments/{id}/auth + PaymentsIDAuthPut(ctx context.Context, req PaymentsIDAuthPutReq, params PaymentsIDAuthPutParams) (PaymentsIDAuthPutRes, error) // PaymentsIDCancelPut implements PUT /payments/{id}/cancel operation. // // PUT /payments/{id}/cancel diff --git a/api/oas_unimplemented_gen.go b/api/oas_unimplemented_gen.go index 86ab19a..bba3191 100644 --- a/api/oas_unimplemented_gen.go +++ b/api/oas_unimplemented_gen.go @@ -76,6 +76,13 @@ func (UnimplementedHandler) PaymentsGet(ctx context.Context, params PaymentsGetP return r, ht.ErrNotImplemented } +// PaymentsIDAuthPut implements PUT /payments/{id}/auth operation. +// +// PUT /payments/{id}/auth +func (UnimplementedHandler) PaymentsIDAuthPut(ctx context.Context, req PaymentsIDAuthPutReq, params PaymentsIDAuthPutParams) (r PaymentsIDAuthPutRes, _ error) { + return r, ht.ErrNotImplemented +} + // PaymentsIDCancelPut implements PUT /payments/{id}/cancel operation. // // PUT /payments/{id}/cancel diff --git a/api/oas_validators_gen.go b/api/oas_validators_gen.go index 487fbae..e1b2402 100644 --- a/api/oas_validators_gen.go +++ b/api/oas_validators_gen.go @@ -326,6 +326,440 @@ func (s *ErrorResponse) Validate() error { return nil } +func (s *PaymentAuthCard) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if err := s.PayType.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "pay_type", + Error: err, + }) + } + if err := func() error { + if err := s.Method.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "method", + Error: err, + }) + } + if err := func() error { + if value, ok := s.PayTimes.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "pay_times", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s PaymentAuthCardMethod) Validate() error { + switch s { + case "1": + return nil + case "2": + return nil + case "5": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s PaymentAuthCardPayTimes) Validate() error { + switch s { + case "3": + return nil + case "5": + return nil + case "6": + return nil + case "10": + return nil + case "12": + return nil + case "15": + return nil + case "18": + return nil + case "20": + return nil + case "24": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s PaymentAuthCardPayType) Validate() error { + switch s { + case "Card": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s *PaymentAuthCardResponse) Validate() error { + if s == nil { + return validate.ErrNilPointer + } + + var failures []validate.FieldError + if err := func() error { + if value, ok := s.PayType.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "pay_type", + Error: err, + }) + } + if err := func() error { + if value, ok := s.Status.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "status", + Error: err, + }) + } + if err := func() error { + if value, ok := s.ProcessDate.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 0, + MinLengthSet: false, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: regexMap["^(\\d{4})/(\\d{2})/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})[^\r\n\u2028\u2029](\\d{3})$"], + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "process_date", + Error: err, + }) + } + if err := func() error { + if value, ok := s.JobCode.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "job_code", + Error: err, + }) + } + if err := func() error { + if value, ok := s.Expire.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 0, + MinLengthSet: false, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: regexMap["^(\\d{4})$"], + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "expire", + Error: err, + }) + } + if err := func() error { + if value, ok := s.Method.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "method", + Error: err, + }) + } + if err := func() error { + if value, ok := s.TdsType.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "tds_type", + Error: err, + }) + } + if err := func() error { + if value, ok := s.Tds2Type.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "tds2_type", + Error: err, + }) + } + if err := func() error { + if value, ok := s.Tds2Status.Get(); ok { + if err := func() error { + if err := value.Validate(); err != nil { + return err + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "tds2_status", + Error: err, + }) + } + if err := func() error { + if value, ok := s.Created.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 0, + MinLengthSet: false, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: regexMap["^(\\d{4})/(\\d{2})/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})[^\r\n\u2028\u2029](\\d{3})$"], + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "created", + Error: err, + }) + } + if err := func() error { + if value, ok := s.Updated.Get(); ok { + if err := func() error { + if err := (validate.String{ + MinLength: 0, + MinLengthSet: false, + MaxLength: 0, + MaxLengthSet: false, + Email: false, + Hostname: false, + Regex: regexMap["^(\\d{4})/(\\d{2})/(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})[^\r\n\u2028\u2029](\\d{3})$"], + }).Validate(string(value)); err != nil { + return errors.Wrap(err, "string") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + failures = append(failures, validate.FieldError{ + Name: "updated", + Error: err, + }) + } + if len(failures) > 0 { + return &validate.Error{Fields: failures} + } + return nil +} + +func (s PaymentAuthCardResponseJobCode) Validate() error { + switch s { + case "CHECK": + return nil + case "AUTH": + return nil + case "CAPTURE": + return nil + case "SALES": + return nil + case "CANCEL": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s PaymentAuthCardResponseMethod) Validate() error { + switch s { + case "1": + return nil + case "2": + return nil + case "5": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s PaymentAuthCardResponsePayType) Validate() error { + switch s { + case "Card": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s PaymentAuthCardResponseStatus) Validate() error { + switch s { + case "UNPROCESSED": + return nil + case "CHECKED": + return nil + case "AUTHORIZED": + return nil + case "CAPTURED": + return nil + case "CANCELED": + return nil + case "AUTHENTICATED": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s PaymentAuthCardResponseTds2Status) Validate() error { + switch s { + case "AUTHENTICATING": + return nil + case "CHALLENGE": + return nil + case "AUTHENTICATED": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s PaymentAuthCardResponseTds2Type) Validate() error { + switch s { + case "2": + return nil + case "3": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + +func (s PaymentAuthCardResponseTdsType) Validate() error { + switch s { + case "0": + return nil + case "2": + return nil + default: + return errors.Errorf("invalid value: %v", s) + } +} + func (s *PaymentCancelCard) Validate() error { if s == nil { return validate.ErrNilPointer @@ -3477,6 +3911,30 @@ func (s PaymentMethodDirectDebitResponseStatus) Validate() error { } } +func (s PaymentsIDAuthPutOK) Validate() error { + switch s.Type { + case PaymentAuthCardResponsePaymentsIDAuthPutOK: + if err := s.PaymentAuthCardResponse.Validate(); err != nil { + return err + } + return nil + default: + return errors.Errorf("invalid type %q", s.Type) + } +} + +func (s PaymentsIDAuthPutReq) Validate() error { + switch s.Type { + case PaymentAuthCardPaymentsIDAuthPutReq: + if err := s.PaymentAuthCard.Validate(); err != nil { + return err + } + return nil + default: + return errors.Errorf("invalid type %q", s.Type) + } +} + func (s PaymentsIDCancelPutOK) Validate() error { switch s.Type { case PaymentCancelCardResponsePaymentsIDCancelPutOK: diff --git a/spec/openapi3.yml b/spec/openapi3.yml index fbf705d..3a2f2fa 100644 --- a/spec/openapi3.yml +++ b/spec/openapi3.yml @@ -394,6 +394,35 @@ paths: application/json: schema: $ref: '#/components/schemas/ErrorResponse' + /payments/{id}/auth: + put: + parameters: + - name: id + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/paymentAuthCard' + responses: + '200': + description: OK + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/paymentAuthCardResponse' + '400': + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' /customers: post: requestBody: @@ -2215,6 +2244,178 @@ components: type: string nullable: true pattern: '^(\d{4})/(\d{2})/(\d{2}) (\d{2}):(\d{2}):(\d{2}).(\d{3})$' + paymentAuthCard: + type: object + required: + - pay_type + - access_id + - method + properties: + pay_type: + type: string + enum: + - Card + access_id: + type: string + method: + type: string + enum: + - '1' + - '2' + - '5' + pay_times: + type: string + enum: + - '3' + - '5' + - '6' + - '10' + - '12' + - '15' + - '18' + - '20' + - '24' + paymentAuthCardResponse: + type: object + properties: + shop_id: + type: string + id: + type: string + pay_type: + type: string + enum: + - Card + status: + type: string + enum: + - UNPROCESSED + - CHECKED + - AUTHORIZED + - CAPTURED + - CANCELED + - AUTHENTICATED + access_id: + type: string + process_date: + type: string + pattern: '^(\d{4})/(\d{2})/(\d{2}) (\d{2}):(\d{2}):(\d{2}).(\d{3})$' + job_code: + type: string + enum: + - CHECK + - AUTH + - CAPTURE + - SALES + - CANCEL + item_code: + type: string + amount: + type: integer + tax: + type: integer + total_amount: + type: integer + customer_group_id: + type: string + nullable: true + customer_id: + type: string + nullable: true + card_no: + type: string + nullable: true + card_id: + type: string + nullable: true + expire: + type: string + pattern: '^(\d{4})$' + nullable: true + holder_name: + type: string + nullable: true + card_no_hash: + type: string + nullable: true + method: + type: string + nullable: true + enum: + - '1' + - '2' + - '5' + pay_times: + type: string + nullable: true + forward: + type: string + nullable: true + issuer: + type: string + nullable: true + transaction_id: + type: string + nullable: true + approve: + type: string + nullable: true + auth_max_date: + type: string + nullable: true + client_field_1: + type: string + nullable: true + client_field_2: + type: string + nullable: true + client_field_3: + type: string + nullable: true + tds_type: + type: string + nullable: true + enum: + - '0' + - '2' + tds2_type: + type: string + nullable: true + enum: + - '2' + - '3' + tds2_ret_url: + type: string + nullable: true + tds2_status: + type: string + nullable: true + enum: + - AUTHENTICATING + - CHALLENGE + - AUTHENTICATED + merchant_name: + type: string + nullable: true + send_url: + type: string + nullable: true + subscription_id: + type: string + nullable: true + brand: + type: string + error_code: + type: string + nullable: true + created: + type: string + nullable: true + pattern: '^(\d{4})/(\d{2})/(\d{2}) (\d{2}):(\d{2}):(\d{2}).(\d{3})$' + updated: + type: string + nullable: true + pattern: '^(\d{4})/(\d{2})/(\d{2}) (\d{2}):(\d{2}):(\d{2}).(\d{3})$' securitySchemes: BearerAuth: type: http