-
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.
Merge pull request #3 from TibebeJS/develop
:WIP: Develop
- Loading branch information
Showing
6 changed files
with
157 additions
and
32 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Contributing | ||
|
||
When contributing to this repository, please first discuss the change you wish to make via issue, | ||
email, or any other method with the owners of this repository before making a change or assign yourself to a card on the [Project's board](https://github.com/TibebeJS/yenepay.sdk.go/projects/1) | ||
|
||
We'd love to accept your patches and contributions to this project. | ||
|
||
## Pull Request Process | ||
|
||
1. Ensure any install or build dependencies are removed before the end of the layer when doing a | ||
build. | ||
2. Update the README.md with details of changes to the interface, this includes new environment | ||
variables, exposed ports, useful file locations and container parameters. | ||
3. Increase the version numbers in any examples files and the README.md to the new version that this | ||
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/). | ||
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you | ||
do not have permission to do that, you may request the second reviewer to merge it for you. | ||
|
||
|
||
## Tasks # | ||
|
||
You can find the project's Canban board (Todo, Tasks in Progress, etc..) here:\ | ||
[Project Board](https://github.com/TibebeJS/yenepay.sdk.go/projects/1) | ||
|
||
## Code reviews | ||
|
||
All submissions, including submissions by project members, require review. We | ||
use GitHub pull requests for this purpose. Consult | ||
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more | ||
information on using pull requests. | ||
|
||
## Testing ## | ||
Before sending a pull-request, please make sure your code is well-tested and linted locally. | ||
To run the tests, use the following command: | ||
``` | ||
$ go test -v ./... | ||
``` | ||
|
||
Alternatively, you may use [`goconvey`](https://github.com/smartystreets/goconvey) (Recommended) | ||
|
||
To install [`goconvey`](https://github.com/smartystreets/goconvey), run: | ||
``` | ||
$ go get github.com/smartystreets/goconvey | ||
``` | ||
|
||
After installation, use the following to execute the tests: | ||
``` | ||
$ goconvey | ||
``` | ||
|
||
There are also GitHub Actions/Workflows on the repo to assist with these, make sure your changes do pass these workflows. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package checkout | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
) | ||
|
||
func TestNewYenePayCheckOut(t *testing.T) { | ||
checkout := NewYenePayCheckOut() | ||
|
||
expected := &YenePayCheckOut{ | ||
"https://www.yenepay.com/checkout/Home/Process/", | ||
"https://test.yenepay.com/Home/Process/", | ||
"https://endpoints.yenepay.com/api/verify/ipn/", | ||
"https://testapi.yenepay.com/api/verify/ipn/", | ||
"https://endpoints.yenepay.com/api/verify/pdt/", | ||
"https://testapi.yenepay.com/api/verify/pdt/", | ||
} | ||
|
||
if !cmp.Equal(checkout, expected) { | ||
t.Error("NewYenePayCheckOut Constructor is not working as expected") | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package checkout | ||
|
||
import "encoding/json" | ||
|
||
type PdtRequestModel struct { | ||
PdtToken string | ||
TransactionId string | ||
MerchantId string | ||
UseSandbox bool | ||
RequestType string | ||
} | ||
|
||
func NewPdtRequestModel( | ||
PdtToken string, | ||
TransactionId string, | ||
MerchantId string, | ||
UseSandbox bool, | ||
) *PdtRequestModel { | ||
return &PdtRequestModel{ | ||
PdtToken, | ||
TransactionId, | ||
MerchantId, | ||
UseSandbox, | ||
"PDT", | ||
} | ||
} | ||
|
||
func (self *PdtRequestModel) ToJSON() ([]byte, error) { | ||
return json.Marshal(struct { | ||
PdtToken string | ||
TransactionId string | ||
MerchantId string | ||
RequestType string | ||
}{ | ||
self.PdtToken, | ||
self.TransactionId, | ||
self.MerchantId, | ||
self.RequestType, | ||
}) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package checkout | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
) | ||
|
||
func TestNewPdtRequestModel(t *testing.T) { | ||
pdt := NewPdtRequestModel( | ||
"test", | ||
"1234", | ||
"2345", | ||
true, | ||
) | ||
|
||
expected := &PdtRequestModel{ | ||
"test", | ||
"1234", | ||
"2345", | ||
true, | ||
"PDT", | ||
} | ||
|
||
if !cmp.Equal(pdt, expected) { | ||
t.Error("NewPdtRequestModel Constructor is not working as expected") | ||
} | ||
} |