diff --git a/adapter/model.go b/adapter/model.go index 93c28d8..dc18ccc 100644 --- a/adapter/model.go +++ b/adapter/model.go @@ -7,6 +7,7 @@ type ApmType string type PaymentProvider string type PosApmPaymentProvider string type PaymentStatus string +type TokenizedCardType string type PaymentSource string type PaymentGroup string type PaymentPhase string @@ -558,6 +559,11 @@ const ( ClientType_M ClientType = "M" ) +// tokenized card type declaration +const ( + TokenizedCardType_APPLE_PAY TokenizedCardType = "APPLE_PAY" +) + // requests type CreatePaymentRequest struct { Price float64 `json:"price,omitempty"` @@ -825,6 +831,14 @@ type StoreCardRequest struct { CardUserKey string `json:"cardUserKey,omitempty"` } +type ApplePayMerchantSessionCreateRequest struct { + MerchantIdentifier string `json:"merchantIdentifier,omitempty"` + DisplayName string `json:"displayName,omitempty"` + Initiative string `json:"initiative,omitempty"` + InitiativeContext string `json:"initiativeContext,omitempty"` + ValidationUrl string `json:"validationUrl,omitempty"` +} + type CheckMasterpassUserRequest struct { MasterpassGsmNumber string `json:"masterpassGsmNumber"` } @@ -1921,20 +1935,26 @@ type Loyalty struct { Message *string `json:"message,omitempty"` } +type TokenizedCard struct { + TokenizedCardType TokenizedCardType `json:"type,omitempty"` + Data map[string]interface{} `json:"data,omitempty"` +} + type Card struct { - CardHolderName string `json:"cardHolderName,omitempty"` - CardNumber string `json:"cardNumber,omitempty"` - ExpireYear string `json:"expireYear,omitempty"` - ExpireMonth string `json:"expireMonth,omitempty"` - Cvc string `json:"cvc,omitempty"` - CardAlias string `json:"cardAlias,omitempty"` - CardUserKey string `json:"cardUserKey,omitempty"` - CardToken string `json:"cardToken,omitempty"` - BinNumber string `json:"binNumber,omitempty"` - LastFourDigits string `json:"lastFourDigits,omitempty"` - CardHolderIdentityNumber string `json:"cardHolderIdentityNumber,omitempty"` - Loyalty *Loyalty `json:"loyalty,omitempty"` - StoreCardAfterSuccessPayment bool `json:"storeCardAfterSuccessPayment,omitempty"` + CardHolderName string `json:"cardHolderName,omitempty"` + CardNumber string `json:"cardNumber,omitempty"` + ExpireYear string `json:"expireYear,omitempty"` + ExpireMonth string `json:"expireMonth,omitempty"` + Cvc string `json:"cvc,omitempty"` + CardAlias string `json:"cardAlias,omitempty"` + CardUserKey string `json:"cardUserKey,omitempty"` + CardToken string `json:"cardToken,omitempty"` + BinNumber string `json:"binNumber,omitempty"` + LastFourDigits string `json:"lastFourDigits,omitempty"` + CardHolderIdentityNumber string `json:"cardHolderIdentityNumber,omitempty"` + Loyalty *Loyalty `json:"loyalty,omitempty"` + StoreCardAfterSuccessPayment bool `json:"storeCardAfterSuccessPayment,omitempty"` + TokenizedCard *TokenizedCard `json:"tokenizedCard,omitempty"` } type FraudCheckParameters struct { diff --git a/adapter/payment.go b/adapter/payment.go index c2204bd..8040c97 100644 --- a/adapter/payment.go +++ b/adapter/payment.go @@ -567,6 +567,21 @@ func (api *Payment) RetrieveActiveBanks(ctx context.Context) (*InstantTransferBa return response.Data, nil } +func (api *Payment) CreateApplePayMerchantSession(ctx context.Context, request ApplePayMerchantSessionCreateRequest) (*interface{}, error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "/payment/v1/apple-pay/merchant-sessions", request) + if err != nil { + return nil, err + } + + response := &Response[interface{}]{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return nil, err + } + + return response.Data, nil +} + func (c *Payment) Is3DSecureCallbackVerified(threeDSecureCallbackKey string, params map[string]string) bool { hash := params["hash"] hashString := strings.Join([]string{threeDSecureCallbackKey,