Skip to content

Commit 52f1de9

Browse files
committed
v3.6.0 updates
1 parent 5ad1536 commit 52f1de9

File tree

7 files changed

+83
-17
lines changed

7 files changed

+83
-17
lines changed

.github/workflows/publish.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# .github/workflows/publish.yml
2+
name: Publish to pub.dev
3+
4+
on:
5+
push:
6+
tags:
7+
- 'v[0-9]+.[0-9]+.[0-9]+*' # tag-pattern on pub.dev: 'v'
8+
9+
# Publish using the reusable workflow from dart-lang.
10+
jobs:
11+
publish-package:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Flutter
19+
uses: subosito/flutter-action@v2
20+
21+
- name: Get dependencies
22+
run: flutter pub get
23+
24+
- name: Analyze code
25+
run: flutter analyze
26+
27+
- name: Format code
28+
run: dart format --fix .
29+
30+
- name: Check publish warnings
31+
run: dart pub publish --dry-run
32+
33+
- name: Publish package
34+
uses: k-paxian/dart-package-publisher@v1.5.1
35+
with:
36+
credentialJson: ${{ secrets.CREDENTIAL_SECRET }}
37+
flutter: true
38+
skipTests: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Files and directories created by pub.
22
.dart_tool/
33
.packages
4+
.idea
5+
.flutter-plugins
46

57
# Conventional directory for build outputs.
68
build/

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [3.6.0] - 2023-07-03
2+
3+
* Fix orderBy parameter for `getProducts()`.
4+
* Add transactionId in `OrderWC` class.
5+
* More parameters added for `createCoupon()`.
6+
17
## [3.5.0] - 2023-05-28
28

39
* Refactor products.dart to product.dart

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ In your flutter project add the dependency:
1515
``` dart
1616
dependencies:
1717
...
18-
woosignal: ^3.5.0
18+
woosignal: ^3.6.0
1919
```
2020

2121
### Usage example #

lib/models/payload/order_wc.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class OrderWC {
2929
Shipping? shipping;
3030
List<LineItems>? lineItems;
3131
List<ShippingLines>? shippingLines;
32+
String? transactionId;
3233

3334
OrderWC(
3435
{this.paymentMethod,
@@ -45,7 +46,8 @@ class OrderWC {
4546
this.billing,
4647
this.shipping,
4748
this.lineItems,
48-
this.shippingLines});
49+
this.shippingLines,
50+
this.transactionId});
4951

5052
OrderWC.fromJson(Map<String, dynamic> json) {
5153
paymentMethod = json['payment_method'];
@@ -57,6 +59,9 @@ class OrderWC {
5759
if (json['customer_note'] != null) {
5860
customerNote = json['customer_note'];
5961
}
62+
if (json['transaction_id'] != null) {
63+
transactionId = json['transaction_id'];
64+
}
6065
if (json['parent_id']) {
6166
parentId = json['parent_id'];
6267
}
@@ -112,6 +117,9 @@ class OrderWC {
112117
if (parentId != null) {
113118
data['parent_id'] = parentId;
114119
}
120+
if (transactionId != null) {
121+
data['transaction_id'] = transactionId;
122+
}
115123
if (metaData != null) {
116124
data['meta_data'] = metaData!.map((v) => v.toJson()).toList();
117125
}

lib/woosignal.dart

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import 'package:woosignal/models/response/setting_option_batch.dart';
5353
import 'package:woosignal/models/response/product_batch.dart';
5454

5555
/// WooSignal Package version
56-
const String wooSignalVersion = "3.4.0";
56+
const String wooSignalVersion = "3.6.0";
5757

5858
class WooSignal {
5959
WooSignal._privateConstructor();
@@ -169,7 +169,7 @@ class WooSignal {
169169
if (after != null) payload["after"] = after;
170170
if (before != null) payload["before"] = before;
171171
if (order != null) payload["order"] = order;
172-
if (orderBy != null) payload["order_by"] = orderBy;
172+
if (orderBy != null) payload["orderby"] = orderBy;
173173
if (slug != null) payload["slug"] = slug;
174174
if (status != null) payload["status"] = status;
175175
if (type != null) payload["type"] = type;
@@ -592,6 +592,8 @@ class WooSignal {
592592
String? search,
593593
String? after,
594594
String? before,
595+
String? modifiedAfter,
596+
String? modifiedBefore,
595597
List<int>? exclude,
596598
List<int>? include,
597599
int? offset,
@@ -612,6 +614,8 @@ class WooSignal {
612614
if (search != null) payload["search"] = search;
613615
if (after != null) payload["after"] = after;
614616
if (before != null) payload["before"] = before;
617+
if (modifiedAfter != null) payload["modified_after"] = modifiedAfter;
618+
if (modifiedBefore != null) payload["modified_before"] = modifiedBefore;
615619
if (exclude != null) payload["exclude"] = exclude;
616620
if (include != null) payload["include"] = include;
617621
if (offset != null) payload["offset"] = offset;
@@ -1020,14 +1024,17 @@ class WooSignal {
10201024
}
10211025

10221026
/// https://woosignal.com/docs/api/1.0/coupons#create-a-coupon
1023-
Future<Coupon?> createCoupon({
1024-
required String? code,
1025-
required String? discountType,
1026-
required String? amount,
1027-
required bool? individualUse,
1028-
required bool? excludeSaleItems,
1029-
required String? minimumAmount,
1030-
}) async {
1027+
Future<Coupon?> createCoupon(
1028+
{required String? code,
1029+
required String? discountType,
1030+
required String? amount,
1031+
required bool? individualUse,
1032+
required bool? excludeSaleItems,
1033+
required String? minimumAmount,
1034+
int? usageLimit,
1035+
List<int>? productIds,
1036+
List<String>? emailRestrictions,
1037+
String? description}) async {
10311038
Map<String, dynamic> payload = {};
10321039
if (code != null) payload['code'] = code;
10331040
if (discountType != null) payload['discount_type'] = discountType;
@@ -1037,6 +1044,11 @@ class WooSignal {
10371044
payload['exclude_sale_items'] = excludeSaleItems;
10381045
}
10391046
if (minimumAmount != null) payload['minimum_amount'] = minimumAmount;
1047+
if (usageLimit != null) payload['usage_limit'] = usageLimit;
1048+
if (productIds != null) payload['product_ids'] = productIds;
1049+
if (emailRestrictions != null)
1050+
payload['email_restrictions'] = emailRestrictions;
1051+
if (description != null) payload['description'] = description;
10401052

10411053
return await _wooSignalRequest<Coupon?>(
10421054
method: "post",

pubspec.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ environment:
1010
sdk: '>=2.19.0 <4.0.0'
1111

1212
dependencies:
13-
dio: ^5.1.2
14-
device_info_plus: ^9.0.1
15-
shared_preferences: ^2.1.1
13+
dio: ^5.2.1+1
14+
device_info_plus: ^9.0.2
15+
shared_preferences: ^2.2.0
1616
uuid: ^3.0.6
1717

1818
flutter:
1919
sdk: flutter
2020

2121
dev_dependencies:
22-
lints: ^2.1.0
23-
test: ^1.24.3
22+
lints: ^2.1.1
23+
test: ^1.24.4
2424

2525
screenshots:
2626
- description: The WooSignal package logo.

0 commit comments

Comments
 (0)