diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 9d05c36..1f37b8e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -7,20 +7,18 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - - name: Set up Go 1.19 - uses: actions/setup-go@v3 + - name: Set up Go + uses: actions/setup-go@v5 with: - go-version-file: go.mod + go-version: '1.21.0' cache: true cache-dependency-path: go.sum - name: Check out code into the Go module directory - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Go Lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 - name: Get dependencies run: | diff --git a/README.md b/README.md index 34a1708..d4e8fa2 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,24 @@ client, _ := craftgate.New("", "", "https://api.c request := craftgate.SearchInstallmentsRequest{ BinNumber: "487074", Price: 100, - Currency: craftgate.TRY, + Currency: craftgate.Currency_TRY, +} + +res, err := client.Installment.SearchInstallments(context.Background(), request) + +if err != nil { + t.Errorf("Error %s", err) +} +``` + +Also, you can pass the options to make localization for API responses. You can use `tr` or `en` right now. +```go +client, _ := craftgate.New("", "", "https://api.craftgate.io", craftgate.WithLocalization("en")) + +request := craftgate.SearchInstallmentsRequest{ + BinNumber: "487074", + Price: 100, + Currency: craftgate.Currency_TRY, } res, err := client.Installment.SearchInstallments(context.Background(), request) @@ -61,7 +78,7 @@ client, _ := craftgate.New("", "", "https://sandb request := craftgate.CreatePaymentRequest{ Price: 100, PaidPrice: 100, - Currency: craftgate.TRY, + Currency: craftgate.Currency_TRY, ... } diff --git a/adapter/bank_account_tracking.go b/adapter/bank_account_tracking.go new file mode 100644 index 0000000..7b8bb64 --- /dev/null +++ b/adapter/bank_account_tracking.go @@ -0,0 +1,41 @@ +package adapter + +import ( + "context" + "fmt" + "net/http" +) + +type BankAccountTracking struct { + Client *Client +} + +func (api *BankAccountTracking) SearchRecords(ctx context.Context, request SearchBankAccountTrackingRecordRequest) (*DataResponse[BankAccountTrackingRecordResponse], error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodGet, "/bank-account-tracking/v1/merchant-bank-account-trackings/records", request) + if err != nil { + return nil, err + } + response := &Response[DataResponse[BankAccountTrackingRecordResponse]]{} + err = api.Client.Do(ctx, newRequest, response) + + if err != nil { + return nil, err + } + + return response.Data, nil +} + +func (api *BankAccountTracking) RetrieveRecords(ctx context.Context, id int64) (*BankAccountTrackingRecordResponse, error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodGet, fmt.Sprintf("/bank-account-tracking/v1/merchant-bank-account-trackings/records/%d", id), nil) + if err != nil { + return nil, err + } + response := &Response[BankAccountTrackingRecordResponse]{} + err = api.Client.Do(ctx, newRequest, response) + + if err != nil { + return nil, err + } + + return response.Data, nil +} diff --git a/adapter/craftgate.go b/adapter/craftgate.go index 0bc0841..b181a4a 100644 --- a/adapter/craftgate.go +++ b/adapter/craftgate.go @@ -65,6 +65,28 @@ func init() { type ClientOption func(*Client) error +func WithLocalization(lang string) ClientOption { + return func(client *Client) error { + if len(lang) > 0 { + client.headers["lang"] = strings.ToLower(lang) + } else { + client.headers["lang"] = "tr" + } + return nil + } +} + +func WithCustomHTTPClient(httpClient *http.Client) ClientOption { + return func(client *Client) error { + if httpClient != nil { + client.httpClient = httpClient + } else { + client.httpClient = http.DefaultClient + } + return nil + } +} + type Client struct { httpClient *http.Client baseURL *url.URL @@ -84,10 +106,15 @@ type Client struct { Fraud *Fraud Hook *Hook Masterpass *Masterpass + BankAccountTracking *BankAccountTracking + Merchant *Merchant + Juzdan *Juzdan } func New(apiKey, apiSecret, baseURL string, opts ...ClientOption) (*Client, error) { client := newClient(apiKey, apiSecret) + client.headers = make(map[string]string) + for _, option := range opts { if err := option(client); err != nil { return nil, err @@ -100,7 +127,7 @@ func New(apiKey, apiSecret, baseURL string, opts ...ClientOption) (*Client, erro if client.baseURL == nil { client.baseURL, _ = url.Parse(baseURL) } - client.headers = make(map[string]string) + return client, nil } @@ -109,8 +136,8 @@ func newClient(apiKey, secretKey string) *Client { client.Installment = &Installment{Client: client} client.Payment = &Payment{Client: client} - client.Onboarding = &Onboarding{Client: client} client.PaymentReporting = &PaymentReporting{Client: client} + client.Onboarding = &Onboarding{Client: client} client.PayByLink = &PayByLink{Client: client} client.Wallet = &Wallet{Client: client} client.Settlement = &Settlement{Client: client} @@ -119,6 +146,8 @@ func newClient(apiKey, secretKey string) *Client { client.Fraud = &Fraud{Client: client} client.Hook = &Hook{Client: client} client.Masterpass = &Masterpass{Client: client} + client.BankAccountTracking = &BankAccountTracking{Client: client} + client.Merchant = &Merchant{Client: client} return client } diff --git a/adapter/fraud.go b/adapter/fraud.go index 7a3efc9..28bfce6 100644 --- a/adapter/fraud.go +++ b/adapter/fraud.go @@ -54,9 +54,10 @@ func (api *Fraud) RetrieveFraudValueList(ctx context.Context, listName string) ( return response.Data, nil } -func (api *Fraud) CreateFraudValueList(ctx context.Context, listName string) error { +func (api *Fraud) CreateFraudValueList(ctx context.Context, listName string, fraudValueType FraudValueType) error { request := FraudValueListRequest{ ListName: listName, + Type: fraudValueType, } newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "/fraud/v1/value-lists", request) @@ -103,8 +104,8 @@ func (api *Fraud) AddValueToFraudValueList(ctx context.Context, request FraudVal return nil } -func (api *Fraud) RemoveValueFromFraudValueList(ctx context.Context, listName, value string) error { - newRequest, err := api.Client.NewRequest(ctx, http.MethodDelete, "/fraud/v1/value-lists/"+listName+"/values/"+value, nil) +func (api *Fraud) RemoveValueFromFraudValueList(ctx context.Context, listName, valueId string) error { + newRequest, err := api.Client.NewRequest(ctx, http.MethodDelete, "/fraud/v1/value-lists/"+listName+"/values/"+valueId, nil) if err != nil { return err } diff --git a/adapter/juzdan.go b/adapter/juzdan.go new file mode 100644 index 0000000..dc4c178 --- /dev/null +++ b/adapter/juzdan.go @@ -0,0 +1,41 @@ +package adapter + +import ( + "context" + "fmt" + "net/http" +) + +type Juzdan struct { + Client *Client +} + +func (api *Juzdan) InitJuzdanPayment(ctx context.Context, request InitJuzdanPaymentRequest) (*InitJuzdanPaymentResponse, error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "/payment/v1/juzdan-payments/init", request) + if err != nil { + return nil, err + } + + response := &Response[InitJuzdanPaymentResponse]{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return nil, err + } + + return response.Data, nil +} + +func (api *Juzdan) RetrieveJuzdanPayment(ctx context.Context, referenceId string) (*PaymentResponse, error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodGet, fmt.Sprintf("/payment/v1/juzdan-payments/%s", referenceId), nil) + + 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 +} diff --git a/adapter/merchant.go b/adapter/merchant.go new file mode 100644 index 0000000..39b09d1 --- /dev/null +++ b/adapter/merchant.go @@ -0,0 +1,116 @@ +package adapter + +import ( + "context" + "fmt" + "net/http" +) + +type Merchant struct { + Client *Client +} + +func (api *Merchant) CreateMerchantPos(ctx context.Context, request CreateMerchantPosRequest) (*MerchantPosResponse, error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "/merchant/v1/merchant-poses", request) + + if err != nil { + return nil, err + } + + response := &Response[MerchantPosResponse]{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return nil, err + } + return response.Data, nil +} + +func (api *Merchant) RetrieveMerchantPos(ctx context.Context, id int64) (*MerchantPosResponse, error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodGet, fmt.Sprintf("/merchant/v1/merchant-poses/%d", id), nil) + + if err != nil { + return nil, err + } + + response := &Response[MerchantPosResponse]{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return nil, err + } + return response.Data, nil +} + +func (api *Merchant) SearchMerchantPos(ctx context.Context, request SearchMerchantPosRequest) (*DataResponse[MerchantPosResponse], error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodGet, "/merchant/v1/merchant-poses", request) + + if err != nil { + return nil, err + } + + response := &Response[DataResponse[MerchantPosResponse]]{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return nil, err + } + return response.Data, nil +} + +func (api *Merchant) UpdateMerchantPosStatus(ctx context.Context, id int64, status PosStatus) error { + newRequest, err := api.Client.NewRequest(ctx, http.MethodPut, fmt.Sprintf("/merchant/v1/merchant-poses/%d/status/%s", id, status), nil) + + if err != nil { + return err + } + + response := &Void{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return err + } + return nil +} + +func (api *Merchant) DeleteMerchantPosStatus(ctx context.Context, id int64) error { + newRequest, err := api.Client.NewRequest(ctx, http.MethodDelete, fmt.Sprintf("/merchant/v1/merchant-poses/%d", id), nil) + + if err != nil { + return err + } + + response := &Void{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return err + } + return nil +} + +func (api *Merchant) RetrieveMerchantPosCommissions(ctx context.Context, id int64) (*DataResponse[MerchantPosCommissionResponse], error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodGet, fmt.Sprintf("/merchant/v1/merchant-poses/%d/commissions", id), nil) + + if err != nil { + return nil, err + } + + response := &Response[DataResponse[MerchantPosCommissionResponse]]{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return nil, err + } + return response.Data, nil +} + +func (api *Merchant) UpdateMerchantPosCommissions(ctx context.Context, id int64, request CreateMerchantPosCommissionRequest) (*DataResponse[MerchantPosCommissionResponse], error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, fmt.Sprintf("/merchant/v1/merchant-poses/%d/commissions", id), request) + + if err != nil { + return nil, err + } + + response := &Response[DataResponse[MerchantPosCommissionResponse]]{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return nil, err + } + return response.Data, nil +} diff --git a/adapter/model.go b/adapter/model.go index e2e0d48..dc18ccc 100644 --- a/adapter/model.go +++ b/adapter/model.go @@ -5,6 +5,7 @@ import "time" type PaymentType string type ApmType string type PaymentProvider string +type PosApmPaymentProvider string type PaymentStatus string type TokenizedCardType string type PaymentSource string @@ -21,6 +22,7 @@ type RefundStatus string type RefundType string type ApprovalStatus string type Status string +type OnboardingStatus string type MemberType string type SettlementType string type SettlementEarningsDestination string @@ -30,14 +32,26 @@ type TransactionPayoutStatus string type WalletTransactionRefundTransactionType string type FraudAction string type FraudCheckStatus string +type FraudValueType string +type AdditionalAction string type ApmAdditionalAction string type ReportFileType string type WalletTransactionType string type WebhookEventType string type WebhookStatus string +type PosStatus string +type PosIntegrator string +type PosUserType string +type PosOperationType string type FileStatus string type AccountOwner string type PayoutAccountType string +type RecordType string +type BankAccountTrackingSource string +type BnplCartItemType string +type PaymentAuthenticationType string +type CardBrand string +type ClientType string const ( ApiKeyHeaderName = "x-api-key" @@ -51,309 +65,503 @@ const ( // payment type declaration const ( - CARD_PAYMENT PaymentType = "CARD_PAYMENT" - WALLET_PAYMENT PaymentType = "WALLET_PAYMENT" - CARD_AND_WALLET_PAYMENT PaymentType = "CARD_AND_WALLET_PAYMENT" - DEPOSIT_PAYMENT PaymentType = "DEPOSIT_PAYMENT" - APM = "APM" + PaymentType_CARD_PAYMENT PaymentType = "CARD_PAYMENT" + PaymentType_WALLET_PAYMENT PaymentType = "WALLET_PAYMENT" + PaymentType_CARD_AND_WALLET_PAYMENT PaymentType = "CARD_AND_WALLET_PAYMENT" + PaymentType_DEPOSIT_PAYMENT PaymentType = "DEPOSIT_PAYMENT" + PaymentType_BANK_TRANSFER PaymentType = "BANK_TRANSFER" + PaymentType_APM PaymentType = "APM" ) +// apm type declaration const ( - ApmTypePAPARA ApmType = "PAPARA" - ApmTypePAYONEER ApmType = "PAYONEER" - ApmTypeSODEXO ApmType = "SODEXO" - ApmTypeEDENRED ApmType = "EDENRED" - ApmTypeEDENRED_GIFT ApmType = "EDENRED_GIFT" - ApmTypePAYPAL ApmType = "PAYPAL" - ApmTypeKLARNA ApmType = "KLARNA" - ApmTypeAFTERPAY ApmType = "AFTERPAY" - ApmTypeKASPI ApmType = "KASPI" - ApmTypeSTRIPE ApmType = "STRIPE" - ApmTypeFUND_TRANSFER ApmType = "FUND_TRANSFER" - ApmTypeCASH_ON_DELIVERY ApmType = "CASH_ON_DELIVERY" + ApmType_PAPARA ApmType = "PAPARA" + ApmType_PAYONEER ApmType = "PAYONEER" + ApmType_SODEXO ApmType = "SODEXO" + ApmType_EDENRED ApmType = "EDENRED" + ApmType_EDENRED_GIFT ApmType = "EDENRED_GIFT" + ApmType_PAYPAL ApmType = "PAYPAL" + ApmType_KLARNA ApmType = "KLARNA" + ApmType_AFTERPAY ApmType = "AFTERPAY" + ApmType_KASPI ApmType = "KASPI" + ApmType_INSTANT_TRANSFER ApmType = "INSTANT_TRANSFER" + ApmType_TOMPAY ApmType = "TOMPAY" + ApmType_MASLAK ApmType = "MASLAK" + ApmType_ALFABANK ApmType = "ALFABANK" + ApmType_TOM_FINANCE ApmType = "TOM_FINANCE" + ApmType_STRIPE ApmType = "STRIPE" + ApmType_PAYCELL ApmType = "PAYCELL" + ApmType_HASO ApmType = "HASO" + ApmType_FUND_TRANSFER ApmType = "FUND_TRANSFER" + ApmType_CASH_ON_DELIVERY ApmType = "CASH_ON_DELIVERY" ) // payment provider declaration const ( - BANK PaymentProvider = "BANK" - CG_WALLET PaymentProvider = "CG_WALLET" - MASTERPASS PaymentProvider = "MASTERPASS" - GARANTI_PAY PaymentProvider = "GARANTI_PAY" - YKB_WORLD_PAY PaymentProvider = "YKB_WORLD_PAY" - PAPARA PaymentProvider = "PAPARA" - PAYONEER PaymentProvider = "PAYONEER" - SODEXO PaymentProvider = "SODEXO" - EDENRED PaymentProvider = "EDENRED" - ALIPAY PaymentProvider = "ALIPAY" - PAYPAL PaymentProvider = "PAYPAL" - KLARNA PaymentProvider = "KLARNA" - AFTERPAY PaymentProvider = "AFTERPAY" - KASPI PaymentProvider = "KASPI" - APPLEPAY PaymentProvider = "APPLEPAY" - GOOGLEPAY PaymentProvider = "GOOGLEPAY" - HEPSIPAY PaymentProvider = "HEPSIPAY" - STRIPE PaymentProvider = "STRIPE" - OFFLINE PaymentProvider = "OFFLINE" + PaymentProvider_BANK PaymentProvider = "BANK" + PaymentProvider_CG_WALLET PaymentProvider = "CG_WALLET" + PaymentProvider_MASTERPASS PaymentProvider = "MASTERPASS" + PaymentProvider_GARANTI_PAY PaymentProvider = "GARANTI_PAY" + PaymentProvider_YKB_WORLD_PAY PaymentProvider = "YKB_WORLD_PAY" + PaymentProvider_PAPARA PaymentProvider = "PAPARA" + PaymentProvider_PAYONEER PaymentProvider = "PAYONEER" + PaymentProvider_SODEXO PaymentProvider = "SODEXO" + PaymentProvider_EDENRED PaymentProvider = "EDENRED" + PaymentProvider_ALIPAY PaymentProvider = "ALIPAY" + PaymentProvider_PAYPAL PaymentProvider = "PAYPAL" + PaymentProvider_KLARNA PaymentProvider = "KLARNA" + PaymentProvider_AFTERPAY PaymentProvider = "AFTERPAY" + PaymentProvider_APPLEPAY PaymentProvider = "APPLEPAY" + PaymentProvider_GOOGLEPAY PaymentProvider = "GOOGLEPAY" + PaymentProvider_HEPSIPAY PaymentProvider = "HEPSIPAY" + PaymentProvider_STRIPE PaymentProvider = "STRIPE" + PaymentProvider_KASPI PaymentProvider = "KASPI" + PaymentProvider_INSTANT_TRANSFER PaymentProvider = "INSTANT_TRANSFER" + PaymentProvider_MASLAK PaymentProvider = "MASLAK" + PaymentProvider_TOMPAY PaymentProvider = "TOMPAY" + PaymentProvider_TOM_FINANCE PaymentProvider = "TOM_FINANCE" + PaymentProvider_ALFABANK PaymentProvider = "ALFABANK" + PaymentProvider_PAYCELL PaymentProvider = "PAYCELL" + PaymentProvider_HASO PaymentProvider = "HASO" + PaymentProvider_OFFLINE PaymentProvider = "OFFLINE" +) + +// pos apm payment provider declaration +const ( + PosApmPaymentProvider_YKB_WORLD_PAY PosApmPaymentProvider = "YKB_WORLD_PAY" + PosApmPaymentProvider_YKB_WORLD_PAY_SHOPPING_LOAN PosApmPaymentProvider = "YKB_WORLD_PAY_SHOPPING_LOAN" + PosApmPaymentProvider_GOOGLEPAY PosApmPaymentProvider = "GOOGLEPAY" + PosApmPaymentProvider_GARANTI_PAY PosApmPaymentProvider = "GARANTI_PAY" ) // payment status declaration const ( - FAILURE PaymentStatus = "FAILURE" - SUCCESS PaymentStatus = "SUCCESS" - INIT_THREEDS PaymentStatus = "INIT_THREEDS" - CALLBACK_THREEDS PaymentStatus = "CALLBACK_THREEDS" - WAITING PaymentStatus = "WAITING" + PaymentStatus_FAILURE PaymentStatus = "FAILURE" + PaymentStatus_SUCCESS PaymentStatus = "SUCCESS" + PaymentStatus_INIT_THREEDS PaymentStatus = "INIT_THREEDS" + PaymentStatus_CALLBACK_THREEDS PaymentStatus = "CALLBACK_THREEDS" + PaymentStatus_WAITING PaymentStatus = "WAITING" ) // payment source declaration const ( - API PaymentSource = "API" - CHECKOUT_FORM PaymentSource = "CHECKOUT_FORM" - PAY_BY_LINK PaymentSource = "PAY_BY_LINK" + PaymentSource_API PaymentSource = "API" + PaymentSource_CHECKOUT_FORM PaymentSource = "CHECKOUT_FORM" + PaymentSource_PAY_BY_LINK PaymentSource = "PAY_BY_LINK" ) // currency declaration const ( - TRY Currency = "TRY" - USD Currency = "USD" - EUR Currency = "EUR" - GBP Currency = "GBP" - CNY Currency = "CNY" - ARS Currency = "ARS" - BRL Currency = "BRL" - AED Currency = "AED" - IQD Currency = "IQD" - AZN Currency = "AZN" - KZT Currency = "KZT" + Currency_TRY Currency = "TRY" + Currency_USD Currency = "USD" + Currency_EUR Currency = "EUR" + Currency_GBP Currency = "GBP" + Currency_CNY Currency = "CNY" + Currency_ARS Currency = "ARS" + Currency_BRL Currency = "BRL" + Currency_AED Currency = "AED" + Currency_IQD Currency = "IQD" + Currency_AZN Currency = "AZN" + Currency_KZT Currency = "KZT" + Currency_KWD Currency = "KWD" + Currency_SAR Currency = "SAR" + Currency_BHD Currency = "BHD" + Currency_RUB Currency = "RUB" + Currency_JPY Currency = "JPY" ) // payment group declaration const ( - PRODUCT PaymentGroup = "PRODUCT" - LISTING_OR_SUBSCRIPTION PaymentGroup = "LISTING_OR_SUBSCRIPTION" + PaymentGroup_PRODUCT PaymentGroup = "PRODUCT" + PaymentGroup_LISTING_OR_SUBSCRIPTION PaymentGroup = "LISTING_OR_SUBSCRIPTION" ) // payment phase declaration const ( - AUTH PaymentPhase = "AUTH" - PRE_AUTH PaymentPhase = "PRE_AUTH" - POST_AUTH PaymentPhase = "POST_AUTH" + PaymentPhase_AUTH PaymentPhase = "AUTH" + PaymentPhase_PRE_AUTH PaymentPhase = "PRE_AUTH" + PaymentPhase_POST_AUTH PaymentPhase = "POST_AUTH" ) // payment method declaration const ( - PaymentMethod_CARD PaymentMethod = "CARD" - PaymentMethod_MASTERPASS PaymentMethod = "MASTERPASS" - PaymentMethod_PAPARA PaymentMethod = "PAPARA" - PaymentMethod_PAYONEER PaymentMethod = "PAYONEER" - PaymentMethod_SODEXO PaymentMethod = "SODEXO" - PaymentMethod_EDENRED PaymentMethod = "EDENRED" - PaymentMethod_EDENRED_GIFT PaymentMethod = "EDENRED_GIFT" - PaymentMethod_ALIPAY PaymentMethod = "ALIPAY" - PaymentMethod_PAYPAL PaymentMethod = "PAYPAL" - PaymentMethod_KLARNA PaymentMethod = "KLARNA" - PaymentMethod_AFTERPAY PaymentMethod = "AFTERPAY" - PaymentMethod_KASPI PaymentMethod = "KASPI" - PaymentMethod_STRIPE PaymentMethod = "STRIPE" + PaymentMethod_CARD PaymentMethod = "CARD" + PaymentMethod_MASTERPASS PaymentMethod = "MASTERPASS" + PaymentMethod_PAPARA PaymentMethod = "PAPARA" + PaymentMethod_PAYONEER PaymentMethod = "PAYONEER" + PaymentMethod_SODEXO PaymentMethod = "SODEXO" + PaymentMethod_EDENRED PaymentMethod = "EDENRED" + PaymentMethod_EDENRED_GIFT PaymentMethod = "EDENRED_GIFT" + PaymentMethod_ALIPAY PaymentMethod = "ALIPAY" + PaymentMethod_PAYPAL PaymentMethod = "PAYPAL" + PaymentMethod_KLARNA PaymentMethod = "KLARNA" + PaymentMethod_AFTERPAY PaymentMethod = "AFTERPAY" + PaymentMethod_KASPI PaymentMethod = "KASPI" + PaymentMethod_INSTANT_TRANSFER PaymentMethod = "INSTANT_TRANSFER" + PaymentMethod_TOMPAY PaymentMethod = "TOMPAY" + PaymentMethod_STRIPE PaymentMethod = "STRIPE" ) // card type declaration const ( - CREDIT_CARD CardType = "CREDIT_CARD" - DEBIT_CARD CardType = "DEBIT_CARD" - PREPAID_CARD CardType = "PREPAID_CARD" + CardType_CREDIT_CARD CardType = "CREDIT_CARD" + CardType_DEBIT_CARD CardType = "DEBIT_CARD" + CardType_PREPAID_CARD CardType = "PREPAID_CARD" ) // card association declaration const ( - VISA CardAssociation = "VISA" - MASTER_CARD CardAssociation = "MASTER_CARD" - AMEX CardAssociation = "AMEX" - TROY CardAssociation = "TROY" - JCB CardAssociation = "JCB" - UNION_PAY CardAssociation = "UNION_PAY" - MAESTRO CardAssociation = "MAESTRO" - DISCOVER CardAssociation = "DISCOVER" - DINERS_CLUB CardAssociation = "DINERS_CLUB" + CardAssociation_VISA CardAssociation = "VISA" + CardAssociation_MASTER_CARD CardAssociation = "MASTER_CARD" + CardAssociation_AMEX CardAssociation = "AMEX" + CardAssociation_TROY CardAssociation = "TROY" + CardAssociation_JCB CardAssociation = "JCB" + CardAssociation_UNION_PAY CardAssociation = "UNION_PAY" + CardAssociation_MAESTRO CardAssociation = "MAESTRO" + CardAssociation_DISCOVER CardAssociation = "DISCOVER" + CardAssociation_DINERS_CLUB CardAssociation = "DINERS_CLUB" ) // card expiry status declaration const ( - EXPIRED CardExpiryStatus = "EXPIRED" - WILL_EXPIRE_NEXT_MONTH CardExpiryStatus = "WILL_EXPIRE_NEXT_MONTH" - NOT_EXPIRED CardExpiryStatus = "NOT_EXPIRED" + CardExpiryStatus_EXPIRED CardExpiryStatus = "EXPIRED" + CardExpiryStatus_WILL_EXPIRE_NEXT_MONTH CardExpiryStatus = "WILL_EXPIRE_NEXT_MONTH" + CardExpiryStatus_NOT_EXPIRED CardExpiryStatus = "NOT_EXPIRED" ) // loyalty type declaration const ( - REWARD_MONEY LoyaltyType = "REWARD_MONEY" - ADDITIONAL_INSTALLMENT LoyaltyType = "ADDITIONAL_INSTALLMENT" - POSTPONING_INSTALLMENT LoyaltyType = "POSTPONING_INSTALLMENT" - EXTRA_POINTS LoyaltyType = "EXTRA_POINTS" - GAINING_MINUTES LoyaltyType = "GAINING_MINUTES" - POSTPONING_STATEMENT LoyaltyType = "POSTPONING_STATEMENT" + LoyaltyType_REWARD_MONEY LoyaltyType = "REWARD_MONEY" + LoyaltyType_ADDITIONAL_INSTALLMENT LoyaltyType = "ADDITIONAL_INSTALLMENT" + LoyaltyType_POSTPONING_INSTALLMENT LoyaltyType = "POSTPONING_INSTALLMENT" + LoyaltyType_EXTRA_POINTS LoyaltyType = "EXTRA_POINTS" + LoyaltyType_GAINING_MINUTES LoyaltyType = "GAINING_MINUTES" + LoyaltyType_POSTPONING_STATEMENT LoyaltyType = "POSTPONING_STATEMENT" ) // payment refund status declaration const ( - NO_REFUND PaymentRefundStatus = "NO_REFUND" - NOT_REFUNDED PaymentRefundStatus = "NOT_REFUNDED" - PARTIAL_REFUNDED PaymentRefundStatus = "PARTIAL_REFUNDED" - FULLY_REFUNDED PaymentRefundStatus = "FULLY_REFUNDED" + PaymentRefundStatus_NO_REFUND PaymentRefundStatus = "NO_REFUND" + PaymentRefundStatus_NOT_REFUNDED PaymentRefundStatus = "NOT_REFUNDED" + PaymentRefundStatus_PARTIAL_REFUNDED PaymentRefundStatus = "PARTIAL_REFUNDED" + PaymentRefundStatus_FULLY_REFUNDED PaymentRefundStatus = "FULLY_REFUNDED" ) // refund status declaration const ( - SuccessRefundStatus RefundStatus = "SUCCESS" - FailureRefundStatus RefundStatus = "FAILURE" + RefundStatus_SUCCESS RefundStatus = "SUCCESS" + RefundStatus_FAILURE RefundStatus = "FAILURE" +) + +// onboarding status declaration +const ( + OnboardingStatus_APPLICATION_REJECTED OnboardingStatus = "APPLICATION_REJECTED" + OnboardingStatus_REGISTERED OnboardingStatus = "REGISTERED" + OnboardingStatus_REGISTER_CONFIRMED OnboardingStatus = "REGISTER_CONFIRMED" + OnboardingStatus_APPLIED OnboardingStatus = "APPLIED" + OnboardingStatus_INTEGRATION OnboardingStatus = "INTEGRATION" + OnboardingStatus_LIVE OnboardingStatus = "LIVE" ) // refund type declaration const ( - CANCEL RefundType = "CANCEL" - REFUND RefundType = "REFUND" + RefundType_CANCEL RefundType = "CANCEL" + RefundType_REFUND RefundType = "REFUND" ) // approval status declaration const ( - SuccessApprovalStatus ApprovalStatus = "SUCCESS" - FailureApprovalStatus ApprovalStatus = "FAILURE" + ApprovalStatus_SUCCESS ApprovalStatus = "SUCCESS" + ApprovalStatus_FAILURE ApprovalStatus = "FAILURE" ) // status declaration const ( - ACTIVE Status = "ACTIVE" - PASSIVE Status = "PASSIVE" + Status_ACTIVE Status = "ACTIVE" + Status_PASSIVE Status = "PASSIVE" ) // member type declaration const ( - PERSONAL MemberType = "PERSONAL" - PRIVATE_COMPANY MemberType = "PRIVATE_COMPANY" - LIMITED_OR_JOINT_STOCK_COMPANY MemberType = "LIMITED_OR_JOINT_STOCK_COMPANY" + MemberType_PERSONAL MemberType = "PERSONAL" + MemberType_PRIVATE_COMPANY MemberType = "PRIVATE_COMPANY" + MemberType_LIMITED_OR_JOINT_STOCK_COMPANY MemberType = "LIMITED_OR_JOINT_STOCK_COMPANY" ) // settlementEarningsDestination type declaration const ( - SettlementEarningsDestinationIBAN SettlementEarningsDestination = "IBAN" - SettlementEarningsDestinationWALLET SettlementEarningsDestination = "WALLET" - SettlementEarningsDestinationCROSS_BORDER SettlementEarningsDestination = "CROSS_BORDER" + SettlementEarningsDestination_IBAN SettlementEarningsDestination = "IBAN" + SettlementEarningsDestination_WALLET SettlementEarningsDestination = "WALLET" + SettlementEarningsDestination_CROSS_BORDER SettlementEarningsDestination = "CROSS_BORDER" ) // refundDestinationType type declaration const ( - RefundDestinationTypePROVIDER RefundDestinationType = "PROVIDER" - RefundDestinationTypeWALLET RefundDestinationType = "WALLET" + RefundDestinationType_PROVIDER RefundDestinationType = "PROVIDER" + RefundDestinationType_WALLET RefundDestinationType = "WALLET" ) // transaction status declaration const ( - WAITING_FOR_APPROVAL TransactionStatus = "WAITING_FOR_APPROVAL" - APPROVED TransactionStatus = "APPROVED" - PAYOUT_STARTED TransactionStatus = "PAYOUT_STARTED" + TransactionStatus_WAITING_FOR_APPROVAL TransactionStatus = "WAITING_FOR_APPROVAL" + TransactionStatus_APPROVED TransactionStatus = "APPROVED" + TransactionStatus_PAYOUT_STARTED TransactionStatus = "PAYOUT_STARTED" ) // transaction payout status declaration const ( - TransactionPayoutStatusCANCELLED TransactionPayoutStatus = "CANCELLED" - TransactionPayoutStatusNO_PAYOUT TransactionPayoutStatus = "NO_PAYOUT" - TransactionPayoutStatusWAITING_FOR_PAYOUT TransactionPayoutStatus = "WAITING_FOR_PAYOUT" - TransactionPayoutStatusPAYOUT_STARTED TransactionPayoutStatus = "PAYOUT_STARTED" - TransactionPayoutStatusPAYOUT_COMPLETED TransactionPayoutStatus = "PAYOUT_COMPLETED" + TransactionPayoutStatus_CANCELLED TransactionPayoutStatus = "CANCELLED" + TransactionPayoutStatus_NO_PAYOUT TransactionPayoutStatus = "NO_PAYOUT" + TransactionPayoutStatus_WAITING_FOR_PAYOUT TransactionPayoutStatus = "WAITING_FOR_PAYOUT" + TransactionPayoutStatus_PAYOUT_STARTED TransactionPayoutStatus = "PAYOUT_STARTED" + TransactionPayoutStatus_PAYOUT_COMPLETED TransactionPayoutStatus = "PAYOUT_COMPLETED" ) // settlement type declaration const ( - SettlementTypeSETTLEMENT SettlementType = "SETTLEMENT" - SettlementTypeBOUNCED_SETTLEMENT SettlementType = "BOUNCED_SETTLEMENT" - SettlementTypeWITHDRAW SettlementType = "WITHDRAW" + SettlementType_SETTLEMENT SettlementType = "SETTLEMENT" + SettlementType_BOUNCED_SETTLEMENT SettlementType = "BOUNCED_SETTLEMENT" + SettlementType_WITHDRAW SettlementType = "WITHDRAW" ) // wallet transaction refund type declaration const ( - PAYMENT WalletTransactionRefundTransactionType = "PAYMENT" - PAYMENT_TX WalletTransactionRefundTransactionType = "PAYMENT_TX" - WALLET_TX WalletTransactionRefundTransactionType = "WALLET_TX" + WalletTransactionRefundCardTransactionType_PAYMENT WalletTransactionRefundTransactionType = "PAYMENT" + WalletTransactionRefundCardTransactionType_PAYMENT_TX WalletTransactionRefundTransactionType = "PAYMENT_TX" + WalletTransactionRefundCardTransactionType_WALLET_TX WalletTransactionRefundTransactionType = "WALLET_TX" ) // fraud action type declaration const ( - BLOCK FraudAction = "BLOCK" - REVIEW FraudAction = "REVIEW" + FraudAction_BLOCK FraudAction = "BLOCK" + FraudAction_REVIEW FraudAction = "REVIEW" ) // fraud check status type declaration const ( - FraudCheckStatusWAITING FraudCheckStatus = "WAITING" - FraudCheckStatusNOT_FRAUD FraudCheckStatus = "NOT_FRAUD" - FraudCheckStatusFRAUD FraudCheckStatus = "FRAUD" + FraudCheckStatus_WAITING FraudCheckStatus = "WAITING" + FraudCheckStatus_NOT_FRAUD FraudCheckStatus = "NOT_FRAUD" + FraudCheckStatus_FRAUD FraudCheckStatus = "FRAUD" +) + +// fraud value type type declaration +const ( + FraudValueType_CARD FraudValueType = "CARD" + FraudValueType_IP FraudValueType = "IP" + FraudValueType_PHONE_NUMBER FraudValueType = "PHONE_NUMBER" + FraudValueType_EMAIL FraudValueType = "EMAIL" + FraudValueType_OTHER FraudValueType = "OTHER" ) // apm additional action type declaration const ( - REDIRECT_TO_URL ApmAdditionalAction = "REDIRECT_TO_URL" - OTP_REQUIRED ApmAdditionalAction = "OTP_REQUIRED" - NONE ApmAdditionalAction = "NONE" + ApmAdditionalAction_REDIRECT_TO_URL ApmAdditionalAction = "REDIRECT_TO_URL" + ApmAdditionalAction_OTP_REQUIRED ApmAdditionalAction = "OTP_REQUIRED" + ApmAdditionalAction_SHOW_HTML_CONTENT ApmAdditionalAction = "SHOW_HTML_CONTENT" + ApmAdditionalAction_WAIT_FOR_WEBHOOK ApmAdditionalAction = "WAIT_FOR_WEBHOOK" + ApmAdditionalAction_APPROVAL_REQUIRED ApmAdditionalAction = "APPROVAL_REQUIRED" + ApmAdditionalAction_NONE ApmAdditionalAction = "NONE" ) // report file type declaration const ( - CSV ReportFileType = "CSV" - XLSX ReportFileType = "XLSX" + ReportFileType_CSV ReportFileType = "CSV" + ReportFileType_XLSX ReportFileType = "XLSX" ) // wallet transaction type declaration const ( - PAYMENT_REDEEM WalletTransactionType = "PAYMENT_REDEEM" - REFUND_DEPOSIT WalletTransactionType = "REFUND_DEPOSIT" - REFUND_TX_DEPOSIT WalletTransactionType = "REFUND_TX_DEPOSIT" - WITHDRAW WalletTransactionType = "WITHDRAW" - CANCEL_REFUND_WALLET_TO_CARD WalletTransactionType = "CANCEL_REFUND_WALLET_TO_CARD" - REFUND_WALLET_TX_TO_CARD WalletTransactionType = "REFUND_WALLET_TX_TO_CARD" - REFUND_WALLET_TX_FUND_TRANSFER WalletTransactionType = "REFUND_WALLET_TX_FUND_TRANSFER" - CANCEL_REFUND_TO_WALLET WalletTransactionType = "CANCEL_REFUND_TO_WALLET" - REFUND_TX_TO_WALLET WalletTransactionType = "REFUND_TX_TO_WALLET" - MANUAL_REFUND_TX_TO_WALLET WalletTransactionType = "MANUAL_REFUND_TX_TO_WALLET" - SETTLEMENT_EARNINGS WalletTransactionType = "SETTLEMENT_EARNINGS" - DEPOSIT_FROM_CARD WalletTransactionType = "DEPOSIT_FROM_CARD" - DEPOSIT_FROM_APM WalletTransactionType = "DEPOSIT_FROM_APM" - DEPOSIT_FROM_FUND_TRANSFER WalletTransactionType = "DEPOSIT_FROM_FUND_TRANSFER" - REMITTANCE WalletTransactionType = "REMITTANCE" - LOYALTY WalletTransactionType = "LOYALTY" - WITHDRAW_CANCEL WalletTransactionType = "WITHDRAW_CANCEL" - MERCHANT_BALANCE_RESET WalletTransactionType = "MERCHANT_BALANCE_RESET" + WalletTransactionType_PAYMENT_REDEEM WalletTransactionType = "PAYMENT_REDEEM" + WalletTransactionType_REFUND_DEPOSIT WalletTransactionType = "REFUND_DEPOSIT" + WalletTransactionType_REFUND_TX_DEPOSIT WalletTransactionType = "REFUND_TX_DEPOSIT" + WalletTransactionType_WITHDRAW WalletTransactionType = "WITHDRAW" + WalletTransactionType_CANCEL_REFUND_WALLET_TO_CARD WalletTransactionType = "CANCEL_REFUND_WALLET_TO_CARD" + WalletTransactionType_REFUND_WALLET_TX_TO_CARD WalletTransactionType = "REFUND_WALLET_TX_TO_CARD" + WalletTransactionType_REFUND_WALLET_TX_FUND_TRANSFER WalletTransactionType = "REFUND_WALLET_TX_FUND_TRANSFER" + WalletTransactionType_CANCEL_REFUND_TO_WALLET WalletTransactionType = "CANCEL_REFUND_TO_WALLET" + WalletTransactionType_REFUND_TX_TO_WALLET WalletTransactionType = "REFUND_TX_TO_WALLET" + WalletTransactionType_MANUAL_REFUND_TX_TO_WALLET WalletTransactionType = "MANUAL_REFUND_TX_TO_WALLET" + WalletTransactionType_SETTLEMENT_EARNINGS WalletTransactionType = "SETTLEMENT_EARNINGS" + WalletTransactionType_DEPOSIT_FROM_CARD WalletTransactionType = "DEPOSIT_FROM_CARD" + WalletTransactionType_DEPOSIT_FROM_APM WalletTransactionType = "DEPOSIT_FROM_APM" + WalletTransactionType_DEPOSIT_FROM_FUND_TRANSFER WalletTransactionType = "DEPOSIT_FROM_FUND_TRANSFER" + WalletTransactionType_REMITTANCE WalletTransactionType = "REMITTANCE" + WalletTransactionType_LOYALTY WalletTransactionType = "LOYALTY" + WalletTransactionType_WITHDRAW_CANCEL WalletTransactionType = "WITHDRAW_CANCEL" + WalletTransactionType_MERCHANT_BALANCE_RESET WalletTransactionType = "MERCHANT_BALANCE_RESET" +) + +const ( + WebhookEventType_API_AUTH WebhookEventType = "API_AUTH" + WebhookEventType_API_VERIFY_AND_AUTH WebhookEventType = "API_VERIFY_AND_AUTH" + WebhookEventType_CHECKOUTFORM_AUTH WebhookEventType = "CHECKOUTFORM_AUTH" + WebhookEventType_THREEDS_VERIFY WebhookEventType = "THREEDS_VERIFY" + WebhookEventType_REFUND WebhookEventType = "REFUND" + WebhookEventType_REFUND_TX WebhookEventType = "REFUND_TX" + WebhookEventType_PAYOUT_COMPLETED WebhookEventType = "PAYOUT_COMPLETED" + WebhookEventType_AUTOPILOT WebhookEventType = "AUTOPILOT" + WebhookEventType_WALLET_CREATED WebhookEventType = "WALLET_CREATED" + WebhookEventType_WALLET_TX_CREATED WebhookEventType = "WALLET_TX_CREATED" + WebhookEventType_BNPL_NOTIFICATION WebhookEventType = "BNPL_NOTIFICATION" +) + +const ( + WebhookStatus_SUCCESS WebhookStatus = "SUCCESS" + WebhookStatus_FAILURE WebhookStatus = "FAILURE" +) + +const ( + PosStatus_DELETED PosStatus = "DELETED" + PosStatus_PASSIVE PosStatus = "PASSIVE" + PosStatus_ACTIVE PosStatus = "ACTIVE" + PosStatus_REFUND_ONLY PosStatus = "REFUND_ONLY" + PosStatus_AUTOPILOT PosStatus = "AUTOPILOT" +) + +const ( + PosIntegrator_YKB PosIntegrator = "YKB" + PosIntegrator_GARANTI PosIntegrator = "GARANTI" + PosIntegrator_ISBANK PosIntegrator = "ISBANK" + PosIntegrator_AKBANK PosIntegrator = "AKBANK" + PosIntegrator_ZIRAATBANK PosIntegrator = "ZIRAATBANK" + PosIntegrator_ZIRAATBANK_INNOVA PosIntegrator = "ZIRAATBANK_INNOVA" + PosIntegrator_ZIRAATKATILIM PosIntegrator = "ZIRAATKATILIM" + PosIntegrator_KUVEYTTURK PosIntegrator = "KUVEYTTURK" + PosIntegrator_HALKBANK PosIntegrator = "HALKBANK" + PosIntegrator_DENIZBANK PosIntegrator = "DENIZBANK" + PosIntegrator_VAKIFBANK PosIntegrator = "VAKIFBANK" + PosIntegrator_VAKIFKATILIM PosIntegrator = "VAKIFKATILIM" + PosIntegrator_FINANSBANK PosIntegrator = "FINANSBANK" + PosIntegrator_FIBABANK PosIntegrator = "FIBABANK" + PosIntegrator_FIBABANK_ASSECO PosIntegrator = "FIBABANK_ASSECO" + PosIntegrator_ANADOLUBANK PosIntegrator = "ANADOLUBANK" + PosIntegrator_PARAM_POS PosIntegrator = "PARAM_POS" + PosIntegrator_IYZICO PosIntegrator = "IYZICO" + PosIntegrator_SIPAY PosIntegrator = "SIPAY" + PosIntegrator_PAYNET PosIntegrator = "PAYNET" + PosIntegrator_PAYTR PosIntegrator = "PAYTR" + PosIntegrator_BIRLESIK_ODEME PosIntegrator = "BIRLESIK_ODEME" + PosIntegrator_MOKA PosIntegrator = "MOKA" + PosIntegrator_STRIPE PosIntegrator = "STRIPE" + PosIntegrator_TEB PosIntegrator = "TEB" + PosIntegrator_IPARA PosIntegrator = "IPARA" + PosIntegrator_OZAN PosIntegrator = "OZAN" + PosIntegrator_BRAINTREE PosIntegrator = "BRAINTREE" + PosIntegrator_NKOLAY PosIntegrator = "NKOLAY" + PosIntegrator_PAYTABS PosIntegrator = "PAYTABS" + PosIntegrator_PAYBULL PosIntegrator = "PAYBULL" + PosIntegrator_ELEKSE PosIntegrator = "ELEKSE" + PosIntegrator_ALGORITMA PosIntegrator = "ALGORITMA" + PosIntegrator_PAYCELL PosIntegrator = "PAYCELL" + PosIntegrator_TAMI PosIntegrator = "TAMI" + PosIntegrator_QNB_PAY PosIntegrator = "QNB_PAY" + PosIntegrator_AKBANK_VPOS PosIntegrator = "AKBANK_VPOS" + PosIntegrator_TAP PosIntegrator = "TAP" + PosIntegrator_RUBIK PosIntegrator = "RUBIK" +) + +const ( + PosUserType_API PosUserType = "API" +) + +const ( + PosOperationType_STANDARD PosOperationType = "STANDARD" + PosOperationType_PROVAUT PosOperationType = "PROVAUT" + PosOperationType_PROVRFN PosOperationType = "PROVRFN" + PosOperationType_PAYMENT PosOperationType = "PAYMENT" + PosOperationType_REFUND PosOperationType = "REFUND" + PosOperationType_INQUIRY PosOperationType = "INQUIRY" +) + +const ( + FileStatus_CREATED FileStatus = "CREATED" + FileStatus_UPLOADED FileStatus = "UPLOADED" + FileStatus_APPROVED FileStatus = "APPROVED" +) + +const ( + AdditionalAction_CONTINUE_IN_CLIENT AdditionalAction = "CONTINUE_IN_CLIENT" + AdditionalAction_SHOW_HTML_CONTENT AdditionalAction = "SHOW_HTML_CONTENT" + AdditionalAction_REDIRECT_TO_URL AdditionalAction = "REDIRECT_TO_URL" + AdditionalAction_NONE AdditionalAction = "NONE" ) const ( - API_AUTH WebhookEventType = "API_AUTH" - API_VERIFY_AND_AUTH WebhookEventType = "API_VERIFY_AND_AUTH" - CHECKOUTFORM_AUTH WebhookEventType = "CHECKOUTFORM_AUTH" - THREEDS_VERIFY WebhookEventType = "THREEDS_VERIFY" + AccountOwner_MERCHANT AccountOwner = "MERCHANT" + AccountOwner_SUB_MERCHANT_MEMBER AccountOwner = "SUB_MERCHANT_MEMBER" ) const ( - WebhookStatusSUCCESS WebhookStatus = "SUCCESS" - WebhookStatusFAILURE WebhookStatus = "FAILURE" + PayoutAccountType_WISE PayoutAccountType = "WISE" ) +// BnplCartItemType type declaration const ( - FileStatusCREATED FileStatus = "CREATED" - FileStatusUPLOADED FileStatus = "UPLOADED" - FileStatusAPPROVED FileStatus = "APPROVED" + BnplCartItemType_MOBILE_PHONE_OVER_5000_TRY BnplCartItemType = "MOBILE_PHONE_OVER_5000_TRY" + BnplCartItemType_MOBILE_PHONE_BELOW_5000_TRY BnplCartItemType = "MOBILE_PHONE_BELOW_5000_TRY" + BnplCartItemType_MOBILE_PHONE_PRICE_ABOVE_REGULATION_LIMIT BnplCartItemType = "MOBILE_PHONE_PRICE_ABOVE_REGULATION_LIMIT" + BnplCartItemType_MOBILE_PHONE_PRICE_BELOW_REGULATION_LIMIT BnplCartItemType = "MOBILE_PHONE_PRICE_BELOW_REGULATION_LIMIT" + BnplCartItemType_TABLET BnplCartItemType = "TABLET" + BnplCartItemType_COMPUTER BnplCartItemType = "COMPUTER" + BnplCartItemType_CONSTRUCTION_MARKET BnplCartItemType = "CONSTRUCTION_MARKET" + BnplCartItemType_GOLD BnplCartItemType = "GOLD" + BnplCartItemType_DIGITAL_PRODUCTS BnplCartItemType = "DIGITAL_PRODUCTS" + BnplCartItemType_SUPERMARKET BnplCartItemType = "SUPERMARKET" + BnplCartItemType_WHITE_GOODS BnplCartItemType = "WHITE_GOODS" + BnplCartItemType_WEARABLE_TECHNOLOGY BnplCartItemType = "WEARABLE_TECHNOLOGY" + BnplCartItemType_SMALL_HOME_APPLIANCES BnplCartItemType = "SMALL_HOME_APPLIANCES" + BnplCartItemType_TV BnplCartItemType = "TV" + BnplCartItemType_GAMES_CONSOLES BnplCartItemType = "GAMES_CONSOLES" + BnplCartItemType_AIR_CONDITIONER_AND_HEATER BnplCartItemType = "AIR_CONDITIONER_AND_HEATER" + BnplCartItemType_ELECTRONICS BnplCartItemType = "ELECTRONICS" + BnplCartItemType_ACCESSORIES BnplCartItemType = "ACCESSORIES" + BnplCartItemType_MOM_AND_BABY_AND_KIDS BnplCartItemType = "MOM_AND_BABY_AND_KIDS" + BnplCartItemType_SHOES BnplCartItemType = "SHOES" + BnplCartItemType_CLOTHING BnplCartItemType = "CLOTHING" + BnplCartItemType_COSMETICS_AND_PERSONAL_CARE BnplCartItemType = "COSMETICS_AND_PERSONAL_CARE" + BnplCartItemType_FURNITURE BnplCartItemType = "FURNITURE" + BnplCartItemType_HOME_LIVING BnplCartItemType = "HOME_LIVING" + BnplCartItemType_AUTOMOBILE_MOTORCYCLE BnplCartItemType = "AUTOMOBILE_MOTORCYCLE" + BnplCartItemType_OTHER BnplCartItemType = "OTHER" ) +// RecordType declaration const ( - AccountOwnerMERCHANT AccountOwner = "MERCHANT" - AccountOwnerSUB_MERCHANT_MEMBER AccountOwner = "SUB_MERCHANT_MEMBER" + RecordType_SEND RecordType = "SEND" + RecordType_RECEIVE RecordType = "RECEIVE" ) +// BankAccountTrackingSource declaration const ( - PayoutAccountTypeWISE PayoutAccountType = "WISE" + BankAccountTrackingSource_YKB BankAccountTrackingSource = "YKB" + BankAccountTrackingSource_GARANTI BankAccountTrackingSource = "GARANTI" +) + +const ( + PaymentAuthenticationType_THREE_DS PaymentAuthenticationType = "THREE_DS" + PaymentAuthenticationType_NON_THREE_DS PaymentAuthenticationType = "NON_THREE_DS" +) + +const ( + CardBrand_BONUS CardBrand = "Bonus" + CardBrand_AXESS CardBrand = "Axess" + CardBrand_MAXIMUM CardBrand = "Maximum" + CardBrand_WORLD CardBrand = "World" + CardBrand_PARAF CardBrand = "Paraf" + CardBrand_CARD_FINANS CardBrand = "CardFinans" + CardBrand_BANKKART_COMBO CardBrand = "Bankkart Combo" + CardBrand_ADVANTAGE CardBrand = "Advantage" + CardBrand_SAGLAM_KART CardBrand = "Sağlam Kart" +) + +const ( + ClientType_W ClientType = "W" + ClientType_M ClientType = "M" ) // tokenized card type declaration const ( - TokenizedCardTypeAPPLE_PAY TokenizedCardType = "APPLE_PAY" + TokenizedCardType_APPLE_PAY TokenizedCardType = "APPLE_PAY" ) // requests @@ -416,6 +624,10 @@ type Init3DSPaymentRequest struct { Retry bool `json:"retry"` } +type Complete3DSPaymentRequest struct { + PaymentId int64 `json:"paymentId"` +} + type InitCheckoutPaymentRequest struct { Price float64 `json:"price,omitempty"` PaidPrice float64 `json:"paidPrice,omitempty"` @@ -468,8 +680,31 @@ type CompleteApmPaymentRequest struct { AdditionalParams map[string]string `json:"additionalParams,omitempty"` } -type Complete3DSPaymentRequest struct { - PaymentId int64 `json:"paymentId"` +type InitPosApmPaymentRequest struct { + Price float64 `json:"price,omitempty"` + PaidPrice float64 `json:"paidPrice,omitempty"` + PosAlias string `json:"posAlias,omitempty"` + Currency Currency `json:"currency,omitempty"` + ConversationId string `json:"conversationId,omitempty"` + ExternalId string `json:"externalId,omitempty"` + CallbackUrl string `json:"callbackUrl,omitempty"` + PaymentPhase PaymentPhase `json:"paymentPhase,omitempty"` + PaymentGroup PaymentGroup `json:"paymentGroup,omitempty"` + PaymentChannel string `json:"paymentChannel,omitempty"` + BuyerMemberId int64 `json:"buyerMemberId,omitempty"` + BankOrderId string `json:"bankOrderId,omitempty"` + ClientIp string `json:"clientIp,omitempty"` + Items []PaymentItem `json:"items"` + AdditionalParams map[string]string `json:"additionalParams"` + Installments []PosApmInstallment `json:"installments"` + PaymentProvider PosApmPaymentProvider `json:"paymentProvider,omitempty"` + FraudParams *FraudCheckParameters `json:"fraudParams,omitempty"` + CheckoutFormToken string `json:"checkoutFormToken,omitempty"` +} + +type CompletePosApmPaymentRequest struct { + PaymentId int64 `json:"paymentId"` + AdditionalParams map[string]interface{} `json:"additionalParams"` } type PostAuthPaymentRequest struct { @@ -635,6 +870,7 @@ type MasterpassPaymentTokenGenerateRequest struct { BinNumber string `json:"binNumber,omitempty"` ForceThreeDS bool `json:"forceThreeDS,omitempty"` CreatePayment MasterpassCreatePayment `json:"createPayment,omitempty"` + Loyalty Loyalty `json:"loyalty,omitempty"` } type MasterpassPaymentCompleteRequest struct { @@ -651,6 +887,47 @@ type MasterpassPaymentThreeDSCompleteRequest struct { PaymentId int64 `json:"paymentId,omitempty"` } +type InitBnplPaymentRequest struct { + ApmType ApmType `json:"apmType"` + MerchantApmId int64 `json:"merchantApmId,omitempty"` + Price float64 `json:"price"` + PaidPrice float64 `json:"paidPrice"` + CommissionRate float64 `json:"commissionRate,omitempty"` + Currency Currency `json:"currency"` + PaymentType PaymentType `json:"paymentType"` + PaymentGroup PaymentGroup `json:"paymentGroup"` + PaymentSource PaymentSource `json:"paymentSource,omitempty"` + PaymentChannel string `json:"paymentChannel,omitempty"` + ConversationId string `json:"conversationId,omitempty"` + ExternalId string `json:"externalId,omitempty"` + CallbackUrl string `json:"callbackUrl"` + BuyerMemberId int64 `json:"buyerMemberId,omitempty"` + ApmOrderId string `json:"apmOrderId,omitempty"` + ClientIp string `json:"clientIp,omitempty"` + ApmUserIdentity string `json:"apmUserIdentity,omitempty"` + AdditionalParams map[string]string `json:"additionalParams"` + Items []PaymentItem `json:"items"` + BankCode string `json:"bankCode,omitempty"` + CartItems []BnplPaymentCartItem `json:"cartItems"` +} + +type BnplPaymentCartItem struct { + Id string `json:"id"` + Name string `json:"name"` + BrandName string `json:"brandName"` + Type BnplCartItemType `json:"type"` + UnitPrice float64 `json:"unitPrice"` + Quantity int64 `json:"quantity"` +} + +type BnplPaymentOfferRequest struct { + ApmType ApmType `json:"apmType"` + MerchantApmId int64 `json:"merchantApmId,omitempty"` + Price float64 `json:"price"` + Currency Currency `json:"currency"` + Items []BnplPaymentCartItem `json:"items"` +} + // responses type PaymentResponse struct { Id *int64 `json:"id"` @@ -719,7 +996,10 @@ type PaymentTransactionResponse struct { } type Init3DSPaymentResponse struct { - HtmlContent *string `json:"htmlContent"` + HtmlContent *string `json:"htmlContent"` + PaymentId *int64 `json:"paymentId"` + PaymentStatus *PaymentStatus `json:"paymentStatus"` + AdditionalAction *AdditionalAction `json:"additionalAction"` } type InitCheckoutPaymentResponse struct { @@ -731,6 +1011,7 @@ type InitCheckoutPaymentResponse struct { type InitApmPaymentResponse struct { PaymentId *int64 `json:"paymentId"` RedirectUrl *string `json:"redirectUrl"` + HtmlContent *string `json:"htmlContent"` PaymentStatus *PaymentStatus `json:"paymentStatus"` ApmAdditionalAction *ApmAdditionalAction `json:"additionalAction"` PaymentError *PaymentError `json:"paymentError"` @@ -742,6 +1023,22 @@ type CompleteApmPaymentResponse struct { PaymentError *PaymentError `json:"paymentError"` } +type InitPosApmPaymentResponse struct { + PaymentId *int64 `json:"paymentId"` + HtmlContent *string `json:"htmlContent"` + PaymentStatus *PaymentStatus `json:"paymentStatus"` + AdditionalAction *AdditionalAction `json:"additionalAction"` + AdditionalData map[string]any `json:"additionalData"` + PaymentError *PaymentError `json:"paymentError"` +} + +type CompletePosApmPaymentResponse struct { + PaymentId *int64 `json:"paymentId"` + ConversationId *string `json:"conversationId"` + PaymentStatus *PaymentStatus `json:"paymentStatus"` + PaymentError *PaymentError `json:"paymentError"` +} + type DepositPaymentResponse struct { Id *int64 `json:"id"` CreatedDate *TimeResponse `json:"createdDate"` @@ -935,6 +1232,7 @@ type GarantiPayInstallment struct { type InitGarantiPayPaymentResponse struct { HtmlContent *string `json:"htmlContent"` + PaymentId *int64 `json:"paymentId"` } type RetrieveLoyaltiesResponse struct { @@ -1025,6 +1323,7 @@ type SearchInstallmentsRequest struct { Price float64 `schema:"price"` Currency Currency `schema:"currency"` DistinctCardBrandsWithLowestCommissions bool `schema:"distinctCardBrandsWithLowestCommissions"` + LoyaltyExists bool `schema:"loyaltyExists"` } type InstallmentListResponse struct { @@ -1046,6 +1345,16 @@ type InstallmentResponse struct { InstallmentPrices []InstallmentPrice `json:"installmentPrices"` } +type InstantTransferBanksResponse struct { + Items []InstantTransferBank `json:"items"` +} + +type InstantTransferBank struct { + BankCode *string `json:"bankCode"` + BankName *string `json:"bankName"` + BankLogoUrl *string `json:"bankLogoUrl"` +} + type RetrieveBinNumberResponse struct { BinNumber *string `json:"binNumber"` CardType *string `json:"cardType"` @@ -1346,6 +1655,38 @@ type ReportingPaymentTransactionResponse struct { PayoutStatus *PayoutStatus `json:"payoutStatus"` } +type InitBnplPaymentResponse struct { + PaymentId int64 `json:"paymentId"` + RedirectUrl string `json:"redirectUrl"` + PaymentStatus PaymentStatus `json:"paymentStatus"` + AdditionalAction ApmAdditionalAction `json:"additionalAction"` + PaymentError PaymentError `json:"paymentError"` +} + +type BnplPaymentOfferResponse struct { + OfferId string `json:"offerId"` + Price *float64 `json:"price"` + BnplBankOffers *[]BnplBankOffer `json:"nnplBankOffers"` +} + +type BnplBankOffer struct { + BankCode string `json:"bankCode"` + BankName string `json:"bankName"` + BankIconUrl string `json:"bankIconUrl"` + BankTableBannerMessage string `json:"bankTableBannerMessage"` + BankSmallBannerMessage string `json:"bankSmallBannerMessage"` + IsSupportNonCustomer bool `json:"isSupportNonCustomer"` + BnplBankOfferTerm *[]BnplBankOfferTerm `json:"bankOfferTerms"` +} + +type BnplBankOfferTerm struct { + Term int64 `json:"term"` + Amount *float64 `json:"amount"` + TotalAmount *float64 `json:"totalAmount"` + InterestRate *float64 `json:"interestRate"` + AnnualInterestRate *float64 `json:"annualInterestRate"` +} + type Payout struct { PaidPrice *float64 `json:"paidPrice"` Parity *float64 `json:"parity"` @@ -1374,6 +1715,8 @@ type SearchPayoutCompletedTransactionsRequest struct { SettlementType SettlementType `schema:"settlementType,omitempty"` StartDate time.Time `schema:"startDate,omitempty"` EndDate time.Time `schema:"endDate,omitempty"` + Page int `schema:"page"` + Size int `schema:"size"` } type SearchPayoutBouncedTransactionsRequest struct { @@ -1394,15 +1737,16 @@ type RetrievePayoutDetailsRequest struct { } type SearchPayoutCompletedTransactionsResponse struct { - PayoutId *int64 `json:"payoutId"` - TransactionId *int64 `json:"transactionId"` - TransactionType *string `json:"transactionType"` - PayoutAmount *float64 `json:"payoutAmount"` - Currency *Currency `json:"currency"` - MerchantId *int64 `json:"merchantId"` - MerchantType *string `json:"merchantType"` - SettlementEarningsDestination *string `json:"settlementEarningsDestination"` - SettlementSource *string `json:"settlementSource"` + PayoutId *int64 `json:"payoutId"` + TransactionId *int64 `json:"transactionId"` + TransactionType *string `json:"transactionType"` + PayoutAmount *float64 `json:"payoutAmount"` + PayoutDate *TimeResponse `json:"payoutDate"` + Currency *Currency `json:"currency"` + MerchantId *int64 `json:"merchantId"` + MerchantType *string `json:"merchantType"` + SettlementEarningsDestination *string `json:"settlementEarningsDestination"` + SettlementSource *string `json:"settlementSource"` } type SearchPayoutBouncedTransactionsResponse struct { @@ -1470,20 +1814,21 @@ type FraudCheckResponse struct { } type FraudPaymentData struct { - PaymentDate *time.Time `json:"paymentDate"` - ConversationId *string `json:"conversationId"` - PaidPrice *float64 `json:"paidPrice"` - Currency *Currency `json:"currency"` - CardFingerprintId *string `json:"cardFingerprintId"` - CardFingerprintExpirationDate *time.Time `json:"cardFingerprintExpirationDate"` - BuyerId *int64 `json:"buyerId"` - ClientIp *string `json:"clientIp"` + PaymentDate *time.Time `json:"paymentDate"` + ConversationId *string `json:"conversationId"` + PaidPrice *float64 `json:"paidPrice"` + Currency *Currency `json:"currency"` + BuyerId *int64 `json:"buyerId"` + ClientIp *string `json:"clientIp"` } type FraudValueListRequest struct { - ListName string `json:"listName,omitempty"` - Value string `json:"value,omitempty"` - DurationInSeconds int `json:"durationInSeconds,omitempty"` + ListName string `json:"listName,omitempty"` + Type FraudValueType `json:"type,omitempty"` + Label string `json:"label,omitempty"` + Value string `json:"value,omitempty"` + PaymentId int64 `json:"paymentId"` + DurationInSeconds int `json:"durationInSeconds,omitempty"` } type FraudValuesResponse struct { @@ -1492,6 +1837,8 @@ type FraudValuesResponse struct { } type FraudValue struct { + Id *string `json:"id"` + Label *string `json:"label"` Value *string `json:"value"` ExpireInSeconds *int `json:"expireInSeconds"` } @@ -1514,6 +1861,30 @@ type WebhookData struct { PayloadId string } +type SearchBankAccountTrackingRecordRequest struct { + SenderName string `schema:"senderName,omitempty"` + SenderIban string `schema:"senderIban,omitempty"` + Description string `schema:"description,omitempty"` + Currency Currency `schema:"currency,omitempty"` + MinRecordDate time.Time `schema:"minRecordDate,omitempty"` + MaxRecordDate time.Time `schema:"maxRecordDate,omitempty"` + Page int `schema:"page,omitempty"` + Size int `schema:"size,omitempty"` +} + +type BankAccountTrackingRecordResponse struct { + Id int64 `json:"id"` + Key string `json:"key"` + SenderName string `json:"senderName"` + SenderIban string `json:"senderIban"` + Description string `json:"description"` + Currency Currency `json:"currency"` + Amount float64 `json:"amount"` + RecordDate TimeResponse `json:"recordDate"` + RecordType RecordType `json:"recordType"` + BankAccountTrackingSource BankAccountTrackingSource `json:"bankAccountTrackingSource"` +} + type RequestOptions struct { BaseURL string ApiKey string @@ -1592,6 +1963,11 @@ type FraudCheckParameters struct { BuyerEmail string `json:"buyerEmail,omitempty"` } +type PosApmInstallment struct { + Number *int `json:"number,omitempty"` + TotalPrice *float64 `json:"totalPrice,omitempty"` +} + type PaymentItem struct { Name string `json:"name,omitempty"` Price float64 `json:"price,omitempty"` @@ -1618,6 +1994,168 @@ type MasterpassCreatePayment struct { AdditionalParams map[string]interface{} `json:"additionalParams,omitempty"` } +type CreateMerchantRequest struct { + Name string `json:"name"` + LegalCompanyTitle string `json:"legalCompanyTitle"` + Email string `json:"email"` + SecretWord string `json:"secretWord,omitempty"` + Website string `json:"website"` + PhoneNumber string `json:"phoneNumber,omitempty"` + ContactName string `json:"contactName"` + ContactSurname string `json:"contactSurname"` + ContactPhoneNumber string `json:"contactPhoneNumber"` +} + +type MerchantApiCredential struct { + Name string `json:"name"` + ApiKey string `json:"apiKey"` + SecretKey string `json:"secretKey"` +} + +type CreateMerchantResponse struct { + Id *int64 `json:"id"` + Name *string `json:"name"` + MerchantApiCredentials []MerchantApiCredential `json:"merchantApiCredentials"` +} + +type CreateMerchantPosUser struct { + PosUsername string `json:"posUsername"` + PosPassword string `json:"posPassword"` + PosUserType PosUserType `json:"posUserType"` + PosOperationType PosOperationType `json:"posOperationType"` +} + +type CreateMerchantPosRequest struct { + Status PosStatus `json:"status"` + Name string `json:"name"` + ClientId string `json:"clientId"` + Currency Currency `json:"currency"` + PosnetId string `json:"posnetId,omitempty"` + TerminalId string `json:"terminalId,omitempty"` + ThreedsPosnetId string `json:"threedsPosnetId,omitempty"` + ThreedsTerminalId string `json:"threedsTerminalId,omitempty"` + ThreedsKey string `json:"threedsKey,omitempty"` + EnableForeignCard bool `json:"enableForeignCard"` + EnableInstallment bool `json:"enableInstallment"` + EnablePaymentWithoutCvc bool `json:"enablePaymentWithoutCvc"` + NewIntegration bool `json:"newIntegration"` + OrderNumber int64 `json:"orderNumber"` + PosIntegrator PosIntegrator `json:"posIntegrator"` + EnabledPaymentAuthenticationTypes []PaymentAuthenticationType `json:"enabledPaymentAuthenticationTypes"` + MerchantPosUsers []CreateMerchantPosUser `json:"merchantPosUsers"` +} + +type AutopilotState struct { + IsThreeDsUp bool `json:"isThreeDsUp"` + IsNonThreeDsUp bool `json:"isNonThreeDsUp"` +} + +type MerchantPosUser struct { + Id int64 `json:"id"` + PosUsername string `json:"posUsername"` + PosPassword string `json:"posPassword"` + PosUserType PosUserType `json:"posUserType"` + PosOperationType PosOperationType `json:"posOperationType"` +} +type MerchantPosResponse struct { + Id int64 `json:"id"` + Status PosStatus `json:"status"` + Name string `json:"name"` + Alias string `json:"alias"` + PosIntegrator PosIntegrator `json:"posIntegrator"` + Hostname string `json:"hostname"` + ClientId string `json:"clientId"` + PosCurrencyCode string `json:"posCurrencyCode"` + Mode string `json:"mode"` + Path string `json:"path"` + Port int64 `json:"port"` + PosnetId string `json:"posnetId"` + TerminalId string `json:"terminalId"` + ThreedsPosnetId string `json:"threedsPosnetId"` + ThreedsTerminalId string `json:"threedsTerminalId"` + ThreedsKey string `json:"threedsKey"` + ThreedsPath string `json:"threedsPath"` + EnableForeignCard bool `json:"enableForeignCard"` + EnableInstallment bool `json:"enableInstallment"` + EnablePaymentWithoutCvc bool `json:"enablePaymentWithoutCvc"` + NewIntegration bool `json:"newIntegration"` + OrderNumber int64 `json:"orderNumber"` + AutopilotState AutopilotState `json:"autopilotState"` + Currency Currency `json:"currency"` + BankId int64 `json:"bankId"` + BankName string `json:"bankName"` + IsPf bool `json:"isPf"` + MerchantPosUsers []MerchantPosUser `json:"merchantPosUsers"` + SupportedCardAssociations []CardAssociation `json:"supportedCardAssociations"` + EnabledPaymentAuthenticationTypes []PaymentAuthenticationType `json:"enabledPaymentAuthenticationTypes"` +} + +type MerchantPosCommissionResponse struct { + Id int64 `json:"id"` + Status Status `json:"status"` + Installment int64 `json:"installment"` + BlockageDay int64 `json:"blockageDay"` + InstallmentLabel string `json:"installmentLabel"` + CardBrandName CardBrand `json:"cardBrandName"` + BankOnUsCreditCardCommissionRate float64 `json:"bankOnUsCreditCardCommissionRate"` + BankNotOnUsCreditCardCommissionRate float64 `json:"bankNotOnUsCreditCardCommissionRate"` + BankOnUsDebitCardCommissionRate float64 `json:"bankOnUsDebitCardCommissionRate"` + BankNotOnUsDebitCardCommissionRate float64 `json:"bankNotOnUsDebitCardCommissionRate"` + BankForeignCardCommissionRate float64 `json:"bankForeignCardCommissionRate"` + MerchantCommissionRate float64 `json:"merchantCommissionRate"` +} + +type CreateMerchantPosCommission struct { + CardBrandName CardBrand `json:"cardBrandName,omitempty"` + Installment int64 `json:"installment"` + Status Status `json:"status"` + BlockageDay int64 `json:"blockageDay"` + InstallmentLabel string `json:"installmentLabel,omitempty"` + BankOnUsCreditCardCommissionRate float64 `json:"bankOnUsCreditCardCommissionRate"` + BankOnUsDebitCardCommissionRate float64 `json:"bankOnUsDebitCardCommissionRate,omitempty"` + BankNotOnUsCreditCardCommissionRate float64 `json:"bankNotOnUsCreditCardCommissionRate,omitempty"` + BankNotOnUsDebitCardCommissionRate float64 `json:"bankNotOnUsDebitCardCommissionRate,omitempty"` + BankForeignCardCommissionRate float64 `json:"bankForeignCardCommissionRate,omitempty"` + MerchantCommissionRate float64 `json:"merchantCommissionRate,omitempty"` +} + +type SearchMerchantPosRequest struct { + Name string `schema:"name,omitempty"` + Alias string `schema:"alias,omitempty"` + Currency Currency `schema:"currency,omitempty"` + EnableInstallment bool `schema:"enableInstallment,omitempty"` + EnableForeignCard bool `schema:"enableForeignCard,omitempty"` + BankName string `schema:"bankName,omitempty"` + Page int64 `schema:"page,omitempty"` + Size int64 `schema:"size,omitempty"` +} + +type CreateMerchantPosCommissionRequest struct { + Commissions []CreateMerchantPosCommission `json:"commissions"` +} + +type InitJuzdanPaymentRequest struct { + Price float64 `json:"price,omitempty"` + PaidPrice float64 `json:"paidPrice,omitempty"` + Currency Currency `json:"currency,omitempty"` + PaymentGroup PaymentGroup `json:"paymentGroup,omitempty"` + ConversationId string `json:"conversationId,omitempty"` + ExternalId string `json:"externalId,omitempty"` + CallbackUrl string `json:"callbackUrl,omitempty"` + PaymentPhase PaymentPhase `json:"paymentPhase,omitempty"` + PaymentChannel string `json:"paymentChannel,omitempty"` + BuyerMemberId int64 `json:"buyerMemberId,omitempty"` + BankOrderId string `json:"bankOrderId,omitempty"` + Items []PaymentItem `json:"items"` + ClientType ClientType `json:"clientType,omitempty"` + LoanCampaignId int64 `json:"loanCampaignId,omitempty"` +} + +type InitJuzdanPaymentResponse struct { + ReferenceId string `json:"referenceId"` + JuzdanQrUrl string `json:"juzdanQrUrl"` +} + type PaymentError ErrorResponse type Void struct { diff --git a/adapter/onboarding.go b/adapter/onboarding.go index 51a8d73..39a1a3a 100644 --- a/adapter/onboarding.go +++ b/adapter/onboarding.go @@ -69,3 +69,18 @@ func (api *Onboarding) SearchMembers(ctx context.Context, request SearchMembersR return response.Data, nil } + +func (api *Onboarding) CreateMerchant(ctx context.Context, request CreateMerchantRequest) (*CreateMerchantResponse, error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "/onboarding/v1/merchants", request) + + if err != nil { + return nil, err + } + + response := &Response[CreateMerchantResponse]{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return nil, err + } + return response.Data, nil +} diff --git a/adapter/payment.go b/adapter/payment.go index f26b40e..8040c97 100644 --- a/adapter/payment.go +++ b/adapter/payment.go @@ -210,6 +210,40 @@ func (api *Payment) CompleteApmPayment(ctx context.Context, request CompleteApmP return response.Data, nil } +func (api *Payment) InitPosApmPayment(ctx context.Context, request InitPosApmPaymentRequest) (*InitPosApmPaymentResponse, error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "/payment/v1/pos-apm-payments/init", request) + + if err != nil { + return nil, err + } + + response := &Response[InitPosApmPaymentResponse]{} + err = api.Client.Do(ctx, newRequest, response) + + if err != nil { + return nil, err + } + + return response.Data, nil +} + +func (api *Payment) CompletePosApmPayment(ctx context.Context, request CompletePosApmPaymentRequest) (*CompletePosApmPaymentResponse, error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "/payment/v1/pos-apm-payments/complete", request) + + if err != nil { + return nil, err + } + + response := &Response[CompletePosApmPaymentResponse]{} + err = api.Client.Do(ctx, newRequest, response) + + if err != nil { + return nil, err + } + + return response.Data, nil +} + func (api *Payment) Init3DSDepositPayment(ctx context.Context, request DepositPaymentRequest) (*Init3DSPaymentResponse, error) { newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "/payment/v1/deposits/3ds-init", request) @@ -474,6 +508,65 @@ func (api *Payment) DisapprovePaymentTransactions(ctx context.Context, request P return response.Data, nil } +func (api *Payment) RetrieveBnplOffers(ctx context.Context, request BnplPaymentOfferRequest) (*DataResponse[BnplPaymentOfferResponse], error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "/payment/v1/bnpl-payments/offers", request) + if err != nil { + return nil, err + } + + response := &Response[DataResponse[BnplPaymentOfferResponse]]{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return nil, err + } + + return response.Data, nil +} + +func (api *Payment) InitBnplPayment(ctx context.Context, request InitBnplPaymentRequest) (*InitBnplPaymentResponse, error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, "/payment/v1/bnpl-payments/init", request) + if err != nil { + return nil, err + } + response := &Response[InitBnplPaymentResponse]{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return nil, err + } + + return response.Data, nil +} + +func (api *Payment) ApproveBnplPayment(ctx context.Context, paymentId int64) error { + + newRequest, err := api.Client.NewRequest(ctx, http.MethodPost, fmt.Sprintf("/payment/v1/bnpl-payments/%d/approve", paymentId), nil) + if err != nil { + return err + } + + response := &Void{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return err + } + + return nil +} + +func (api *Payment) RetrieveActiveBanks(ctx context.Context) (*InstantTransferBanksResponse, error) { + newRequest, err := api.Client.NewRequest(ctx, http.MethodGet, "/payment/v1/instant-transfer-banks", nil) + if err != nil { + return nil, err + } + response := &Response[InstantTransferBanksResponse]{} + err = api.Client.Do(ctx, newRequest, response) + if err != nil { + return nil, err + } + + 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 { diff --git a/adapter/settlement_reporting.go b/adapter/settlement_reporting.go index 14b270c..5218f29 100644 --- a/adapter/settlement_reporting.go +++ b/adapter/settlement_reporting.go @@ -11,7 +11,7 @@ type SettlementReporting struct { } func (api *SettlementReporting) SearchPayoutCompletedTransactions(ctx context.Context, request SearchPayoutCompletedTransactionsRequest) (*DataResponse[SearchPayoutCompletedTransactionsResponse], error) { - newRequest, err := api.Client.NewRequest(ctx, http.MethodGet, "/settlement-reporting/v1/settlement-file/payout-completed-transactions", request) + newRequest, err := api.Client.NewRequest(ctx, http.MethodGet, "/settlement-reporting/v2/settlement-file/payout-completed-transactions", request) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index a46e93a..969e57f 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ module github.com/craftgate/craftgate-go-client -go 1.19 +go 1.21 require ( github.com/davecgh/go-spew v1.1.1 - github.com/gorilla/schema v1.2.0 - github.com/stretchr/testify v1.8.4 + github.com/gorilla/schema v1.2.1 + github.com/stretchr/testify v1.9.0 ) require ( diff --git a/go.sum b/go.sum index 0e93920..e84444b 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,11 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc= -github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU= +github.com/gorilla/schema v1.2.1 h1:tjDxcmdb+siIqkTNoV+qRH2mjYdr2hHe5MKXbp61ziM= +github.com/gorilla/schema v1.2.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/main_test.go b/main_test.go index 88fe110..dd41479 100644 --- a/main_test.go +++ b/main_test.go @@ -25,7 +25,7 @@ func Test_main(t *testing.T) { binNumber, err := client.Installment.RetrieveBinNumber(context.Background(), "487074") require.NotNil(t, err) require.Nil(t, binNumber) - assert.Equal(t, true, strings.Contains(err.Error(), "API credential not found!")) + assert.Equal(t, true, strings.Contains(err.Error(), "API credential not found")) }) }) } diff --git a/tests/bank_account_tracking_test.go b/tests/bank_account_tracking_test.go new file mode 100644 index 0000000..841f9f9 --- /dev/null +++ b/tests/bank_account_tracking_test.go @@ -0,0 +1,35 @@ +package tests + +import ( + "context" + "github.com/craftgate/craftgate-go-client/adapter" + craftgate "github.com/craftgate/craftgate-go-client/adapter" + "github.com/davecgh/go-spew/spew" + "testing" +) + +var bankAccountTrackingClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io") + +func TestBankAccountTracking_SearchBankAccountTrackingRecords(t *testing.T) { + request := adapter.SearchBankAccountTrackingRecordRequest{ + Page: 0, + Size: 10, + Currency: craftgate.Currency_TRY, + } + + res, err := bankAccountTrackingClient.BankAccountTracking.SearchRecords(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func TestBankAccountTracking_RetrieveRecord(t *testing.T) { + res, err := bankAccountTrackingClient.BankAccountTracking.RetrieveRecords(context.Background(), 1) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} diff --git a/tests/file_reporting_test.go b/tests/file_reporting_test.go index 5b4c084..d379169 100644 --- a/tests/file_reporting_test.go +++ b/tests/file_reporting_test.go @@ -1,26 +1,26 @@ package tests import ( - "context" - "github.com/craftgate/craftgate-go-client/adapter" - craftgate "github.com/craftgate/craftgate-go-client/adapter" - "github.com/davecgh/go-spew/spew" - "testing" - "time" + "context" + "github.com/craftgate/craftgate-go-client/adapter" + craftgate "github.com/craftgate/craftgate-go-client/adapter" + "github.com/davecgh/go-spew/spew" + "testing" + "time" ) var fileReportingClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io") func TestFileReporting_RetrieveDailyTransactionReport(t *testing.T) { - request := adapter.RetrieveDailyTransactionReportRequest{ - ReportDate: craftgate.DateOf(time.Date(2022, 11, 11, 0, 0, 0, 0, time.UTC)), - FileType: craftgate.CSV, - } + request := adapter.RetrieveDailyTransactionReportRequest{ + ReportDate: craftgate.DateOf(time.Date(2022, 11, 11, 0, 0, 0, 0, time.UTC)), + FileType: craftgate.ReportFileType_CSV, + } - res, err := fileReportingClient.FileReporting.RetrieveDailyTransactionReport(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) + res, err := fileReportingClient.FileReporting.RetrieveDailyTransactionReport(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } diff --git a/tests/fraud_test.go b/tests/fraud_test.go index 7145138..8f62811 100644 --- a/tests/fraud_test.go +++ b/tests/fraud_test.go @@ -1,78 +1,110 @@ package tests import ( - "context" - "github.com/craftgate/craftgate-go-client/adapter" - craftgate "github.com/craftgate/craftgate-go-client/adapter" - "github.com/davecgh/go-spew/spew" - "testing" + "context" + "github.com/craftgate/craftgate-go-client/adapter" + craftgate "github.com/craftgate/craftgate-go-client/adapter" + "github.com/davecgh/go-spew/spew" + "testing" ) var fraudClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io") func Test_SearchFraudChecks(t *testing.T) { - request := adapter.SearchFraudChecksRequest{ - Page: 0, Size: 10, - } + request := adapter.SearchFraudChecksRequest{ + Page: 0, Size: 10, + } - res, err := fraudClient.Fraud.SearchFraudChecks(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) + res, err := fraudClient.Fraud.SearchFraudChecks(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func Test_RetrieveAllFraudValueList(t *testing.T) { - res, err := fraudClient.Fraud.RetrieveAllFraudValueList(context.Background()) - _, _ = spew.Printf("%#v\n", res) + res, err := fraudClient.Fraud.RetrieveAllFraudValueList(context.Background()) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func Test_RetrieveFraudValueList(t *testing.T) { - res, err := fraudClient.Fraud.RetrieveFraudValueList(context.Background(), "blockedBuyerIdList") - _, _ = spew.Printf("%#v\n", res) + res, err := fraudClient.Fraud.RetrieveFraudValueList(context.Background(), "blockedBuyerIdList") + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func Test_CreateFraudValueList(t *testing.T) { - err := fraudClient.Fraud.CreateFraudValueList(context.Background(), "myTestList") + err := fraudClient.Fraud.CreateFraudValueList(context.Background(), "ipList", craftgate.FraudValueType_IP) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func Test_DeleteFraudValueList(t *testing.T) { - err := fraudClient.Fraud.DeleteFraudValueList(context.Background(), "myTestList") + err := fraudClient.Fraud.DeleteFraudValueList(context.Background(), "myTestList") - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func Test_AddValueToFraudValueList(t *testing.T) { - request := adapter.FraudValueListRequest{ - ListName: "ipList", - Value: "999.999.999.999", - } - err := fraudClient.Fraud.AddValueToFraudValueList(context.Background(), request) - - if err != nil { - t.Errorf("Error %s", err) - } + request := adapter.FraudValueListRequest{ + ListName: "ipList", + Type: craftgate.FraudValueType_IP, + Label: "local ip 1", + Value: "127.0.0.1", + } + err := fraudClient.Fraud.AddValueToFraudValueList(context.Background(), request) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func Test_AddTemporaryValueToFraudValueList(t *testing.T) { + request := adapter.FraudValueListRequest{ + ListName: "ipList", + Type: craftgate.FraudValueType_IP, + Label: "local ip 2", + Value: "127.0.0.2", + DurationInSeconds: 60, + } + + err := fraudClient.Fraud.AddValueToFraudValueList(context.Background(), request) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func Test_AddCardFingerprintToFraudValueList(t *testing.T) { + request := adapter.FraudValueListRequest{ + ListName: "cardList", + Type: craftgate.FraudValueType_CARD, + Label: "John Doe's Card", + PaymentId: 11675, + } + err := fraudClient.Fraud.AddValueToFraudValueList(context.Background(), request) + + if err != nil { + t.Errorf("Error %s", err) + } } func Test_RemoveValueFromFraudValueList(t *testing.T) { - err := fraudClient.Fraud.RemoveValueFromFraudValueList(context.Background(), "ipList", "999.999.999.999") + err := fraudClient.Fraud.RemoveValueFromFraudValueList(context.Background(), "ipList", "7aac0ad8-d170-4c2b-89d3-440fcf145b35") - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } diff --git a/tests/hook_test.go b/tests/hook_test.go index 13f7f64..f36ddea 100644 --- a/tests/hook_test.go +++ b/tests/hook_test.go @@ -12,9 +12,9 @@ func TestHook_VerifyWebhook(t *testing.T) { merchantHookKey := "Aoh7tReTybO6wOjBmOJFFsOR53SBojEp" incomingSignature := "0wRB5XqWJxwwPbn5Z9TcbHh8EGYFufSYTsRMB74N094=" webhookData := craftgate.WebhookData{ - EventType: craftgate.API_VERIFY_AND_AUTH, + EventType: craftgate.WebhookEventType_API_VERIFY_AND_AUTH, EventTimestamp: 1661521221, - Status: craftgate.WebhookStatusSUCCESS, + Status: craftgate.WebhookStatus_SUCCESS, PayloadId: "584", } @@ -27,9 +27,9 @@ func TestHook_NotVerifyWebhook(t *testing.T) { merchantHookKey := "Aoh7tReTybO6wOjBmOJFFsOR53SBojEp" incomingSignature := "Bsa498wcnaasd4bhx8anxıxcsdnxanalkdjcahxhd" webhookData := craftgate.WebhookData{ - EventType: craftgate.API_VERIFY_AND_AUTH, + EventType: craftgate.WebhookEventType_API_VERIFY_AND_AUTH, EventTimestamp: 1661521221, - Status: craftgate.WebhookStatusSUCCESS, + Status: craftgate.WebhookStatus_SUCCESS, PayloadId: "584", } diff --git a/tests/installment_test.go b/tests/installment_test.go index 22f8d44..5d8f168 100644 --- a/tests/installment_test.go +++ b/tests/installment_test.go @@ -23,7 +23,7 @@ func Test_SearchInstallments(t *testing.T) { request := adapter.SearchInstallmentsRequest{ BinNumber: "487074", Price: 100, - Currency: craftgate.TRY, + Currency: craftgate.Currency_TRY, } res, err := installmentClient.Installment.SearchInstallments(context.Background(), request) diff --git a/tests/instant_transfer_payment_test.go b/tests/instant_transfer_payment_test.go new file mode 100644 index 0000000..ee30319 --- /dev/null +++ b/tests/instant_transfer_payment_test.go @@ -0,0 +1,53 @@ +package tests + +import ( + "context" + "testing" + + "github.com/craftgate/craftgate-go-client/adapter" + craftgate "github.com/craftgate/craftgate-go-client/adapter" + "github.com/davecgh/go-spew/spew" + "github.com/stretchr/testify/require" +) + +var instantTransferPaymentClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io") + +func TestRetrieveActiveBanks(t *testing.T) { + res, err := instantTransferPaymentClient.Payment.RetrieveActiveBanks(context.Background()) + require.NotEmpty(t, res.Items) + if err != nil { + t.Errorf("Error %s", err) + } +} + +func TestInitInstantTransferAPMPayment(t *testing.T) { + additionalParams := make(map[string]string) + additionalParams["bankCode"] = "0" + + request := adapter.InitApmPaymentRequest{ + ApmType: craftgate.ApmType_INSTANT_TRANSFER, + Price: 1, + PaidPrice: 1, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, + ConversationId: "foo-bar", + CallbackUrl: "https://www.your-website.com/callback", + Items: []craftgate.PaymentItem{ + { + Name: "Item 1", + Price: 0.6, + }, + { + Name: "Item 2", + Price: 0.4, + }, + }, + AdditionalParams: additionalParams, + } + res, err := instantTransferPaymentClient.Payment.InitApmPayment(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} diff --git a/tests/juzdan_test.go b/tests/juzdan_test.go new file mode 100644 index 0000000..b9eea22 --- /dev/null +++ b/tests/juzdan_test.go @@ -0,0 +1,58 @@ +package tests + +import ( + "context" + "github.com/craftgate/craftgate-go-client/adapter" + craftgate "github.com/craftgate/craftgate-go-client/adapter" + "github.com/stretchr/testify/require" + "github.com/davecgh/go-spew/spew" + "testing" +) + +var juzdanClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io") + +func Test_InitJuzdanPayment(t *testing.T) { + request := adapter.InitJuzdanPaymentRequest{ + Price: 1.25, + PaidPrice: 1.25, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, + ConversationId: "foo-bar", + ExternalId: "115", + CallbackUrl: "www.test.com", + PaymentPhase: craftgate.PaymentPhase_AUTH, + PaymentChannel: "test", + BankOrderId: "test", + Items: []craftgate.PaymentItem{ + { + Name: "Item 1", + Price: 1, + ExternalId: "1", + }, + { + Name: "Item 2", + Price: 0.25, + ExternalId: "2", + }, + }, + ClientType: craftgate.ClientType_W, + LoanCampaignId: 1, + } + + res, err := juzdanClient.Juzdan.InitJuzdanPayment(context.Background(), request) + + require.NotNil(t, res.JuzdanQrUrl) + require.NotNil(t, res.ReferenceId) + if err != nil { + t.Errorf("Error %s", err) + } +} + +func Test_RetrieveJuzdanPayment(t *testing.T) { + res, err := juzdanClient.Juzdan.RetrieveJuzdanPayment(context.Background(), "test-reference-id") + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} diff --git a/tests/masterpass_test.go b/tests/masterpass_test.go index 58c1c34..ac9db9e 100644 --- a/tests/masterpass_test.go +++ b/tests/masterpass_test.go @@ -1,103 +1,103 @@ package tests import ( - "context" - "github.com/craftgate/craftgate-go-client/adapter" - craftgate "github.com/craftgate/craftgate-go-client/adapter" - "github.com/davecgh/go-spew/spew" - "github.com/stretchr/testify/require" - "testing" + "context" + "github.com/craftgate/craftgate-go-client/adapter" + craftgate "github.com/craftgate/craftgate-go-client/adapter" + "github.com/davecgh/go-spew/spew" + "github.com/stretchr/testify/require" + "testing" ) var masterpassClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io") func TestMasterpass_CheckMasterpassUser(t *testing.T) { - request := adapter.CheckMasterpassUserRequest{ - MasterpassGsmNumber: "903000000000", - } - res, err := masterpassClient.Masterpass.CheckMasterpassUser(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) - - if err != nil { - t.Errorf("Error %s", err) - } + request := adapter.CheckMasterpassUserRequest{ + MasterpassGsmNumber: "903000000000", + } + res, err := masterpassClient.Masterpass.CheckMasterpassUser(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } } func TestMasterpass_GenerateMasterpassPaymentToken(t *testing.T) { - request := adapter.MasterpassPaymentTokenGenerateRequest{ - UserId: "masterpass-user-id", - Msisdn: "900000000000", - BinNumber: "404308", - ForceThreeDS: true, - CreatePayment: craftgate.MasterpassCreatePayment{ - Price: 1.25, - PaidPrice: 1.25, - Installment: 1, - Currency: craftgate.TRY, - PaymentGroup: craftgate.LISTING_OR_SUBSCRIPTION, - ConversationId: "foo-bar", - ExternalId: "115", - Items: []craftgate.PaymentItem{ - { - Name: "Item 1", - Price: 1, - ExternalId: "1", - }, - { - Name: "Item 2", - Price: 0.25, - ExternalId: "2", - }, - }, - }, - } - - res, err := masterpassClient.Masterpass.GenerateMasterpassPaymentToken(context.Background(), request) - - require.NotNil(t, res.Token) - require.NotNil(t, res.ReferenceId) - if err != nil { - t.Errorf("Error %s", err) - } + request := adapter.MasterpassPaymentTokenGenerateRequest{ + UserId: "masterpass-user-id", + Msisdn: "900000000000", + BinNumber: "404308", + ForceThreeDS: true, + CreatePayment: craftgate.MasterpassCreatePayment{ + Price: 1.25, + PaidPrice: 1.25, + Installment: 1, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, + ConversationId: "foo-bar", + ExternalId: "115", + Items: []craftgate.PaymentItem{ + { + Name: "Item 1", + Price: 1, + ExternalId: "1", + }, + { + Name: "Item 2", + Price: 0.25, + ExternalId: "2", + }, + }, + }, + } + + res, err := masterpassClient.Masterpass.GenerateMasterpassPaymentToken(context.Background(), request) + + require.NotNil(t, res.Token) + require.NotNil(t, res.ReferenceId) + if err != nil { + t.Errorf("Error %s", err) + } } func TestMasterpass_CompleteMasterpassPayment(t *testing.T) { - request := adapter.MasterpassPaymentCompleteRequest{ - ReferenceId: "referenceId", - Token: "token", - } + request := adapter.MasterpassPaymentCompleteRequest{ + ReferenceId: "referenceId", + Token: "token", + } - res, err := masterpassClient.Masterpass.CompleteMasterpassPayment(context.Background(), request) + res, err := masterpassClient.Masterpass.CompleteMasterpassPayment(context.Background(), request) - require.NotNil(t, res.Id) - if err != nil { - t.Errorf("Error %s", err) - } + require.NotNil(t, res.Id) + if err != nil { + t.Errorf("Error %s", err) + } } func TestMasterpass_Init3DSMasterpassPayment(t *testing.T) { - request := adapter.MasterpassPaymentThreeDSInitRequest{ - ReferenceId: "referenceId", - CallbackUrl: "https://www.your-website.com/craftgate-3DSecure-callback", - } + request := adapter.MasterpassPaymentThreeDSInitRequest{ + ReferenceId: "referenceId", + CallbackUrl: "https://www.your-website.com/craftgate-3DSecure-callback", + } - res, err := masterpassClient.Masterpass.Init3DSMasterpassPayment(context.Background(), request) + res, err := masterpassClient.Masterpass.Init3DSMasterpassPayment(context.Background(), request) - require.NotNil(t, res.ReturnUrl) - if err != nil { - t.Errorf("Error %s", err) - } + require.NotNil(t, res.ReturnUrl) + if err != nil { + t.Errorf("Error %s", err) + } } func TestMasterpass_Complete3DSMasterpassPayment(t *testing.T) { - request := adapter.MasterpassPaymentThreeDSCompleteRequest{ - PaymentId: 1, - } + request := adapter.MasterpassPaymentThreeDSCompleteRequest{ + PaymentId: 1, + } - res, err := masterpassClient.Masterpass.Complete3DSMasterpassPayment(context.Background(), request) + res, err := masterpassClient.Masterpass.Complete3DSMasterpassPayment(context.Background(), request) - require.NotNil(t, res.Id) - if err != nil { - t.Errorf("Error %s", err) - } + require.NotNil(t, res.Id) + if err != nil { + t.Errorf("Error %s", err) + } } diff --git a/tests/merchant_test.go b/tests/merchant_test.go new file mode 100644 index 0000000..534288e --- /dev/null +++ b/tests/merchant_test.go @@ -0,0 +1,128 @@ +package tests + +import ( + "context" + "github.com/craftgate/craftgate-go-client/adapter" + craftgate "github.com/craftgate/craftgate-go-client/adapter" + "github.com/davecgh/go-spew/spew" + "testing" +) + +var merchantClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io") + +func Test_CreateMerchantPos(t *testing.T) { + request := adapter.CreateMerchantPosRequest{ + Name: "my test pos", + ClientId: "client id", + TerminalId: "terminal id", + ThreedsKey: "3d secure key", + Status: craftgate.PosStatus_AUTOPILOT, + Currency: craftgate.Currency_TRY, + OrderNumber: 1, + EnableInstallment: true, + EnableForeignCard: true, + EnablePaymentWithoutCvc: true, + PosIntegrator: craftgate.PosIntegrator_AKBANK, + EnabledPaymentAuthenticationTypes: []craftgate.PaymentAuthenticationType{ + craftgate.PaymentAuthenticationType_NON_THREE_DS, + craftgate.PaymentAuthenticationType_NON_THREE_DS, + }, + MerchantPosUsers: []craftgate.CreateMerchantPosUser{ + { + PosOperationType: craftgate.PosOperationType_STANDARD, + PosUserType: craftgate.PosUserType_API, + PosUsername: "username", + PosPassword: "password", + }, + }, + } + + res, err := merchantClient.Merchant.CreateMerchantPos(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func Test_RetrieveMerchantPos(t *testing.T) { + res, err := merchantClient.Merchant.RetrieveMerchantPos(context.Background(), 1) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func Test_UpdateMerchantPosStatus(t *testing.T) { + err := merchantClient.Merchant.UpdateMerchantPosStatus(context.Background(), 1, craftgate.PosStatus_ACTIVE) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func Test_DeleteMerchantPosStatus(t *testing.T) { + err := merchantClient.Merchant.DeleteMerchantPosStatus(context.Background(), 1) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func Test_RetrieveMerchantPosCommission(t *testing.T) { + res, err := merchantClient.Merchant.RetrieveMerchantPosCommissions(context.Background(), 14) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func Test_UpdateMerchantPosCommissions(t *testing.T) { + req := adapter.CreateMerchantPosCommissionRequest{ + Commissions: []craftgate.CreateMerchantPosCommission{ + { + Installment: 1, + BlockageDay: 7, + Status: craftgate.Status_ACTIVE, + CardBrandName: craftgate.CardBrand_AXESS, + InstallmentLabel: "Single installment", + BankOnUsDebitCardCommissionRate: 1.0, + BankOnUsCreditCardCommissionRate: 1.1, + BankNotOnUsDebitCardCommissionRate: 1.2, + BankNotOnUsCreditCardCommissionRate: 1.3, + BankForeignCardCommissionRate: 1.5, + }, + { + Installment: 2, + BlockageDay: 7, + Status: craftgate.Status_ACTIVE, + CardBrandName: craftgate.CardBrand_AXESS, + InstallmentLabel: "installment 2", + BankOnUsCreditCardCommissionRate: 2.1, + MerchantCommissionRate: 2.3, + }, + }, + } + res, err := merchantClient.Merchant.UpdateMerchantPosCommissions(context.Background(), 14, req) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func Test_SearchMerchantPos(t *testing.T) { + req := adapter.SearchMerchantPosRequest{ + Page: 0, + Size: 10, + Currency: adapter.Currency_TRY, + } + res, err := merchantClient.Merchant.SearchMerchantPos(context.Background(), req) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} diff --git a/tests/onboarding_test.go b/tests/onboarding_test.go index 8f54f23..e1bde82 100644 --- a/tests/onboarding_test.go +++ b/tests/onboarding_test.go @@ -44,7 +44,7 @@ func Test_CreateSubMerchantMember(t *testing.T) { IdentityNumber: "11111111110", LegalCompanyTitle: "Dem Zeytinyağı Üretim Ltd. Şti.", Name: "Dem Zeytinyağı Üretim Ltd. Şti.", - MemberType: craftgate.LIMITED_OR_JOINT_STOCK_COMPANY, + MemberType: craftgate.MemberType_LIMITED_OR_JOINT_STOCK_COMPANY, TaxNumber: "1111111114", TaxOffice: "Erenköy", Address: "Suadiye Mah. Örnek Cd. No:23, 34740 Kadıköy/İstanbul", @@ -71,7 +71,7 @@ func Test_CreateBuyerAndSubMerchantMember(t *testing.T) { IdentityNumber: "11111111110", LegalCompanyTitle: "Dem Zeytinyağı Üretim Ltd. Şti.", Name: "Dem Zeytinyağı Üretim Ltd. Şti.", - MemberType: craftgate.LIMITED_OR_JOINT_STOCK_COMPANY, + MemberType: craftgate.MemberType_LIMITED_OR_JOINT_STOCK_COMPANY, TaxNumber: "1111111114", TaxOffice: "Erenköy", Address: "Suadiye Mah. Örnek Cd. No:23, 34740 Kadıköy/İstanbul", @@ -97,8 +97,8 @@ func Test_UpdateSubMerchantMember(t *testing.T) { IdentityNumber: "11111111110", LegalCompanyTitle: "Dem Zeytinyağı Üretim Ltd. Şti.", Name: "Dem Zeytinyağı Üretim Ltd. Şti.", - MemberType: craftgate.LIMITED_OR_JOINT_STOCK_COMPANY, - SettlementEarningsDestination: craftgate.SettlementEarningsDestinationWALLET, + MemberType: craftgate.MemberType_LIMITED_OR_JOINT_STOCK_COMPANY, + SettlementEarningsDestination: craftgate.SettlementEarningsDestination_WALLET, TaxNumber: "1111111114", TaxOffice: "Erenköy", Address: "Suadiye Mah. Örnek Cd. No:23, 34740 Kadıköy/İstanbul", @@ -124,7 +124,7 @@ func Test_UpdateBuyerMember(t *testing.T) { IdentityNumber: "11111111110", LegalCompanyTitle: "Dem Zeytinyağı Üretim Ltd. Şti.", Name: "Dem Zeytinyağı Üretim Ltd. Şti.", - MemberType: craftgate.PERSONAL, + MemberType: craftgate.MemberType_PERSONAL, TaxNumber: "1111111114", TaxOffice: "Erenköy", Address: "Suadiye Mah. Örnek Cd. No:23, 34740 Kadıköy/İstanbul", @@ -163,3 +163,22 @@ func Test_SearchMembers(t *testing.T) { t.Errorf("Error %s", err) } } + +func Test_CreateMerchant(t *testing.T) { + request := adapter.CreateMerchantRequest{ + Name: "newMerchant", + LegalCompanyTitle: "legalCompanyTitle", + Email: "new_merchant@merchant.com", + Website: "www.merchant.com", + ContactName: "newName", + ContactSurname: "newSurname", + ContactPhoneNumber: "905555555566", + } + + res, err := onboardingClient.Onboarding.CreateMerchant(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} diff --git a/tests/pay_by_link_test.go b/tests/pay_by_link_test.go index bc3f681..7b84d89 100644 --- a/tests/pay_by_link_test.go +++ b/tests/pay_by_link_test.go @@ -1,78 +1,78 @@ package tests import ( - "context" - "github.com/craftgate/craftgate-go-client/adapter" - craftgate "github.com/craftgate/craftgate-go-client/adapter" - "github.com/davecgh/go-spew/spew" - "testing" + "context" + "github.com/craftgate/craftgate-go-client/adapter" + craftgate "github.com/craftgate/craftgate-go-client/adapter" + "github.com/davecgh/go-spew/spew" + "testing" ) var payByLinkClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io") func Test_CreateProduct(t *testing.T) { - request := adapter.CreateProductRequest{ - Name: "A new Product", - Channel: "API", - Price: 10, - Currency: craftgate.TRY, - EnabledInstallments: []int{1, 2, 3, 6}, - } + request := adapter.CreateProductRequest{ + Name: "A new Product", + Channel: "API", + Price: 10, + Currency: craftgate.Currency_TRY, + EnabledInstallments: []int{1, 2, 3, 6}, + } - res, err := payByLinkClient.PayByLink.CreateProduct(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) + res, err := payByLinkClient.PayByLink.CreateProduct(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func Test_UpdateProduct(t *testing.T) { - request := adapter.UpdateProductRequest{ - Name: "A new Product", - Status: craftgate.ACTIVE, - Channel: "API", - Price: 10, - Currency: craftgate.TRY, - EnabledInstallments: []int{1, 2, 3, 6, 9}, - } + request := adapter.UpdateProductRequest{ + Name: "A new Product", + Status: craftgate.Status_ACTIVE, + Channel: "API", + Price: 10, + Currency: craftgate.Currency_TRY, + EnabledInstallments: []int{1, 2, 3, 6, 9}, + } - res, err := payByLinkClient.PayByLink.UpdateProduct(context.Background(), 1, request) - _, _ = spew.Printf("%#v\n", res) + res, err := payByLinkClient.PayByLink.UpdateProduct(context.Background(), 1, request) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func Test_RetrieveProduct(t *testing.T) { - res, err := payByLinkClient.PayByLink.RetrieveProduct(context.Background(), 1) - _, _ = spew.Printf("%#v\n", res) + res, err := payByLinkClient.PayByLink.RetrieveProduct(context.Background(), 1) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func Test_DeleteProduct(t *testing.T) { - err := payByLinkClient.PayByLink.DeleteProduct(context.Background(), 1) + err := payByLinkClient.PayByLink.DeleteProduct(context.Background(), 1) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func Test_SearchProducts(t *testing.T) { - request := adapter.SearchProductsRequest{ - Page: 0, - Size: 10, - Currency: craftgate.TRY, - } + request := adapter.SearchProductsRequest{ + Page: 0, + Size: 10, + Currency: craftgate.Currency_TRY, + } - res, err := payByLinkClient.PayByLink.SearchProducts(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) + res, err := payByLinkClient.PayByLink.SearchProducts(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } diff --git a/tests/payment_reporting_test.go b/tests/payment_reporting_test.go index f7c7a51..c23e1d8 100644 --- a/tests/payment_reporting_test.go +++ b/tests/payment_reporting_test.go @@ -1,95 +1,95 @@ package tests import ( - "context" - "github.com/craftgate/craftgate-go-client/adapter" - craftgate "github.com/craftgate/craftgate-go-client/adapter" - "github.com/davecgh/go-spew/spew" - "testing" - "time" + "context" + "github.com/craftgate/craftgate-go-client/adapter" + craftgate "github.com/craftgate/craftgate-go-client/adapter" + "github.com/davecgh/go-spew/spew" + "testing" + "time" ) var paymentReportingClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io") func Test_SearchPayment(t *testing.T) { - request := adapter.SearchPaymentsRequest{ - Page: 0, Size: 10, - PaymentType: craftgate.CARD_PAYMENT, - PaymentStatus: craftgate.SUCCESS, - Currency: craftgate.TRY, - MinCreatedDate: time.Now().AddDate(0, 0, -180), - MaxCreatedDate: time.Now(), - } - res, err := paymentReportingClient.PaymentReporting.SearchPayments(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) - - if err != nil { - t.Errorf("Error %s", err) - } + request := adapter.SearchPaymentsRequest{ + Page: 0, Size: 10, + PaymentType: craftgate.PaymentType_CARD_PAYMENT, + PaymentStatus: craftgate.PaymentStatus_SUCCESS, + Currency: craftgate.Currency_TRY, + MinCreatedDate: time.Now().AddDate(0, 0, -180), + MaxCreatedDate: time.Now(), + } + res, err := paymentReportingClient.PaymentReporting.SearchPayments(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } } func Test_SearchPaymentRefunds(t *testing.T) { - request := adapter.SearchPaymentRefundsRequest{ - Page: 0, Size: 10, - Currency: craftgate.TRY, - MinCreatedDate: time.Now().AddDate(0, 0, -180), - MaxCreatedDate: time.Now(), - } - res, err := paymentReportingClient.PaymentReporting.SearchPaymentRefunds(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) - - if err != nil { - t.Errorf("Error %s", err) - } + request := adapter.SearchPaymentRefundsRequest{ + Page: 0, Size: 10, + Currency: craftgate.Currency_TRY, + MinCreatedDate: time.Now().AddDate(0, 0, -180), + MaxCreatedDate: time.Now(), + } + res, err := paymentReportingClient.PaymentReporting.SearchPaymentRefunds(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } } func Test_SearchPaymentTransactionRefunds(t *testing.T) { - request := adapter.SearchPaymentTransactionRefundsRequest{ - Page: 0, Size: 10, - Currency: craftgate.TRY, - MinCreatedDate: time.Now().AddDate(0, 0, -180), - MaxCreatedDate: time.Now(), - } - res, err := paymentReportingClient.PaymentReporting.SearchPaymentTransactionRefunds(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) - - if err != nil { - t.Errorf("Error %s", err) - } + request := adapter.SearchPaymentTransactionRefundsRequest{ + Page: 0, Size: 10, + Currency: craftgate.Currency_TRY, + MinCreatedDate: time.Now().AddDate(0, 0, -180), + MaxCreatedDate: time.Now(), + } + res, err := paymentReportingClient.PaymentReporting.SearchPaymentTransactionRefunds(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } } func Test_RetrievePayment(t *testing.T) { - res, err := paymentReportingClient.PaymentReporting.RetrievePayment(context.Background(), 123) - _, _ = spew.Printf("%#v\n", res) + res, err := paymentReportingClient.PaymentReporting.RetrievePayment(context.Background(), 123) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func Test_RetrievePaymentTransactions(t *testing.T) { - res, err := paymentReportingClient.PaymentReporting.RetrievePaymentTransactions(context.Background(), 123) - _, _ = spew.Printf("%#v\n", res) + res, err := paymentReportingClient.PaymentReporting.RetrievePaymentTransactions(context.Background(), 123) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func Test_RetrievePaymentRefunds(t *testing.T) { - res, err := paymentReportingClient.PaymentReporting.RetrievePaymentRefunds(context.Background(), 123) - _, _ = spew.Printf("%#v\n", res) + res, err := paymentReportingClient.PaymentReporting.RetrievePaymentRefunds(context.Background(), 123) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func Test_RetrievePaymentTransactionRefunds(t *testing.T) { - res, err := paymentReportingClient.PaymentReporting.RetrievePaymentTransactionRefunds(context.Background(), 123, 789) - _, _ = spew.Printf("%#v\n", res) + res, err := paymentReportingClient.PaymentReporting.RetrievePaymentTransactionRefunds(context.Background(), 123, 789) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } diff --git a/tests/payment_test.go b/tests/payment_test.go index 05c4225..bbbeab2 100644 --- a/tests/payment_test.go +++ b/tests/payment_test.go @@ -16,8 +16,8 @@ func TestPayment_CreatePayment(t *testing.T) { Price: 1.25, PaidPrice: 1.25, Installment: 1, - Currency: craftgate.TRY, - PaymentGroup: craftgate.LISTING_OR_SUBSCRIPTION, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, ConversationId: "foo-bar", ExternalId: "115", Card: &craftgate.Card{ @@ -51,11 +51,11 @@ func TestPayment_CreatePayment(t *testing.T) { func TestPayment_CreateApmPayment(t *testing.T) { request := adapter.CreateApmPaymentRequest{ - ApmType: craftgate.ApmTypeCASH_ON_DELIVERY, + ApmType: craftgate.ApmType_CASH_ON_DELIVERY, Price: 1.25, PaidPrice: 1.25, - Currency: craftgate.TRY, - PaymentGroup: craftgate.LISTING_OR_SUBSCRIPTION, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, ConversationId: "foo-bar", ExternalId: "115", Items: []craftgate.PaymentItem{ @@ -95,8 +95,8 @@ func TestPayment_Init3DSPayment(t *testing.T) { Price: 1.25, PaidPrice: 1.25, Installment: 1, - Currency: craftgate.TRY, - PaymentGroup: craftgate.LISTING_OR_SUBSCRIPTION, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, ConversationId: "foo-bar", ExternalId: "115", Card: &craftgate.Card{ @@ -147,9 +147,9 @@ func TestPayment_CreatePreAuthPayment(t *testing.T) { Price: 1.25, PaidPrice: 1.25, Installment: 1, - Currency: craftgate.TRY, - PaymentGroup: craftgate.LISTING_OR_SUBSCRIPTION, - PaymentPhase: craftgate.PRE_AUTH, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, + PaymentPhase: craftgate.PaymentPhase_PRE_AUTH, ConversationId: "foo-bar", ExternalId: "115", Card: &craftgate.Card{ @@ -197,9 +197,9 @@ func TestPayment_InitCheckoutPayment(t *testing.T) { request := adapter.InitCheckoutPaymentRequest{ Price: 1.25, PaidPrice: 1.25, - Currency: craftgate.TRY, - PaymentGroup: craftgate.LISTING_OR_SUBSCRIPTION, - PaymentPhase: craftgate.AUTH, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, + PaymentPhase: craftgate.PaymentPhase_AUTH, ConversationId: "foo-bar", ExternalId: "115", Items: []craftgate.PaymentItem{ @@ -313,9 +313,9 @@ func TestPayment_CreateFundTransferDepositPayment(t *testing.T) { func TestPayment_InitDepositApmPayment(t *testing.T) { request := adapter.InitApmDepositPaymentRequest{ - ApmType: craftgate.ApmTypePAPARA, + ApmType: craftgate.ApmType_PAPARA, Price: 1.25, - Currency: craftgate.TRY, + Currency: craftgate.Currency_TRY, BuyerMemberId: 1, ConversationId: "foo-bar", CallbackUrl: "https://www.your-website.com/callback", @@ -333,8 +333,8 @@ func TestPayment_InitGarantiPayPayment(t *testing.T) { request := adapter.InitGarantiPayPaymentRequest{ Price: 100, PaidPrice: 100, - Currency: craftgate.TRY, - PaymentGroup: craftgate.LISTING_OR_SUBSCRIPTION, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, ConversationId: "456d1297-908e-4bd6-a13b-4be31a6e47d5", CallbackUrl: "https://www.your-website.com/craftgate-garantipay-callback", Items: []craftgate.PaymentItem{ @@ -370,11 +370,11 @@ func TestPayment_InitGarantiPayPayment(t *testing.T) { func TestPayment_InitApmPayment(t *testing.T) { request := adapter.InitApmPaymentRequest{ - ApmType: craftgate.ApmTypeEDENRED, + ApmType: craftgate.ApmType_EDENRED, Price: 1.25, PaidPrice: 1.25, - Currency: craftgate.TRY, - PaymentGroup: craftgate.LISTING_OR_SUBSCRIPTION, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, ConversationId: "foo-bar", ApmUserIdentity: "4242424242424242", CallbackUrl: "https://www.your-website.com/callback", @@ -401,11 +401,11 @@ func TestPayment_InitApmPayment(t *testing.T) { func TestPayment_InitKlarnaApmPayment(t *testing.T) { request := adapter.InitApmPaymentRequest{ - ApmType: craftgate.ApmTypeKLARNA, + ApmType: craftgate.ApmType_KLARNA, Price: 1, PaidPrice: 1, - Currency: craftgate.USD, - PaymentGroup: craftgate.LISTING_OR_SUBSCRIPTION, + Currency: craftgate.Currency_USD, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, ConversationId: "foo-bar", CallbackUrl: "https://www.your-website.com/callback", Items: []craftgate.PaymentItem{ @@ -433,11 +433,11 @@ func TestPayment_InitKlarnaApmPayment(t *testing.T) { func TestPayment_InitAfterpayApmPayment(t *testing.T) { request := adapter.InitApmPaymentRequest{ - ApmType: craftgate.ApmTypeAFTERPAY, + ApmType: craftgate.ApmType_AFTERPAY, Price: 1, PaidPrice: 1, - Currency: craftgate.USD, - PaymentGroup: craftgate.LISTING_OR_SUBSCRIPTION, + Currency: craftgate.Currency_USD, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, ConversationId: "foo-bar", CallbackUrl: "https://www.your-website.com/callback", Items: []craftgate.PaymentItem{ @@ -461,11 +461,11 @@ func TestPayment_InitAfterpayApmPayment(t *testing.T) { func TestPayment_InitKaspiApmPayment(t *testing.T) { request := adapter.InitApmPaymentRequest{ - ApmType: craftgate.ApmTypeKASPI, + ApmType: craftgate.ApmType_KASPI, Price: 1, PaidPrice: 1, - Currency: craftgate.KZT, - PaymentGroup: craftgate.LISTING_OR_SUBSCRIPTION, + Currency: craftgate.Currency_KZT, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, ConversationId: "foo-bar", CallbackUrl: "https://www.your-website.com/callback", Items: []craftgate.PaymentItem{ @@ -487,6 +487,39 @@ func TestPayment_InitKaspiApmPayment(t *testing.T) { } } +func TestPayment_InitTompayApmPayment(t *testing.T) { + additionalParams := make(map[string]string) + additionalParams["phone"] = "phone" + additionalParams["channel"] = "channel" + + request := adapter.InitApmPaymentRequest{ + ApmType: craftgate.ApmType_TOMPAY, + Price: 1, + PaidPrice: 1, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, + ConversationId: "foo-bar", + CallbackUrl: "https://www.your-website.com/callback", + Items: []craftgate.PaymentItem{ + { + Name: "Item 1", + Price: 0.6, + }, + { + Name: "Item 2", + Price: 0.4, + }, + }, + AdditionalParams: additionalParams, + } + res, err := paymentClient.Payment.InitApmPayment(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} + func TestPayment_CompleteApmPayment(t *testing.T) { request := adapter.CompleteApmPaymentRequest{ PaymentId: 123, @@ -500,6 +533,84 @@ func TestPayment_CompleteApmPayment(t *testing.T) { } } +func TestPayment_InitYkbWorldPayPosApmPayment(t *testing.T) { + request := adapter.InitPosApmPaymentRequest{ + Price: 1.25, + PaidPrice: 1.25, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, + ConversationId: "foo-bar", + PaymentProvider: craftgate.PosApmPaymentProvider_YKB_WORLD_PAY, + CallbackUrl: "https://www.your-website.com/callback", + Items: []craftgate.PaymentItem{ + { + Name: "Item 1", + Price: 1, + ExternalId: "1", + }, + { + Name: "Item 2", + Price: 0.25, + ExternalId: "2", + }, + }, + AdditionalParams: map[string]string{ + "sourceCode": "WEB2QR", + }, + } + res, err := paymentClient.Payment.InitPosApmPayment(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func TestPayment_InitGarantiPayPosApmPayment(t *testing.T) { + request := adapter.InitPosApmPaymentRequest{ + Price: 1.25, + PaidPrice: 1.25, + Currency: craftgate.Currency_TRY, + PaymentGroup: craftgate.PaymentGroup_LISTING_OR_SUBSCRIPTION, + ConversationId: "foo-bar", + PaymentProvider: craftgate.PosApmPaymentProvider_GARANTI_PAY, + CallbackUrl: "https://www.your-website.com/callback", + Items: []craftgate.PaymentItem{ + { + Name: "Item 1", + Price: 1, + ExternalId: "1", + }, + { + Name: "Item 2", + Price: 0.25, + ExternalId: "2", + }, + }, + AdditionalParams: map[string]string{ + "integrationType": "WEB2APP", + }, + } + res, err := paymentClient.Payment.InitPosApmPayment(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func TestPayment_CompletePosApmPayment(t *testing.T) { + request := adapter.CompletePosApmPaymentRequest{ + PaymentId: 123, + } + res, err := paymentClient.Payment.CompletePosApmPayment(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} + func TestPayment_RetrieveLoyalties(t *testing.T) { request := adapter.RetrieveLoyaltiesRequest{ CardNumber: "4043080000000003", @@ -520,7 +631,7 @@ func TestPayment_RefundPaymentTransaction(t *testing.T) { PaymentTransactionId: 1, ConversationId: "456d1297-908e-4bd6-a13b-4be31a6e47d5", RefundPrice: 20, - RefundDestinationType: craftgate.RefundDestinationTypePROVIDER, + RefundDestinationType: craftgate.RefundDestinationType_PROVIDER, } res, err := paymentClient.Payment.RefundPaymentTransaction(context.Background(), request) @@ -543,7 +654,7 @@ func TestPayment_RetrievePaymentTransactionRefund(t *testing.T) { func TestPayment_RefundPayment(t *testing.T) { request := adapter.RefundPaymentRequest{ PaymentId: 1, - RefundDestinationType: craftgate.RefundDestinationTypePROVIDER, + RefundDestinationType: craftgate.RefundDestinationType_PROVIDER, } res, err := paymentClient.Payment.RefundPayment(context.Background(), request) _, _ = spew.Printf("%#v\n", res) @@ -610,8 +721,8 @@ func TestPayment_SearchStoredCards(t *testing.T) { CardAlias: "My YKB Card", CardBankName: "YAPI VE KREDI BANKASI A.S.", CardBrand: "World", - CardType: craftgate.CREDIT_CARD, - CardAssociation: craftgate.MASTER_CARD, + CardType: craftgate.CardType_CREDIT_CARD, + CardAssociation: craftgate.CardAssociation_MASTER_CARD, } res, err := paymentClient.Payment.SearchStoredCards(context.Background(), request) @@ -692,3 +803,136 @@ func TestPayment_NotVerify3DSCallback(t *testing.T) { require.False(t, is3DSecureCallbackVerified) } + +func TestPayment_BnplPaymentOffer(t *testing.T) { + request := adapter.BnplPaymentOfferRequest{ + ApmType: craftgate.ApmType_MASLAK, + Price: 10000, + Currency: craftgate.Currency_TRY, + Items: []craftgate.BnplPaymentCartItem{ + { + Id: "200", + Name: "Test Elektronik 2", + BrandName: "iphone", + Type: craftgate.BnplCartItemType_MOBILE_PHONE_PRICE_BELOW_REGULATION_LIMIT, + UnitPrice: 3000, + Quantity: 2, + }, + { + Id: "100", + Name: "Test Elektronik 1", + BrandName: "Samsung", + Type: craftgate.BnplCartItemType_OTHER, + UnitPrice: 4000, + Quantity: 1, + }, + }, + } + res, err := paymentClient.Payment.RetrieveBnplOffers(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func TestPayment_InitBnplPayment(t *testing.T) { + request := adapter.InitBnplPaymentRequest{ + ApmType: craftgate.ApmType_MASLAK, + Price: 10000, + PaidPrice: 10000, + PaymentType: craftgate.PaymentType_APM, + Currency: craftgate.Currency_TRY, + ApmOrderId: "order_id", + PaymentGroup: craftgate.PaymentGroup_PRODUCT, + ConversationId: "29393-mXld92ko3", + ExternalId: "external_id-345", + CallbackUrl: "callback", + BankCode: "103", + Items: []craftgate.PaymentItem{ + { + Name: "Item 1", + Price: 6000, + ExternalId: "38983903", + }, + { + Name: "Item 2", + Price: 4000, + ExternalId: "92983294", + }, + }, + CartItems: []craftgate.BnplPaymentCartItem{ + { + Id: "200", + Name: "Test Elektronik 2", + BrandName: "iphone", + Type: craftgate.BnplCartItemType_OTHER, + UnitPrice: 3000, + Quantity: 2, + }, + { + Id: "100", + Name: "Test Elektronik 1", + BrandName: "Samsung", + Type: craftgate.BnplCartItemType_MOBILE_PHONE_PRICE_ABOVE_REGULATION_LIMIT, + UnitPrice: 4000, + Quantity: 1, + }, + }, + } + res, err := paymentClient.Payment.InitBnplPayment(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func TestPayment_InitTomFinanceBnplPayment(t *testing.T) { + request := adapter.InitBnplPaymentRequest{ + ApmType: craftgate.ApmType_TOM_FINANCE, + Price: 100, + PaidPrice: 100, + PaymentType: craftgate.PaymentType_APM, + Currency: craftgate.Currency_TRY, + ApmOrderId: "myUniqueApmOrderId", + PaymentGroup: craftgate.PaymentGroup_PRODUCT, + ConversationId: "conversationId", + ExternalId: "externalId", + CallbackUrl: "https://www.your-website.com/callback", + Items: []craftgate.PaymentItem{ + { + Name: "Item 1", + Price: 100, + ExternalId: "externalId", + }, + }, + AdditionalParams: map[string]string{ + "buyerName": "John Doe", + "buyerPhoneNumber": "5554443322", + }, + CartItems: []craftgate.BnplPaymentCartItem{ + { + Id: "26020874", + Name: "Test Item 1", + BrandName: "26010303", + Type: craftgate.BnplCartItemType_OTHER, + UnitPrice: 100, + Quantity: 1, + }, + }, + } + res, err := paymentClient.Payment.InitBnplPayment(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err) + } +} + +func TestPayment_ApproveBnplPayment(t *testing.T) { + err := paymentClient.Payment.ApproveBnplPayment(context.Background(), 1) + if err != nil { + t.Errorf("Error %s", err) + } +} diff --git a/tests/settlement_reporting_test.go b/tests/settlement_reporting_test.go index 4b9bb52..ef651fd 100644 --- a/tests/settlement_reporting_test.go +++ b/tests/settlement_reporting_test.go @@ -15,6 +15,8 @@ func TestSettlementReporting_SearchPayoutCompletedTransactions(t *testing.T) { request := adapter.SearchPayoutCompletedTransactionsRequest{ StartDate: time.Now().AddDate(0, 0, -180), EndDate: time.Now(), + Page: 0, + Size: 10, } res, err := settlementReportingClient.SettlementReporting.SearchPayoutCompletedTransactions(context.Background(), request) @@ -50,7 +52,7 @@ func TestSettlementReporting_RetrievePayoutDetails(t *testing.T) { func TestSettlementReporting_SearchPayoutRows(t *testing.T) { request := adapter.SearchPayoutRowRequest{ - FileStatus: craftgate.FileStatusCREATED, + FileStatus: craftgate.FileStatus_CREATED, StartDate: time.Now().AddDate(0, 0, -180), EndDate: time.Now(), } diff --git a/tests/settlement_test.go b/tests/settlement_test.go index 9708ef0..5fe1c8b 100644 --- a/tests/settlement_test.go +++ b/tests/settlement_test.go @@ -23,10 +23,10 @@ func TestSettlement_CreateInstantWalletSettlement(t *testing.T) { func TestSettlement_CreateMerchantPayoutAccount(t *testing.T) { request := adapter.CreatePayoutAccountRequest{ - AccountType: craftgate.PayoutAccountTypeWISE, + AccountType: craftgate.PayoutAccountType_WISE, ExternalAccountId: "wiseRecipientId", - Currency: craftgate.USD, - AccountOwner: craftgate.AccountOwnerMERCHANT, + Currency: craftgate.Currency_USD, + AccountOwner: craftgate.AccountOwner_MERCHANT, } res, err := settlementClient.Settlement.CreatePayoutAccount(context.Background(), request) @@ -39,10 +39,10 @@ func TestSettlement_CreateMerchantPayoutAccount(t *testing.T) { func TestSettlement_CreateSubMerchantPayoutAccount(t *testing.T) { request := adapter.CreatePayoutAccountRequest{ - AccountType: craftgate.PayoutAccountTypeWISE, + AccountType: craftgate.PayoutAccountType_WISE, ExternalAccountId: "wiseRecipientId", - Currency: craftgate.EUR, - AccountOwner: craftgate.AccountOwnerSUB_MERCHANT_MEMBER, + Currency: craftgate.Currency_EUR, + AccountOwner: craftgate.AccountOwner_SUB_MERCHANT_MEMBER, SubMerchantMemberId: 1, } @@ -56,7 +56,7 @@ func TestSettlement_CreateSubMerchantPayoutAccount(t *testing.T) { func TestSettlement_UpdatePayoutAccount(t *testing.T) { request := adapter.UpdatePayoutAccountRequest{ - AccountType: craftgate.PayoutAccountTypeWISE, + AccountType: craftgate.PayoutAccountType_WISE, ExternalAccountId: "wiseRecipientId2", } @@ -77,8 +77,8 @@ func TestSettlement_DeletePayoutAccount(t *testing.T) { func TestSettlement_SearchPayoutAccounts(t *testing.T) { request := adapter.SearchPayoutAccountRequest{ - Currency: craftgate.USD, - AccountOwner: craftgate.AccountOwnerMERCHANT, + Currency: craftgate.Currency_USD, + AccountOwner: craftgate.AccountOwner_MERCHANT, } res, err := settlementClient.Settlement.SearchPayoutAccounts(context.Background(), request) diff --git a/tests/wallet_test.go b/tests/wallet_test.go index 1a1a9ba..270ec5e 100644 --- a/tests/wallet_test.go +++ b/tests/wallet_test.go @@ -1,194 +1,194 @@ package tests import ( - "context" - "github.com/craftgate/craftgate-go-client/adapter" - craftgate "github.com/craftgate/craftgate-go-client/adapter" - "github.com/davecgh/go-spew/spew" - "testing" - "time" + "context" + "github.com/craftgate/craftgate-go-client/adapter" + craftgate "github.com/craftgate/craftgate-go-client/adapter" + "github.com/davecgh/go-spew/spew" + "testing" + "time" ) var walletClient, _ = craftgate.New("api-key", "secret-key", "https://sandbox-api.craftgate.io") func TestWallet_RetrieveMemberWallet(t *testing.T) { - res, err := walletClient.Wallet.RetrieveMemberWallet(context.Background(), 1) - _, _ = spew.Printf("%#v\n", res) + res, err := walletClient.Wallet.RetrieveMemberWallet(context.Background(), 1) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func TestWallet_RetrieveMerchantMemberWallet(t *testing.T) { - res, err := walletClient.Wallet.RetrieveMerchantMemberWallet(context.Background()) - _, _ = spew.Printf("%#v\n", res) + res, err := walletClient.Wallet.RetrieveMerchantMemberWallet(context.Background()) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err) - } + if err != nil { + t.Errorf("Error %s", err) + } } func TestWallet_ResetMerchantMemberWalletBalance(t *testing.T) { - request := adapter.ResetMerchantMemberWalletBalanceRequest{WalletAmount: -10} - res, err := walletClient.Wallet.ResetMerchantMemberWalletBalance(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) + request := adapter.ResetMerchantMemberWalletBalanceRequest{WalletAmount: -10} + res, err := walletClient.Wallet.ResetMerchantMemberWalletBalance(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_SearchWalletTransactions(t *testing.T) { - request := adapter.SearchWalletTransactionsRequest{ - WalletTransactionTypes: []craftgate.WalletTransactionType{craftgate.DEPOSIT_FROM_CARD}, - } - res, err := walletClient.Wallet.SearchWalletTransactions(context.Background(), 1, request) - _, _ = spew.Printf("%#v\n", res) + request := adapter.SearchWalletTransactionsRequest{ + WalletTransactionTypes: []craftgate.WalletTransactionType{craftgate.WalletTransactionType_DEPOSIT_FROM_CARD}, + } + res, err := walletClient.Wallet.SearchWalletTransactions(context.Background(), 1, request) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_RetrieveRefundableAmountOfWalletTransaction(t *testing.T) { - res, err := walletClient.Wallet.RetrieveRefundableAmountOfWalletTransaction(context.Background(), 1) - _, _ = spew.Printf("%#v\n", res) + res, err := walletClient.Wallet.RetrieveRefundableAmountOfWalletTransaction(context.Background(), 1) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_RefundWalletTransaction(t *testing.T) { - request := adapter.RefundWalletTransactionRequest{RefundPrice: 10} - res, err := walletClient.Wallet.RefundWalletTransaction(context.Background(), 1, request) - _, _ = spew.Printf("%#v\n", res) + request := adapter.RefundWalletTransactionRequest{RefundPrice: 10} + res, err := walletClient.Wallet.RefundWalletTransaction(context.Background(), 1, request) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_RetrieveRefundWalletTransactions(t *testing.T) { - res, err := walletClient.Wallet.RetrieveRefundWalletTransactions(context.Background(), 1) - _, _ = spew.Printf("%#v\n", res) + res, err := walletClient.Wallet.RetrieveRefundWalletTransactions(context.Background(), 1) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_SendRemittance(t *testing.T) { - request := adapter.RemittanceRequest{ - Price: 100, - MemberId: 1, - Description: "bonus", - RemittanceReasonType: "REDEEM_ONLY_LOYALTY", - } - res, err := walletClient.Wallet.SendRemittance(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) + request := adapter.RemittanceRequest{ + Price: 100, + MemberId: 1, + Description: "bonus", + RemittanceReasonType: "REDEEM_ONLY_LOYALTY", + } + res, err := walletClient.Wallet.SendRemittance(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_ReceiveRemittance(t *testing.T) { - request := adapter.RemittanceRequest{ - Price: 10, - MemberId: 1, - Description: "bonus", - RemittanceReasonType: "REDEEM_ONLY_LOYALTY", - } - res, err := walletClient.Wallet.ReceiveRemittance(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) + request := adapter.RemittanceRequest{ + Price: 10, + MemberId: 1, + Description: "bonus", + RemittanceReasonType: "REDEEM_ONLY_LOYALTY", + } + res, err := walletClient.Wallet.ReceiveRemittance(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_RetrieveRemittance(t *testing.T) { - res, err := walletClient.Wallet.RetrieveRemittance(context.Background(), 1) - _, _ = spew.Printf("%#v\n", res) + res, err := walletClient.Wallet.RetrieveRemittance(context.Background(), 1) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_CreateWithdraw(t *testing.T) { - request := adapter.CreateWithdrawRequest{ - Price: 5, - MemberId: 1, - Description: "Para çekme talebi", - Currency: "TRY", - } - res, err := walletClient.Wallet.CreateWithdraw(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) + request := adapter.CreateWithdrawRequest{ + Price: 5, + MemberId: 1, + Description: "Para çekme talebi", + Currency: "TRY", + } + res, err := walletClient.Wallet.CreateWithdraw(context.Background(), request) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_CancelWithdraw(t *testing.T) { - res, err := walletClient.Wallet.CancelWithdraw(context.Background(), 1) - _, _ = spew.Printf("%#v\n", res) + res, err := walletClient.Wallet.CancelWithdraw(context.Background(), 1) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_RetrieveWithdraw(t *testing.T) { - res, err := walletClient.Wallet.RetrieveWithdraw(context.Background(), 1) - _, _ = spew.Printf("%#v\n", res) + res, err := walletClient.Wallet.RetrieveWithdraw(context.Background(), 1) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_SearchWithdraws(t *testing.T) { - request := adapter.SearchWithdrawsRequest{ - Currency: "TRY", - MinWithdrawPrice: 0, - MaxWithdrawPrice: 10000, - MinCreatedDate: time.Now().AddDate(0, 0, -180), - MaxCreatedDate: time.Now(), - } - res, err := walletClient.Wallet.SearchWithdraws(context.Background(), request) + request := adapter.SearchWithdrawsRequest{ + Currency: "TRY", + MinWithdrawPrice: 0, + MaxWithdrawPrice: 10000, + MinCreatedDate: time.Now().AddDate(0, 0, -180), + MaxCreatedDate: time.Now(), + } + res, err := walletClient.Wallet.SearchWithdraws(context.Background(), request) - _, _ = spew.Printf("%#v\n", res) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_CreateMemberWallet(t *testing.T) { - request := adapter.CreateMemberWalletRequest{ - NegativeAmountLimit: 0, - Currency: "TRY", - } - res, err := walletClient.Wallet.CreateMemberWallet(context.Background(), 1, request) - _, _ = spew.Printf("%#v\n", res) + request := adapter.CreateMemberWalletRequest{ + NegativeAmountLimit: 0, + Currency: "TRY", + } + res, err := walletClient.Wallet.CreateMemberWallet(context.Background(), 1, request) + _, _ = spew.Printf("%#v\n", res) - if err != nil { - t.Errorf("Error %s", err.Error()) - } + if err != nil { + t.Errorf("Error %s", err.Error()) + } } func TestWallet_UpdateMemberWallet(t *testing.T) { - request := adapter.UpdateMemberWalletRequest{ - NegativeAmountLimit: -10, - } - res, err := walletClient.Wallet.UpdateMemberWallet(context.Background(), 1, 1, request) - _, _ = spew.Printf("%#v\n", res) - - if err != nil { - t.Errorf("Error %s", err.Error()) - } + request := adapter.UpdateMemberWalletRequest{ + NegativeAmountLimit: -10, + } + res, err := walletClient.Wallet.UpdateMemberWallet(context.Background(), 1, 1, request) + _, _ = spew.Printf("%#v\n", res) + + if err != nil { + t.Errorf("Error %s", err.Error()) + } }