Skip to content
This repository has been archived by the owner on Jun 2, 2020. It is now read-only.

Commit

Permalink
Revert "Merge pull request #94 from klarna/feature/extend-compatibili…
Browse files Browse the repository at this point in the history
…ty-fixes"

This reverts commit 1273a07, reversing
changes made to 98741a4.
  • Loading branch information
alexions committed Jan 20, 2020
1 parent 1273a07 commit a1641e4
Show file tree
Hide file tree
Showing 68 changed files with 2,121 additions and 178 deletions.
22 changes: 1 addition & 21 deletions CHANGELOG.md
Expand Up @@ -15,25 +15,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

## [3.1.11] (Enhancements Release/Auto-generated models) - 2019-12-23

### Changed

- Examples now use new models instead of the deprecated ones

### Added

- Order Management
- Added new values to `OrderManagementInitialPaymentMethodType` Enum
- Hosted Payment Page
- Added new values to `HostedPaymentPageStatus` Enum
- Checkout
- Added new values to `ShippingMethod` Enum

### Fixed

- Models introduced in [3.1.10] were causing side-effects, for example to use `Klarna.Rest.Core.Model.OrderManagement.Capture` you had to use the legacy `Klarna.Rest.Core.Model.Orderline` and not `Klarna.Rest.Core.Model.OrderManagement.Orderline`. You can now use `Klarna.Rest.Core.Model.OrderManagement.Orderline`.
- Class documentation updated to fix broken links to example code

## [3.1.10] (Enhancements Release/Auto-generated models) - 2019-12-10

Expand Down Expand Up @@ -275,8 +256,7 @@ and fixes [#77](https://github.com/klarna/kco_rest_dotnet/issues/77)

- **NEW MINT-1912** Support checkout v3 and ordermanagement v1 APIs - *Joakim.L*

[Unreleased]: https://github.com/klarna/kco_rest_dotnet/compare/v3.1.11...HEAD
[3.1.11]: https://github.com/klarna/kco_rest_dotnet/compare/v3.1.10...v3.1.11
[Unreleased]: https://github.com/klarna/kco_rest_dotnet/compare/v3.1.10...HEAD
[3.1.10]: https://github.com/klarna/kco_rest_dotnet/compare/v3.1.9...v3.1.10
[3.1.9]: https://github.com/klarna/kco_rest_dotnet/compare/v3.1.8...v3.1.9
[3.1.8]: https://github.com/klarna/kco_rest_dotnet/compare/v3.1.7...v3.1.8
Expand Down
27 changes: 13 additions & 14 deletions Klarna.Rest/Klarna.Rest.Core.Examples/CheckoutApi.cs
Expand Up @@ -4,7 +4,6 @@
using Klarna.Rest.Core.Communication;
using Klarna.Rest.Core.Model;
using Klarna.Rest.Core.Model.Enum;
using Klarna.Rest.Core.Model.Checkout;

namespace Klarna.Rest.Core.Examples
{
Expand All @@ -24,23 +23,23 @@ static void Main()

var client = new Klarna(username, password, KlarnaEnvironment.TestingEurope);

var order = new Order
var order = new CheckoutOrder
{
PurchaseCountry = "se",
PurchaseCurrency = "sek",
Locale = "sv-se",
OrderAmount = 10000,
OrderTaxAmount = 2000,
MerchantUrls = new MerchantUrls
MerchantUrls = new CheckoutMerchantUrls
{
Terms = "https://www.example.com/terms.html",
Checkout = "https://www.example.com/checkout.html",
Confirmation = "https://www.example.com/confirmation.html",
Push = "https://www.example.com/push.html"
},
OrderLines = new List<Model.Checkout.OrderLine>()
OrderLines = new List<OrderLine>()
{
new Model.Checkout.OrderLine
new OrderLine
{
Type = OrderLineType.physical,
Name = "Foo",
Expand All @@ -52,7 +51,7 @@ static void Main()
TotalDiscountAmount = 0,
}
},
CheckoutOptions = new Options
CheckoutOptions = new CheckoutOptions
{
AllowSeparateShippingAddress = false,
ColorButton = "#FF9900",
Expand Down Expand Up @@ -105,23 +104,23 @@ static void Main()

var client = new Klarna(username, password, KlarnaEnvironment.TestingEurope);

var order = new Order
var order = new CheckoutOrder
{
PurchaseCountry = "gb",
PurchaseCurrency = "gbp",
Locale = "en-gb",
OrderAmount = 9000,
OrderTaxAmount = 818,
MerchantUrls = new Model.Checkout.MerchantUrls
MerchantUrls = new CheckoutMerchantUrls
{
Terms = "https://www.example.com/terms.html",
Checkout = "https://www.example.com/checkout.html",
Confirmation = "https://www.example.com/confirmation.html",
Push = "https://www.example.com/push.html"
},
OrderLines = new List<Model.Checkout.OrderLine>()
OrderLines = new List<OrderLine>()
{
new Model.Checkout.OrderLine
new OrderLine
{
Type = OrderLineType.physical,
Reference = "19-402-USA",
Expand All @@ -135,7 +134,7 @@ static void Main()
},

// Set a discount
new Model.Checkout.OrderLine
new OrderLine
{
Type = OrderLineType.discount,
Reference = "10-gbp-order-discount",
Expand Down Expand Up @@ -234,9 +233,9 @@ public static void Main()
var order = client.Checkout.GetOrder(orderId).Result;
order.OrderAmount = 20000;
order.OrderTaxAmount = 4000;
order.OrderLines = new List<Model.Checkout.OrderLine>
order.OrderLines = new List<OrderLine>
{
new Model.Checkout.OrderLine
new OrderLine
{
Type = OrderLineType.physical,
Name = "Foo",
Expand All @@ -247,7 +246,7 @@ public static void Main()
TotalTaxAmount = 2000,
TotalDiscountAmount = 0,
},
new Model.Checkout.OrderLine
new OrderLine
{
Type = OrderLineType.physical,
Name = "Foo2",
Expand Down
7 changes: 4 additions & 3 deletions Klarna.Rest/Klarna.Rest.Core.Examples/CustomerTokenApi.cs
Expand Up @@ -3,6 +3,7 @@
using Klarna.Rest.Core.Common;
using Klarna.Rest.Core.Communication;
using Klarna.Rest.Core.Model.Enum;
using Klarna.Rest.Core.Model;

namespace Klarna.Rest.Core.Examples
{
Expand Down Expand Up @@ -48,16 +49,16 @@ public void CreateOrderOnCustomerToken()

var klarna = new Klarna(username, password, KlarnaEnvironment.TestingEurope);
var customerToken = "234534...345345....345";
var orderData = new Model.CustomerToken.CustomerTokenOrder
var orderData = new CustomerTokenOrder
{
PurchaseCurrency = "SEK",
OrderAmount = 1000,
OrderTaxAmount = 2000,
MerchantReference1 = "StoreOrderId",
AutoCapture = true,
OrderLines = new List<Model.CustomerToken.OrderLine>()
OrderLines = new List<OrderLine>()
{
new Model.CustomerToken.OrderLine
new OrderLine
{
Type = OrderLineType.physical,
Name = "Foo",
Expand Down
13 changes: 7 additions & 6 deletions Klarna.Rest/Klarna.Rest.Core.Examples/InternalCreateExample.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using Klarna.Rest.Core.Common;
using Klarna.Rest.Core.Model;
using Klarna.Rest.Core.Model.Enum;

namespace Klarna.Rest.Core.Examples
Expand All @@ -13,23 +14,23 @@ public void Main()

var klarna = new Klarna(username, password, KlarnaEnvironment.TestingEurope);

var order = new Model.Checkout.Order
var order = new Model.CheckoutOrder
{
PurchaseCountry = "se",
PurchaseCurrency = "sek",
Locale = "sv-se",
OrderAmount = 10000,
OrderTaxAmount = 2000,
MerchantUrls = new Model.Checkout.MerchantUrls
MerchantUrls = new CheckoutMerchantUrls
{
Terms = "https://www.example.com/terms.html",
Checkout = "https://www.example.com/checkout.html",
Confirmation = "https://www.example.com/confirmation.html",
Push = "https://www.example.com/push.html"
},
OrderLines = new List<Model.Checkout.OrderLine>()
OrderLines = new List<OrderLine>()
{
new Model.Checkout.OrderLine
new OrderLine
{
Type = OrderLineType.physical,
Name = "Foo",
Expand All @@ -41,7 +42,7 @@ public void Main()
TotalDiscountAmount = 0,
}
},
CheckoutOptions = new Model.Checkout.Options
CheckoutOptions = new CheckoutOptions
{
AllowSeparateShippingAddress = false,
ColorButton = "#FF9900",
Expand All @@ -59,7 +60,7 @@ public void Main()

var fetchedOrder = klarna.Checkout.GetOrder("56fb8a38-1e83-4dd7-a89f-9f297e7e95eb").Result;

fetchedOrder.OrderLines.Add(new Model.Checkout.OrderLine
fetchedOrder.OrderLines.Add(new OrderLine
{
Type = OrderLineType.physical,
Name = "Foo2",
Expand Down
10 changes: 5 additions & 5 deletions Klarna.Rest/Klarna.Rest.Core.Examples/OrderManagementApi.cs
Expand Up @@ -3,7 +3,7 @@
using Klarna.Rest.Core.Common;
using Klarna.Rest.Core.Communication;
using Klarna.Rest.Core.Model.Enum;
using Klarna.Rest.Core.Model.OrderManagement;
using Klarna.Rest.Core.Model;

namespace Klarna.Rest.Core.Examples
{
Expand Down Expand Up @@ -87,7 +87,7 @@ public void CaptureOrder()
var orderId = "abc-abcdefg-abc";
try
{
var captureData = new CaptureObject()
var captureData = new OrderManagementCreateCapture
{
CapturedAmount = 10000,
Description = "Full capture of the order",
Expand All @@ -105,9 +105,9 @@ public void CaptureOrder()
TotalDiscountAmount = 0,
}
},
ShippingInfo = new List<ShippingInfo>()
ShippingInfo = new List<OrderManagementShippingInfo>()
{
new ShippingInfo
new OrderManagementShippingInfo
{
ShippingMethod = OrderManagementShippingMethod.PickUpPoint,
ShippingCompany = "PostNord",
Expand Down Expand Up @@ -182,7 +182,7 @@ public void RefundOrder()
var orderId = "abc-abcdefg-abc";
try
{
var refundData = new RefundObject()
var refundData = new OrderManagementRefund
{
RefundedAmount = 10000,
Description = "Full refund for order",
Expand Down
12 changes: 6 additions & 6 deletions Klarna.Rest/Klarna.Rest.Core.Examples/PaymentApi.cs
Expand Up @@ -3,7 +3,7 @@
using Klarna.Rest.Core.Common;
using Klarna.Rest.Core.Communication;
using Klarna.Rest.Core.Model.Enum;
using Klarna.Rest.Core.Model.Payments;
using Klarna.Rest.Core.Model;

namespace Klarna.Rest.Core.Examples
{
Expand All @@ -17,7 +17,7 @@ public void CreateSession()
var klarna = new Klarna(username, password, KlarnaEnvironment.TestingEurope);
try
{
var paymentSession = new Session
var paymentSession = new PaymentCreditSession
{
PurchaseCountry = "SE",
PurchaseCurrency = "SEK",
Expand All @@ -39,10 +39,10 @@ public void CreateSession()
}
},
MerchantReference1 ="StoreOrderId",
Options = new Options{
Options = new PaymentOptions{
ColorButton ="000000"
},
BillingAddress = new Address
BillingAddress = new PaymentAddressInfo
{
GivenName ="John",
FamilyName ="Doe",
Expand Down Expand Up @@ -158,8 +158,8 @@ public void CreateConsumerToken()

var klarna = new Klarna(username, password, KlarnaEnvironment.TestingEurope);
var authorization_token = "234534...345345....345";
var consumertokenreqest = new CustomerTokenCreationRequest() {
BillingAddress = new Address {
var consumertokenreqest = new PaymentGenerateConsumerTokenRequest {
BillingAddress = new PaymentAddressInfo {
GivenName = "John",
FamilyName = "Doe",
StreetAddress = "Sveavägen 46",
Expand Down
Expand Up @@ -77,14 +77,14 @@ public void CanReadResponseJson()
public void CanDeserializeRequest()
{
var json = File.ReadAllText(Path.Combine(System.Environment.CurrentDirectory, "Data", "HostedPaymentPageCreateSessionRequest.json"));
var request = JsonConvert.DeserializeObject<Model.HostedPaymentPage.SessionCreationRequestV1>(json);
var request = JsonConvert.DeserializeObject<HostedPaymentPageCreateSessionRequest>(json);
}

[Fact]
public void CanDeserializeResponse()
{
var json = File.ReadAllText(Path.Combine(System.Environment.CurrentDirectory, "Data", "HostedPaymentPageCreateSessionResponse.json"));
var response = JsonConvert.DeserializeObject<Model.HostedPaymentPage.SessionCreationResponseV1>(json);
var response = JsonConvert.DeserializeObject<HostedPaymentPageCreateSessionResponse>(json);
}

[Fact]
Expand All @@ -95,7 +95,7 @@ public void TestClient()
responseObject.AuthorizationToken = "b4bd3423-24e3";
responseObject.UpdatedAt = "2038-01-19T03:14:07.000Z";
responseObject.SessionId = "1234";
Model.HostedPaymentPage.SessionResponseV1 casted = responseObject;
HostedPaymentPageSessionStatus casted = responseObject;
Assert.True(casted.AuthorizationToken.Equals("b4bd3423-24e3"));
}
}
Expand Down
2 changes: 1 addition & 1 deletion Klarna.Rest/Klarna.Rest.Core/Common/Constants.cs
Expand Up @@ -8,7 +8,7 @@ public class Constants
/// <summary>
/// The current version of .NET SDK library for Klarna Services
/// </summary>
public const string Version = "3.1.11";
public const string Version = "3.1.10";

/// <summary>
/// The API for the European live environment
Expand Down
2 changes: 1 addition & 1 deletion Klarna.Rest/Klarna.Rest.Core/Klarna.Rest.Core.csproj
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>3.1.11</Version>
<Version>3.1.10</Version>
<AssemblyName>Klarna.Rest.Core</AssemblyName>
<AssemblyTitle>Klarna Checkout REST .NET SDK</AssemblyTitle>
<OutputType>Library</OutputType>
Expand Down

0 comments on commit a1641e4

Please sign in to comment.