-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Payment Components. Klarna Payment Context Support (#110)
* Update Payment Components * Add Klarna Payment Context Support
- Loading branch information
1 parent
ed5b46b
commit 4971109
Showing
7 changed files
with
192 additions
and
39 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 |
---|---|---|
@@ -1,17 +1,33 @@ | ||
package contexts | ||
|
||
import "github.com/checkout/checkout-sdk-go/payments" | ||
import ( | ||
"github.com/checkout/checkout-sdk-go/common" | ||
"github.com/checkout/checkout-sdk-go/payments" | ||
) | ||
|
||
type ( | ||
requestPaymentContextsPaypalSource struct { | ||
requestPaymentContextsKlarnaSource struct { | ||
Type payments.SourceType `json:"type,omitempty"` | ||
AccountHolder *common.AccountHolder `json:"account_holder,omitempty"` | ||
} | ||
|
||
requestPaymentContextsPayPalSource struct { | ||
Type payments.SourceType `json:"type,omitempty"` | ||
} | ||
) | ||
|
||
func NewPaymentContextsPaypalSource() *requestPaymentContextsPaypalSource { | ||
return &requestPaymentContextsPaypalSource{Type: payments.PayPalSource} | ||
func NewPaymentContextsKlarnaSource() *requestPaymentContextsKlarnaSource { | ||
return &requestPaymentContextsKlarnaSource{Type: payments.KlarnaSource} | ||
} | ||
|
||
func NewPaymentContextsPayPalSource() *requestPaymentContextsPayPalSource { | ||
return &requestPaymentContextsPayPalSource{Type: payments.PayPalSource} | ||
} | ||
|
||
func (s *requestPaymentContextsKlarnaSource) GetType() payments.SourceType { | ||
return s.Type | ||
} | ||
|
||
func (s *requestPaymentContextsPaypalSource) GetType() payments.SourceType { | ||
func (s *requestPaymentContextsPayPalSource) GetType() payments.SourceType { | ||
return s.Type | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
package test | ||
|
||
import ( | ||
"github.com/checkout/checkout-sdk-go/payments/sessions" | ||
"github.com/checkout/checkout-sdk-go/payments" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
"github.com/checkout/checkout-sdk-go/common" | ||
"github.com/checkout/checkout-sdk-go/payments/sessions" | ||
) | ||
|
||
var ( | ||
paymentSessionsRequest = payment_sessions.PaymentSessionsRequest{ | ||
Amount: int64(2000), | ||
Currency: common.GBP, | ||
Reference: "ORD-123A", | ||
Billing: &payment_sessions.Billing{Address: Address()}, | ||
Customer: &common.CustomerRequest{ | ||
Email: "[email protected]", | ||
Name: "John Smith", | ||
}, | ||
Amount: int64(2000), | ||
Currency: common.GBP, | ||
Reference: "ORD-123A", | ||
Billing: &payments.BillingInformation{Address: Address()}, | ||
SuccessUrl: "https://example.com/payments/success", | ||
FailureUrl: "https://example.com/payments/fail", | ||
} | ||
|