From c361a8950df96ff264a51d9fc5f5352c2fc575e5 Mon Sep 17 00:00:00 2001 From: Yalin Gunayer Date: Fri, 6 Oct 2023 17:23:44 +0300 Subject: [PATCH] Sync changes with craftgate-java-client 1.0.42 --- README.md | 2 +- lib/craftgate/adapter/payment_adapter.ex | 2 ++ lib/craftgate/model/apm_type.ex | 1 + lib/craftgate/model/payment_method.ex | 1 + lib/craftgate/model/payment_provider.ex | 1 + lib/craftgate/request/create_member_request.ex | 2 ++ lib/craftgate/request/init_checkout_payment_request.ex | 1 + lib/craftgate/request/update_member_request.ex | 1 + lib/craftgate/response/init_checkout_payment_response.ex | 3 ++- mix.exs | 2 +- test/craftgate_test/adapter/payment_adapter_test.exs | 8 ++++++++ 11 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1ef69e9..4e6f430 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Add the `:craftgate` dependency to your `mix.exs` file ```elixir def deps do ... - {:craftgate, "~> 1.0.41"} + {:craftgate, "~> 1.0.42"} ... end ``` diff --git a/lib/craftgate/adapter/payment_adapter.ex b/lib/craftgate/adapter/payment_adapter.ex index 1c6d440..bad478e 100644 --- a/lib/craftgate/adapter/payment_adapter.ex +++ b/lib/craftgate/adapter/payment_adapter.ex @@ -62,6 +62,8 @@ defmodule Craftgate.Adapter.PaymentAdapter do endpoint retrieve_checkout_payment(token: String.t()), get: "/payment/v1/checkout-payments/:token", return: PaymentResponse.t() + endpoint expire_checkout_payment(token: String.t()), delete: "/payment/v1/checkout-payments/:token" + endpoint create_deposit_payment(body: CreateDepositPaymentRequest.t()), post: "/payment/v1/deposits", return: DepositPaymentResponse.t() endpoint init_3ds_deposit_payment(body: CreateDepositPaymentRequest.t()), post: "/payment/v1/deposits/3ds-init", return: InitThreeDSPaymentResponse.t() diff --git a/lib/craftgate/model/apm_type.ex b/lib/craftgate/model/apm_type.ex index ccf46fb..c481e64 100644 --- a/lib/craftgate/model/apm_type.ex +++ b/lib/craftgate/model/apm_type.ex @@ -7,6 +7,7 @@ defmodule Craftgate.Model.ApmType do :EDENRED, :FUND_TRANSFER, :PAYPAL, + :STRIPE, :AFTERPAY, :PAYONEER, :PAPARA, diff --git a/lib/craftgate/model/payment_method.ex b/lib/craftgate/model/payment_method.ex index 32a59e4..9125216 100644 --- a/lib/craftgate/model/payment_method.ex +++ b/lib/craftgate/model/payment_method.ex @@ -6,6 +6,7 @@ defmodule Craftgate.Model.PaymentMethod do use Craftgate.Enum, [ :EDENRED, :PAYPAL, + :STRIPE, :ALIPAY, :AFTERPAY, :MASTERPASS, diff --git a/lib/craftgate/model/payment_provider.ex b/lib/craftgate/model/payment_provider.ex index b7fe70e..2793f78 100644 --- a/lib/craftgate/model/payment_provider.ex +++ b/lib/craftgate/model/payment_provider.ex @@ -8,6 +8,7 @@ defmodule Craftgate.Model.PaymentProvider do :BANK, :YKB_WORLD_PAY, :GOOGLEPAY, + :STRIPE, :MASTERPASS, :GARANTI_PAY, :PAYONEER, diff --git a/lib/craftgate/request/create_member_request.ex b/lib/craftgate/request/create_member_request.ex index cfd1903..24a5d1c 100644 --- a/lib/craftgate/request/create_member_request.ex +++ b/lib/craftgate/request/create_member_request.ex @@ -17,7 +17,9 @@ defmodule Craftgate.Request.CreateMemberRequest do tax_office: :string, tax_number: :string, iban: :string, + settlement_earnings_destination: Craftgate.Model.SettlementEarningsDestination, negative_wallet_amount_limit: :decimal, + sub_merchant_maximum_allowed_negative_balance: :decimal, is_buyer: :boolean, is_sub_merchant: :boolean ] diff --git a/lib/craftgate/request/init_checkout_payment_request.ex b/lib/craftgate/request/init_checkout_payment_request.ex index 23db7c9..ef4a323 100644 --- a/lib/craftgate/request/init_checkout_payment_request.ex +++ b/lib/craftgate/request/init_checkout_payment_request.ex @@ -27,6 +27,7 @@ defmodule Craftgate.Request.InitCheckoutPaymentRequest do allow_installment_only_commercial_cards: :boolean, force_three_ds: :boolean, force_auth_for_non_credit_cards: :boolean, + ttl: :integer, custom_installments: {:array, Craftgate.Request.Dto.CustomInstallment}, items: {:array, Craftgate.Request.Dto.PaymentItem} ] diff --git a/lib/craftgate/request/update_member_request.ex b/lib/craftgate/request/update_member_request.ex index 9db2ba8..fa8d483 100644 --- a/lib/craftgate/request/update_member_request.ex +++ b/lib/craftgate/request/update_member_request.ex @@ -18,6 +18,7 @@ defmodule Craftgate.Request.UpdateMemberRequest do iban: :string, settlement_earnings_destination: Craftgate.Model.SettlementEarningsDestination, negative_wallet_amount_limit: :decimal, + sub_merchant_maximum_allowed_negative_balance: :decimal, is_buyer: :boolean, is_sub_merchant: :boolean ] diff --git a/lib/craftgate/response/init_checkout_payment_response.ex b/lib/craftgate/response/init_checkout_payment_response.ex index 9eac248..ae4c0fc 100644 --- a/lib/craftgate/response/init_checkout_payment_response.ex +++ b/lib/craftgate/response/init_checkout_payment_response.ex @@ -5,6 +5,7 @@ defmodule Craftgate.Response.InitCheckoutPaymentResponse do use Craftgate.Serializable, [ token: :string, - page_url: :string + page_url: :string, + token_expire_date: :naive_datetime ] end diff --git a/mix.exs b/mix.exs index ad3eb62..cfaa892 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Craftgate.MixProject do use Mix.Project - @version "1.0.41" + @version "1.0.42" def project do [ diff --git a/test/craftgate_test/adapter/payment_adapter_test.exs b/test/craftgate_test/adapter/payment_adapter_test.exs index 029f979..f323fc8 100644 --- a/test/craftgate_test/adapter/payment_adapter_test.exs +++ b/test/craftgate_test/adapter/payment_adapter_test.exs @@ -190,6 +190,14 @@ defmodule CraftgateTest.Adapter.PaymentAdapterTest do ] ) + test_endpoint( + "expire_checkout_payment/1", + when: PaymentAdapter.expire_checkout_payment("456d1297-908e-4bd6-a13b-4be31a6e47d5"), + expect: [ + delete: "/payment/v1/checkout-payments/456d1297-908e-4bd6-a13b-4be31a6e47d5" + ] + ) + test_endpoint( "create_deposit_payment/1", when: