-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eko Aprianto
committed
Dec 14, 2019
1 parent
149bb56
commit 457aa34
Showing
11 changed files
with
428 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# ddd-go | ||
# DDD go | ||
Domain Driven Design written in Go | ||
|
||
|
||
# How to run | ||
1. copy file at presentation/config/config.json.sample and rename to rename to config.json | ||
2. move to presentation directory | ||
3. run command `go run main.go` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,52 @@ | ||
package domain | ||
|
||
import "strings" | ||
|
||
type SetPaymentRequest struct { | ||
Payment Payment `json:"payment"` | ||
FFInfo FFInfo `json:"FFInfo"` | ||
} | ||
type SetPaymentResponse struct { | ||
BaseResponse | ||
Data SetPaymentData `json:"data" xml:"data"` | ||
} | ||
type Payment struct { | ||
PaymentMethod string `json:"paymentMethod"` | ||
PaymentCardName string `json:"paymentCardName"` | ||
PaymentTenor string `json:"paymentTenor"` | ||
PaymentEmail string `json:"paymentEmail"` | ||
PaymentContact PaymentContact `json:"paymentContact"` | ||
} | ||
type PaymentContact struct { | ||
Email string `json:"email"` | ||
Phone string `json:"phone"` | ||
} | ||
type FFInfo struct { | ||
FFType string `json:"FFType"` | ||
FFNumber string `json:"FFNumber"` | ||
FFPassword string `json:"FFPassword"` | ||
FFPoint string `json:"FFPoint"` | ||
} | ||
|
||
func (data SetPaymentRequest) Validate() (bool, ErrorResponse) { | ||
valid := true | ||
var message string | ||
var messages []ErrorMessage | ||
if (len(strings.TrimSpace(data.Payment.PaymentMethod)) == 0) { | ||
valid = false | ||
messages = append(messages, ErrorMessage{"", "paymentMethod is required!"}) | ||
message = "Some field are required" | ||
} | ||
response := ErrorResponse{BaseResponse{false, "", message}, messages} | ||
return valid, response | ||
} | ||
|
||
type SetPaymentData struct { | ||
PaymentCode string `json:"paymentCode"` | ||
PaymentMethod string `json:"paymentMethod"` | ||
PaymentMethodDescription string `json:"paymentMethodDescription"` | ||
PaymentAmount float64 `json:"paymentAmount"` | ||
FFDetail string `json:"FFDetail"` | ||
SpecialRequest string `json:"specialRequest"` | ||
BNIWOW string `json:"BNIWOW"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.