# Migration v4

Contains 10 breaking changes of the SDK interface.

## Changes

- [loginUser](#loginUser)
- [changeUserPassword](#changeUserPassword)
- [Adds additional configuration keys](#Adds-additional-configuration-keys)
- [createUserProfile](#createUserProfile)
- [updateUserProfile](#updateUserProfile)
- [getAuthorisationToken](#getAuthorisationToken)
- [getFirstDeliveryDate](#getFirstDeliveryDate)
- [Offer model](#Offer-model)
	- [getCountryPricing](#getCountryPricing)
	- [getFulfilmentPricing](#getFulfilmentPricing)
	- [getCountryPricing](#getTermPricing)

### loginUser

- Renames the function to `login`.
- Moves function from `User` class to `Authorisation` class.
- Changes parameter structure from an object to individual parameters.

```javascript
const FTSession_s = authorisation.login(email, password, rememberMe);
```

### changeUserPassword

- Renames the function to `changePassword`.
- Moves function from `User` class to `Authorisation` class.
- Changes parameter structure from an object to individual parameters.

```javascript
const passwordChangeSuccessful = authorisation.changePassword(userId, newPassword, oldPassword, resetPasswordToken, reasonForChange);
```

### Adds additional configuration keys

In the previous versions the userApiKey was used for logging in and changing a user's password. This is no longer the case, a separate key is now needed for `login` and `changePassword`.

- Adds loginApiKey
- Adds userCredApiKey

```javascript
const config = new membershipSdk.ProductionConfiguration({
	loginApiKey: 'secret',
	userCredApiKey: 'secret'
});

```

### createUserProfile

- Renames the function to `createProfile`.

```javascript
const newProfile = userSdk.createProfile(user);
```

### updateUserProfile

- Renames the function to `updateProfile`.

```javascript
const updatedProfile = userSdk.updateProfile(user);
```

### getAuthorisationToken

- Renames the function to `getToken`.

```javascript
const authorisationToken = authorisation.getToken(sessionToken, scope);
```
### getFirstDeliveryDate

- Changes parameter structure from an object to individual parameters.

```javascript
const firstDeliveryDate = authorisation.getFirstDeliveryDate(productCode, countryCode, postcode, option, startDate);
```

### Offer model

- Changes parameter structure from an object to individual parameters for the following prototypes:

#### getCountryPricing

```javascript
const countryPricing = offer.getCountryPricing(countryCode, pricing);
```

#### getFulfilmentPricing

```javascript
const fulfilmentPricing = offer.getFulfilmentPricing(fulfilmentOption, pricing);
```

#### getTermPricing

```javascript
const termPricing = offer.getTermPricing(term, pricing);
```
