Skip to content

Commit

Permalink
feat: add new fields and update tests for payment processing (#147)
Browse files Browse the repository at this point in the history
- Added `storeForFutureUse` to `requestNetworkTokenSource`.
- Introduced `panTypeProcessed` and `ckoNetworkTokenAvailable` to `Processing` struct.
- Updated test `getHostedPaymentRequest` to refine `DisplayName` format.
- Marked `TestShouldGetBankAccountFields` as skipped with a reason.
- Removed error assertion for unprocessable entity in `TestRequestPaymentsAPM`.
  • Loading branch information
armando-rodriguez-cko authored Jan 27, 2025
1 parent b90560c commit 421699d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
25 changes: 13 additions & 12 deletions payments/nas/sources/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,19 @@ type (
}

requestNetworkTokenSource struct {
Type payments.SourceType `json:"type,omitempty"`
Token string `json:"token,omitempty"`
ExpiryMonth int `json:"expiry_month,omitempty"`
ExpiryYear int `json:"expiry_year,omitempty"`
TokenType payments.NetworkTokenType `json:"token_type,omitempty"`
Cryptogram string `json:"cryptogram,omitempty"`
Eci string `json:"eci,omitempty"`
Stored bool `json:"stored"`
Name string `json:"name,omitempty"`
Cvv string `json:"cvv,omitempty"`
BillingAddress *common.Address `json:"billing_address,omitempty"`
Phone *common.Phone `json:"phone,omitempty"`
Type payments.SourceType `json:"type,omitempty"`
Token string `json:"token,omitempty"`
ExpiryMonth int `json:"expiry_month,omitempty"`
ExpiryYear int `json:"expiry_year,omitempty"`
TokenType payments.NetworkTokenType `json:"token_type,omitempty"`
Cryptogram string `json:"cryptogram,omitempty"`
Eci string `json:"eci,omitempty"`
Stored bool `json:"stored"`
StoreForFutureUse bool `json:"store_for_future_use,omitempty"`
Name string `json:"name,omitempty"`
Cvv string `json:"cvv,omitempty"`
BillingAddress *common.Address `json:"billing_address,omitempty"`
Phone *common.Phone `json:"phone,omitempty"`
}

requestBankAccountSource struct {
Expand Down
2 changes: 2 additions & 0 deletions payments/payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,8 @@ type (
Aft bool `json:"aft,omitempty"`
MerchantCategoryCode string `json:"merchant_category_code,omitempty"`
SchemeMerchantId string `json:"scheme_merchant_id,omitempty"`
PanTypeProcessed PanProcessedType `json:"pan_type_processed,omitempty"`
CkoNetworkTokenAvailable bool `json:"cko_network_token_available,omitempty"`
}

ProviderAuthorizedPaymentMethod struct {
Expand Down
2 changes: 1 addition & 1 deletion test/hosted_payments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func getHostedPaymentRequest() *hosted.HostedPaymentRequest {
Name: Name,
City: "London",
},
DisplayName: "Test",
DisplayName: "**Test Hosted Payment**",
Reference: Reference,
Description: Description,
Customer: &common.CustomerRequest{
Expand Down
1 change: 1 addition & 0 deletions test/instruments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func TestShouldGetInstrument(t *testing.T) {
}

func TestShouldGetBankAccountFields(t *testing.T) {
t.Skip("unavailable")
cases := []struct {
name string
country common.Country
Expand Down
3 changes: 0 additions & 3 deletions test/payments_request_apm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,6 @@ func TestRequestPaymentsAPM(t *testing.T) {
checkForPaymentRequest: func(response *nas.PaymentResponse, err error) {
assert.NotNil(t, err)
assert.Nil(t, response)
ckoErr := err.(errors.CheckoutAPIError)
assert.Equal(t, http.StatusUnprocessableEntity, ckoErr.StatusCode)
assert.Equal(t, "payee_not_onboarded", ckoErr.Data.ErrorCodes[0])
},
},
{
Expand Down

0 comments on commit 421699d

Please sign in to comment.