-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bank-account-tracking-api
- Loading branch information
Showing
18 changed files
with
1,100 additions
and
560 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
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,85 @@ | ||
package adapter | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
) | ||
|
||
type Masterpass struct { | ||
Client *Client | ||
} | ||
|
||
func (api *Masterpass) CheckMasterpassUser(ctx context.Context, request CheckMasterpassUserRequest) (*CheckMasterpassUserResponse, error) { | ||
newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "payment/v1/masterpass-payments/check-user", request) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
response := &Response[CheckMasterpassUserResponse]{} | ||
err = api.Client.Do(ctx, newRequest, response) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return response.Data, nil | ||
} | ||
|
||
func (api *Masterpass) GenerateMasterpassPaymentToken(ctx context.Context, request MasterpassPaymentTokenGenerateRequest) (*MasterpassPaymentTokenGenerateResponse, error) { | ||
newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "payment/v2/masterpass-payments/generate-token", request) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
response := &Response[MasterpassPaymentTokenGenerateResponse]{} | ||
err = api.Client.Do(ctx, newRequest, response) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return response.Data, nil | ||
} | ||
|
||
func (api *Masterpass) CompleteMasterpassPayment(ctx context.Context, request MasterpassPaymentCompleteRequest) (*PaymentResponse, error) { | ||
newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "payment/v2/masterpass-payments/complete", request) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
response := &Response[PaymentResponse]{} | ||
err = api.Client.Do(ctx, newRequest, response) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return response.Data, nil | ||
} | ||
|
||
func (api *Masterpass) Init3DSMasterpassPayment(ctx context.Context, request MasterpassPaymentThreeDSInitRequest) (*MasterpassPaymentThreeDSInitResponse, error) { | ||
newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "payment/v2/masterpass-payments/3ds-init", request) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
response := &Response[MasterpassPaymentThreeDSInitResponse]{} | ||
err = api.Client.Do(ctx, newRequest, response) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return response.Data, nil | ||
} | ||
|
||
func (api *Masterpass) Complete3DSMasterpassPayment(ctx context.Context, request MasterpassPaymentThreeDSCompleteRequest) (*PaymentResponse, error) { | ||
newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "payment/v2/masterpass-payments/3ds-complete", request) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
response := &Response[PaymentResponse]{} | ||
err = api.Client.Do(ctx, newRequest, response) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return response.Data, nil | ||
} |
Oops, something went wrong.