Skip to content

Commit

Permalink
Fix Apple Pay (#7)
Browse files Browse the repository at this point in the history
* fix null exception in apple pay source response

* update the merchant id

* update the readme

* pump the version with the changelog
  • Loading branch information
Fghurayri committed Mar 13, 2023
1 parent eddfec3 commit e4cc698
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.0.1

- [Apple Pay] Fix handling the Apple Pay response when the `company` and `name` fields aren't returned from the API.
- [Docs] Fix a typo in the installation command.
- [Docs] Improve the application description in pub.dev

## 1.0.0

- Build the Dart Moyasar API wrapper.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ android {
### Installation

```sh
flutter pub get moyasar
flutter pub add moyasar
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion example/assets/default_payment_profile_apple_pay.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"provider": "apple_pay",
"data": {
"merchantIdentifier": "merchant.nuha.io.second",
"merchantIdentifier": "merchant.mysr.fghurayri",
"displayName": "Coffee Shop",
"merchantCapabilities": ["3DS", "debit", "credit"],
"supportedNetworks": ["amex", "visa", "mada", "masterCard"],
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Runner/Runner.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<dict>
<key>com.apple.developer.in-app-payments</key>
<array>
<string>merchant.nuha.io.second</string>
<string>merchant.mysr.fghurayri</string>
</array>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.0.0"
version: "1.0.1"
path:
dependency: transitive
description:
Expand Down
10 changes: 1 addition & 9 deletions lib/src/models/sources/apple_pay/apple_pay_response_source.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import 'package:moyasar/src/models/payment_type.dart';
import 'package:moyasar/src/models/sources/card/card_company.dart';
import 'package:moyasar/src/models/sources/payment_response_source.dart';

/// The response source from Moyasar API for the Apple Pay payment.
class ApplePayPaymentResponseSource implements PaymentResponseSource {
@override
PaymentType type = PaymentType.applepay;

final CardCompany company;
final String name;

/// The [number] is masked.
/// For example, `"XXXX-XXXX-XXXX-1115"`
final String number; // masked!
Expand All @@ -19,18 +15,14 @@ class ApplePayPaymentResponseSource implements PaymentResponseSource {
String? message;

ApplePayPaymentResponseSource({
required this.company,
required this.name,
required this.number,
required this.gatewayId,
this.referenceNumber,
this.message,
});

ApplePayPaymentResponseSource.fromJson(Map<String, dynamic> json)
: company = CardCompany.values.byName(json['company']),
name = json['name'],
number = json['number'],
: number = json['number'],
gatewayId = json['gateway_id'],
referenceNumber = json['reference_number'],
message = json['message'];
Expand Down
2 changes: 1 addition & 1 deletion lib/src/moyasar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:moyasar/moyasar.dart';

import 'package:moyasar/src/models/payment_request.dart';

const version = "1.0.0";
const version = "1.0.1";

class Moyasar {
static const String apiUrl = 'https://api.moyasar.com/v1/payments';
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: moyasar
description: The Official Moyasar Flutter SDK.
version: 1.0.0
version: 1.0.1
homepage: https://moyasar.com/en/
repository: https://github.com/moyasar/moyasar-flutter
issue_tracker: https://github.com/moyasar/moyasar-flutter/issues
Expand Down

0 comments on commit e4cc698

Please sign in to comment.