Skip to content

Commit

Permalink
Merge pull request #14 from bamlab/add-applePay-merchant-name
Browse files Browse the repository at this point in the history
Add apple pay merchant name
  • Loading branch information
thomascoumau authored Dec 5, 2023
2 parents 84576b1 + d2b5691 commit 723ef8f
Show file tree
Hide file tree
Showing 26 changed files with 114 additions and 57 deletions.
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# Flutter-Lyra

---
## Installation

# Installation

---

## Android
### Android

Prerequisites:

Expand Down Expand Up @@ -74,9 +70,7 @@ defaultConfig {
Don't forget to change it as well in your `android/app/src/main/res/values-night/styles.xml` if you need to

---

## iOS
### iOS

Prerequisites:

Expand All @@ -86,16 +80,12 @@ Prerequisites:
platform :ios, '11.0'
```

---

## About Lyra

This sdk is the flutter interface implementation of the [android](https://github.com/lyra/android-sdk) and [ios](https://github.com/lyra/ios-sdk) sdks of Lyra

If you want more informations about Lyra, here is their [website](https://payzen.io/fr-FR/)

---

## 👉 About Bam

We are a 100 people company developing and designing multiplatform applications with [React Native](https://www.bam.tech/expertise/react-native) and [Flutter](https://www.bam.tech/expertise/flutter) using the Lean & Agile methodology. To get more information on the solutions that would suit your needs, feel free to get in touch by [email](mailto://[email protected]) or through [contact form](https://www.bam.tech/contact)!
Expand Down
4 changes: 4 additions & 0 deletions flutter_lyra/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.3.1

- **FEAT**: Add apple pay merchant id.

# 0.3.0

- **FEAT**: add Apple Pay support.
Expand Down
16 changes: 3 additions & 13 deletions flutter_lyra/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# Flutter-Lyra

---
## Installation

# Installation

---

## Android
### Android

Prerequisites:

Expand Down Expand Up @@ -74,9 +70,7 @@ defaultConfig {
Don't forget to change it as well in your `android/app/src/main/res/values-night/styles.xml` if you need to

---

## iOS
### iOS

Prerequisites:

Expand All @@ -86,16 +80,12 @@ Prerequisites:
platform :ios, '11.0'
```

---

## About Lyra

This sdk is the flutter interface implementation of the [android](https://github.com/lyra/android-sdk) and [ios](https://github.com/lyra/ios-sdk) sdks of Lyra

If you want more informations about Lyra, here is their [website](https://payzen.io/fr-FR/)

---

## 👉 About Bam

We are a 100 people company developing and designing multiplatform applications with [React Native](https://www.bam.tech/expertise/react-native) and [Flutter](https://www.bam.tech/expertise/flutter) using the Lean & Agile methodology. To get more information on the solutions that would suit your needs, feel free to get in touch by [email](mailto://[email protected]) or through [contact form](https://www.bam.tech/contact)!
Expand Down
2 changes: 0 additions & 2 deletions flutter_lyra/example/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Flutter-Lyra-Example

---

Demonstrates how to use the `flutter_lyra` plugin.
9 changes: 8 additions & 1 deletion flutter_lyra/example/lib/const.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ abstract class DataSet {
/// Create payment request payload route path
String get initialCreatePaymentRoutePath;

///
/// Your Apple pay merchant id
String get initialApplePayMerchantId;

/// Your Apple pay merchant name
String get initialApplePayMerchantName;

/// Create payment request payload currency
Map<String, Object?> initialCreatePaymentPayload(int formTokenVersion);
}
Expand Down Expand Up @@ -64,6 +67,10 @@ class _FirstDataSet extends DataSet {
@override
String get initialApplePayMerchantId => '';

/// Apple pay merchant name
@override
String get initialApplePayMerchantName => '';

/// Create payment request payload currency
@override
Map<String, Object?> initialCreatePaymentPayload(int formTokenVersion) =>
Expand Down
12 changes: 12 additions & 0 deletions flutter_lyra/example/lib/methods/initialize_method.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class _InitializeMethodState extends State<InitializeMethod> {
late String publicKey = widget.dataSet.initialPublicKey;
late String apiServerName = widget.dataSet.initialApiServerName;
late String applePayMerchantId = widget.dataSet.initialApplePayMerchantId;
late String applePayMerchantName = widget.dataSet.initialApplePayMerchantName;
var nfcEnabled = false;
var cardScanningEnabled = false;

Expand All @@ -42,6 +43,10 @@ class _InitializeMethodState extends State<InitializeMethod> {
applePayMerchantId = newApplePayMerchantId;
});

void setApplePayMerchantName(String newApplePayMerchantName) => setState(() {
applePayMerchantName = newApplePayMerchantName;
});

void setNfcEnabled({required bool newNfcEnabled}) => setState(() {
nfcEnabled = newNfcEnabled;
});
Expand All @@ -64,6 +69,7 @@ class _InitializeMethodState extends State<InitializeMethod> {
nfcEnabled: nfcEnabled,
cardScanningEnabled: cardScanningEnabled,
applePayMerchantId: applePayMerchantId,
applePayMerchantName: applePayMerchantName,
),
);

Expand Down Expand Up @@ -117,6 +123,12 @@ class _InitializeMethodState extends State<InitializeMethod> {
setValue: setApplePayMerchantId,
),
const SizedBox(height: 16),
CustomTextField(
value: applePayMerchantName,
hintText: 'applePayMerchantName',
setValue: setApplePayMerchantName,
),
const SizedBox(height: 16),
SwitchListTile(
title: const Text('nfcEnabled'),
value: nfcEnabled,
Expand Down
5 changes: 5 additions & 0 deletions flutter_lyra/lib/helpers/lyra_options_converter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class LyraInitializeOptionsConverter {
applePayMerchantId: defaultTargetPlatform == TargetPlatform.iOS
? lyraInitializeOptions.applePayMerchantId
: null,
applePayMerchantName: defaultTargetPlatform == TargetPlatform.iOS
? lyraInitializeOptions.applePayMerchantName
: null,
);

/// convert a [LyraInitializeOptionsInterface] to a [LyraInitializeOptions]
Expand All @@ -28,5 +31,7 @@ class LyraInitializeOptionsConverter {
cardScanningEnabled: lyraInitializeOptionInterface.cardScanningEnabled,
nfcEnabled: lyraInitializeOptionInterface.nfcEnabled,
applePayMerchantId: lyraInitializeOptionInterface.applePayMerchantId,
applePayMerchantName:
lyraInitializeOptionInterface.applePayMerchantName,
);
}
7 changes: 7 additions & 0 deletions flutter_lyra/lib/models/lyra_initialize_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class LyraInitializeOptions extends Equatable {
this.nfcEnabled,
this.cardScanningEnabled,
this.applePayMerchantId,
this.applePayMerchantName,
});

/// a [String] that match your api server name
Expand All @@ -33,11 +34,17 @@ class LyraInitializeOptions extends Equatable {
/// only used for iOS platform, otherwise this value is ignored
final String? applePayMerchantId;

/// a [String] that match your Apple Pay merchant name.
///
/// only used for iOS platform, otherwise this value is ignored
final String? applePayMerchantName;

@override
List<Object?> get props => [
apiServerName,
nfcEnabled,
cardScanningEnabled,
applePayMerchantId,
applePayMerchantName,
];
}
8 changes: 4 additions & 4 deletions flutter_lyra/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_lyra
description: This package allows you to use the methods from the lyra android and ios native sdks in Flutter
version: 0.3.0
version: 0.3.1
homepage: https://github.com/bamlab/Flutter-Lyra
repository: https://github.com/bamlab/Flutter-Lyra

Expand All @@ -20,9 +20,9 @@ dependencies:
equatable: ^2.0.5
flutter:
sdk: flutter
flutter_lyra_android: ^0.3.0
flutter_lyra_ios: ^0.3.0
flutter_lyra_platform_interface: ^0.3.0
flutter_lyra_android: ^0.3.1
flutter_lyra_ios: ^0.3.1
flutter_lyra_platform_interface: ^0.3.1
dev_dependencies:
analyzer: ^4.7.0
flutter_test:
Expand Down
5 changes: 5 additions & 0 deletions flutter_lyra/test/lyra_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void main() {
cardScanningEnabled: true,
nfcEnabled: false,
applePayMerchantId: 'applePayMerchantId',
applePayMerchantName: 'applePayMerchantName',
);

lyra = Lyra(publicKey: publicKey, options: options);
Expand Down Expand Up @@ -70,6 +71,8 @@ void main() {

expect(lyraReceived.options.applePayMerchantId, isNotNull);

expect(lyraReceived.options.applePayMerchantName, isNotNull);

expect(
LyraInitializeOptionsConverter.fromInterface(
lyraKeyInterface.options,
Expand Down Expand Up @@ -110,6 +113,8 @@ void main() {

expect(lyraReceived.options.applePayMerchantId, isNull);

expect(lyraReceived.options.applePayMerchantId, isNull);

expect(
LyraInitializeOptionsConverter.fromInterface(
lyraKeyInterface.options,
Expand Down
4 changes: 4 additions & 0 deletions flutter_lyra_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.3.1

- **FEAT**: Add apple pay merchant id.

# 0.3.0

- Update a dependency to the latest release.
Expand Down
6 changes: 1 addition & 5 deletions flutter_lyra_android/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# Flutter-Lyra-Android

---

The android implementation of `flutter_lyra`.

---

# Usage
## Usage

This package is [endorsed](https://docs.flutter.dev/development/packages-and-plugins/developing-packages#endorsed-federated-plugin), which means you can simply use `flutter_lyra` normally. This package will be automatically included in your app when you do.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ public void setApplePayMerchantId(@Nullable String setterArg) {
this.applePayMerchantId = setterArg;
}

private @Nullable String applePayMerchantName;

public @Nullable String getApplePayMerchantName() {
return applePayMerchantName;
}

public void setApplePayMerchantName(@Nullable String setterArg) {
this.applePayMerchantName = setterArg;
}

/** Constructor is private to enforce null safety; use Builder. */
private LyraInitializeOptionsInterface() {}

Expand Down Expand Up @@ -159,23 +169,32 @@ public static final class Builder {
return this;
}

private @Nullable String applePayMerchantName;

public @NonNull Builder setApplePayMerchantName(@Nullable String setterArg) {
this.applePayMerchantName = setterArg;
return this;
}

public @NonNull LyraInitializeOptionsInterface build() {
LyraInitializeOptionsInterface pigeonReturn = new LyraInitializeOptionsInterface();
pigeonReturn.setApiServerName(apiServerName);
pigeonReturn.setNfcEnabled(nfcEnabled);
pigeonReturn.setCardScanningEnabled(cardScanningEnabled);
pigeonReturn.setApplePayMerchantId(applePayMerchantId);
pigeonReturn.setApplePayMerchantName(applePayMerchantName);
return pigeonReturn;
}
}

@NonNull
ArrayList<Object> toList() {
ArrayList<Object> toListResult = new ArrayList<Object>(4);
ArrayList<Object> toListResult = new ArrayList<Object>(5);
toListResult.add(apiServerName);
toListResult.add(nfcEnabled);
toListResult.add(cardScanningEnabled);
toListResult.add(applePayMerchantId);
toListResult.add(applePayMerchantName);
return toListResult;
}

Expand All @@ -189,6 +208,8 @@ ArrayList<Object> toList() {
pigeonResult.setCardScanningEnabled((Boolean) cardScanningEnabled);
Object applePayMerchantId = list.get(3);
pigeonResult.setApplePayMerchantId((String) applePayMerchantId);
Object applePayMerchantName = list.get(4);
pigeonResult.setApplePayMerchantName((String) applePayMerchantName);
return pigeonResult;
}
}
Expand Down
4 changes: 2 additions & 2 deletions flutter_lyra_android/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_lyra_android
description: Android implementation of the flutter_lyra plugin
version: 0.3.0
version: 0.3.1
homepage: https://github.com/bamlab/Flutter-Lyra
repository: https://github.com/bamlab/Flutter-Lyra

Expand All @@ -20,7 +20,7 @@ flutter:
dependencies:
flutter:
sdk: flutter
flutter_lyra_platform_interface: ^0.3.0
flutter_lyra_platform_interface: ^0.3.1
dev_dependencies:
analyzer: ^5.13.0
flutter_test:
Expand Down
4 changes: 4 additions & 0 deletions flutter_lyra_ios/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.3.1

- **FEAT**: Add apple pay merchant id.

# 0.3.0

- Update a dependency to the latest release.
Expand Down
6 changes: 1 addition & 5 deletions flutter_lyra_ios/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
# Flutte- Lyra-iOS

---

The ios implementation of `flutter_lyra`.

---

# Usage
## Usage

This package is [endorsed](https://docs.flutter.dev/development/packages-and-plugins/developing-packages#endorsed-federated-plugin), which means you can simply use `flutter_lyra` normally. This package will be automatically included in your app when you do.
5 changes: 5 additions & 0 deletions flutter_lyra_ios/ios/Classes/Converters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public class Converters {
if (applePayMerchantId != nil) {
options[Lyra.applePayMerchantId] = applePayMerchantId
}

let applePayMerchantName = optionsInterface.applePayMerchantName
if (applePayMerchantName != nil) {
options[Lyra.applePayMerchantName] = applePayMerchantName
}

return options
}
Expand Down
Loading

0 comments on commit 723ef8f

Please sign in to comment.