-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify struct names and gateways to be compatible with other Adyen libs
- Loading branch information
Showing
7 changed files
with
75 additions
and
61 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
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,15 @@ | ||
package adyen | ||
|
||
// Capture structure for Capture request | ||
type Capture struct { | ||
ModificationAmount *Amount `json:"modificationAmount"` | ||
Reference string `json:"reference"` | ||
MerchantAccount string `json:"merchantAccount"` | ||
OriginalReference string `json:"originalReference"` | ||
} | ||
|
||
// CaptureResponse is a response structure for Adyen capture | ||
type CaptureResponse struct { | ||
PspReference string `json:"pspReference"` | ||
Response string `json:"response"` | ||
} |
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,25 @@ | ||
package adyen | ||
|
||
import "encoding/json" | ||
|
||
// CaptureType - capture type request, @TODO: move to enums | ||
const CaptureType = "capture" | ||
|
||
// ModificationGateway - Adyen modification transaction logic, capture, cancel, refunds and e.t.c | ||
type ModificationGateway struct { | ||
*Adyen | ||
} | ||
|
||
// Capture - Perform capture payment in Adyen | ||
func (a *ModificationGateway) Capture(req *Capture) (*CaptureResponse, error) { | ||
resp, err := a.execute(CaptureType, req) | ||
|
||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var val CaptureResponse | ||
json.NewDecoder(resp.Body).Decode(&val) | ||
|
||
return &val, nil | ||
} |
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,25 @@ | ||
package adyen | ||
|
||
import "encoding/json" | ||
|
||
// PaymentGateway - Adyen payment transaction logic | ||
type PaymentGateway struct { | ||
*Adyen | ||
} | ||
|
||
// AuthoriseType - authorise type request, @TODO: move to enums | ||
const AuthoriseType = "authorise" | ||
|
||
// Authorise - Perform authorise payment in Adyen | ||
func (a *PaymentGateway) Authorise(req *Authorise) (*AuthoriseResponse, error) { | ||
resp, err := a.execute(AuthoriseType, req) | ||
|
||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var val AuthoriseResponse | ||
json.NewDecoder(resp.Body).Decode(&val) | ||
|
||
return &val, nil | ||
} |
This file was deleted.
Oops, something went wrong.