Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
committed Dec 28, 2024
1 parent 75bfcda commit ea8d558
Show file tree
Hide file tree
Showing 31 changed files with 132 additions and 115 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ linux/flutter/ephemeral
macos/Flutter/ephemeral
windows/ephemeral
tmp/
temp/
temp/
generate_general_private_tools_*
3 changes: 2 additions & 1 deletion package/general_payment/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ windows/ephemeral
tmp/
temp/
bin/
temp/
temp/
generate_general_private_tools_*
4 changes: 3 additions & 1 deletion package/general_payment/bin/install.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ import 'dart:io';
import 'package:general_lib/general_lib.dart';

void main(List<String> args) {
Dart.pub.installFromDirectoryFresh(directoryPackage: Directory.current).printPretty();
Dart.pub
.installFromDirectoryFresh(directoryPackage: Directory.current)
.printPretty();
}
9 changes: 6 additions & 3 deletions package/general_payment/bin/scheme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ import "package:path/path.dart" as path;
import 'package:general_payment/package/xendit/schemes/respond_schemes.dart';

void main(List<String> args) async {
final Directory directory = Directory(path.join(Directory.current.path, "lib", "scheme"));
final Directory directory_respond_scheme = Directory(path.join(directory.path, "respond_scheme"));
final Directory directory =
Directory(path.join(Directory.current.path, "lib", "scheme"));
final Directory directory_respond_scheme =
Directory(path.join(directory.path, "respond_scheme"));
if (directory_respond_scheme.existsSync()) {
directory_respond_scheme.deleteSync(recursive: true);
}
directory_respond_scheme.createSync(recursive: true);
await jsonToScripts(respond_schemes, directory: directory_respond_scheme);
final Directory directory_api_scheme = Directory(path.join(directory.path, "api_scheme"));
final Directory directory_api_scheme =
Directory(path.join(directory.path, "api_scheme"));
if (directory_api_scheme.existsSync()) {
directory_api_scheme.deleteSync(recursive: true);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@

2 changes: 1 addition & 1 deletion package/general_payment/lib/api/api.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export "create_invoice.dart";
export "get_invoice.dart";
export "get_wallet_account_by_id.dart";
export "get_wallet_account_by_id.dart";
6 changes: 4 additions & 2 deletions package/general_payment/lib/converter/invoice.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:general_payment/scheme/respond_scheme/invoice.dart' as general_payment_invoice;
import 'package:general_payment/package/xendit/scheme/respond_scheme/invoice.dart' as xendit_invoice;
import 'package:general_payment/scheme/respond_scheme/invoice.dart'
as general_payment_invoice;
import 'package:general_payment/package/xendit/scheme/respond_scheme/invoice.dart'
as xendit_invoice;

extension GeneralPaymentXenditInvoiceExtension on xendit_invoice.Invoice {
general_payment_invoice.Invoice toGeneralPaymentInvoice() {
Expand Down
3 changes: 1 addition & 2 deletions package/general_payment/lib/extension/map.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ignore_for_file: empty_catches

extension GeneralPaymentExtensionOnMap on Map {
Expand Down Expand Up @@ -26,4 +25,4 @@ extension GeneralPaymentExtensionOnMap on Map {
});
return;
}
}
}
2 changes: 1 addition & 1 deletion package/general_payment/lib/general_payment.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export "api/api.dart";
export "general_payment_core.dart";
export "general_payment_auth.dart";
export "general_payment_auth.dart";
3 changes: 2 additions & 1 deletion package/general_payment/lib/general_payment_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class GeneralPaymentAuth {
required String paymentGatewayApiKey,
required String paymentGatewayOwnerId,
}) {
if (RegExp(r"^(xnd_(development|production)_)", caseSensitive: false).hasMatch(paymentGatewayApiKey)) {
if (RegExp(r"^(xnd_(development|production)_)", caseSensitive: false)
.hasMatch(paymentGatewayApiKey)) {
return GeneralPaymentAuth.xendit(
xenditOwnerId: paymentGatewayOwnerId,
xenditApiKey: paymentGatewayApiKey,
Expand Down
3 changes: 2 additions & 1 deletion package/general_payment/lib/general_payment_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,5 @@ class GeneralPayment implements GeneralPaymentCore {
);
}

typedef InvokeFunctionBuilder<T> = FutureOr<T> Function(GeneralPaymentAuth generalPaymentAuth);
typedef InvokeFunctionBuilder<T> = FutureOr<T> Function(
GeneralPaymentAuth generalPaymentAuth);
2 changes: 1 addition & 1 deletion package/general_payment/lib/package/package.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export "xendit/xendit.dart";
export "xendit/xendit.dart";
2 changes: 1 addition & 1 deletion package/general_payment/lib/package/xendit/api/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export "get_invoice.dart";
export "get_invoices.dart";
export "get_payout_link_by_id.dart";
export "set_invoice_expire_by_invoice_id.dart";
export "update_account.dart";
export "update_account.dart";
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extension XenditExtensioncreateAccount on Xendit {
required String bussiness_name,
required String xenditApiKey,
Map<String, String>? headers,
}) async {
}) async {
return await invokeRaw<Account>(
parameters: XenditInvokeParameters(
endpoint: "POST https://api.xendit.co/v2/accounts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@ extension XenditExtensioncreatePayOutLink on Xendit {
required int amount,
required String email,
required String xenditApiKey,
}) async {
}) async {
return await invokeRaw<PayOutLink>(
parameters: XenditInvokeParameters(

endpoint: "POST https://api.xendit.co/payouts",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
parameters: {
"external_id": external_id,
"amount": amount,
"email": email,
},
endpoint: "POST https://api.xendit.co/payouts",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
parameters: {
"external_id": external_id,
"amount": amount,
"email": email,
},
queryParameters: {},
specialTypeSucces: "payOutLink",
isThrowOnError: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extension XenditExtensiongetAccount on Xendit {
required String id,
required String xenditApiKey,
Map<String, String>? headers,
}) async {
}) async {
return await invokeRaw<Account>(
parameters: XenditInvokeParameters(
endpoint: "GET https://api.xendit.co/v2/accounts/$id",
Expand All @@ -18,7 +18,7 @@ extension XenditExtensiongetAccount on Xendit {
parameters: {},
queryParameters: {},
specialTypeSucces: "account",
isThrowOnError: false,
isThrowOnError: false,
),
);
}
Expand Down
25 changes: 13 additions & 12 deletions package/general_payment/lib/package/xendit/api/get_balance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ extension XenditExtensiongetBalance on Xendit {
String forUserId = "",
required String account_type,
required String xenditApiKey,
}) async {
}) async {
return await invokeRaw<Balance>(
parameters: XenditInvokeParameters(
endpoint: "GET https://api.xendit.co/balance?account_type=$account_type",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
specialTypeSucces: "balance",
builder: (result) {
return Balance(result);
},
endpoint:
"GET https://api.xendit.co/balance?account_type=$account_type",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
specialTypeSucces: "balance",
builder: (result) {
return Balance(result);
},
parameters: {},
queryParameters: {},
isThrowOnError: false,
queryParameters: {},
isThrowOnError: false,
),
);
}
Expand Down
13 changes: 6 additions & 7 deletions package/general_payment/lib/package/xendit/api/get_invoice.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ extension XenditExtensionGetInvoice on Xendit {
String forUserId = "",
required String invoice_id,
required String xenditApiKey,
}) async {
}) async {
return await invokeRaw(
parameters: XenditInvokeParameters(
endpoint: "GET https://api.xendit.co/v2/invoices/$invoice_id",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
endpoint: "GET https://api.xendit.co/v2/invoices/$invoice_id",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
builder: (result) {

return Invoice(result);
},
specialTypeSucces: "invoice",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ extension XenditExtensionGetInvoiceByExternalId on Xendit {
}) async {
return await invokeRaw(
parameters: XenditInvokeParameters(
endpoint: "GET https://api.xendit.co/v2/invoices/?external_id=$external_id",
endpoint:
"GET https://api.xendit.co/v2/invoices/?external_id=$external_id",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
builder: (result) {

return Invoice(result);
},
specialTypeSucces: "invoice",
Expand Down
13 changes: 6 additions & 7 deletions package/general_payment/lib/package/xendit/api/get_invoices.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ extension XenditExtensionGetInvoices on Xendit {
Future<Invoices> getInvoices({
String forUserId = "",
required String xenditApiKey,
}) async {
}) async {
return await invokeRaw(
parameters: XenditInvokeParameters(
endpoint: "GET https://api.xendit.co/v2/invoices",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
endpoint: "GET https://api.xendit.co/v2/invoices",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
builder: (result) {

return Invoices(result);
},
specialTypeSucces: "invoices",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ extension XenditExtensiongetPayOutLinkById on Xendit {
String forUserId = "",
required String id,
required String xenditApiKey,
}) async {
}) async {
return await invokeRaw(
parameters: XenditInvokeParameters(
endpoint: "GET https://api.xendit.co/payouts/$id",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
builder: (result) {
return PayOutLink(result);
},
endpoint: "GET https://api.xendit.co/payouts/$id",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
builder: (result) {
return PayOutLink(result);
},
specialTypeSucces: "payOutLink",
parameters: {},
queryParameters: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ extension XenditExtensionsetInvoiceExpireByInvoiceId on Xendit {
required String invoice_id,
required String xenditApiKey,
}) async {

return await invokeRaw(
parameters: XenditInvokeParameters(
endpoint: "POST https://api.xendit.co/invoices/$invoice_id/expire!",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
builder: (result) {
return Invoice(result);
},
endpoint: "POST https://api.xendit.co/invoices/$invoice_id/expire!",
xenditApiKey: xenditApiKey,
headers: {
"for-user-id": forUserId,
},
builder: (result) {
return Invoice(result);
},
specialTypeSucces: "invoice",
parameters: {},
queryParameters: {},
Expand Down
27 changes: 12 additions & 15 deletions package/general_payment/lib/package/xendit/api/update_account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,22 @@ extension XenditExtensionupdateAccount on Xendit {
required String bussiness_name,
Map<String, String>? headers,
required String xenditApiKey,
}) async {

}) async {
return await invokeRaw(
parameters: XenditInvokeParameters(

endpoint: "PATCH https://api.xendit.co/v2/accounts/{id}",
xenditApiKey: xenditApiKey,
parameters: {
"email": email,
"public_profile": {
"business_name": bussiness_name,
endpoint: "PATCH https://api.xendit.co/v2/accounts/{id}",
xenditApiKey: xenditApiKey,
parameters: {
"email": email,
"public_profile": {
"business_name": bussiness_name,
},
},
headers: headers,
builder: (result) {
return Account(result);
},
},
headers: headers,
builder: (result) {
return Account(result);
},
specialTypeSucces: "account",

queryParameters: {},
isThrowOnError: false,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
final List<Map<String, dynamic>> api_schemes = [

];
final List<Map<String, dynamic>> api_schemes = [];
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ final List<Map<String, dynamic>> respond_schemes = [
"expiration_timestamp": "2023-02-07T18:22:14.632Z",
"created": "2023-02-04T18:22:13.249Z",
"email": "",
"payout_url": "https://payout-staging.xendit.co/web/acb0a7a4-82fb-47de-8d91-f302c5350cc6",
"payout_url":
"https://payout-staging.xendit.co/web/acb0a7a4-82fb-47de-8d91-f302c5350cc6",
},
{
"@type": "transactionBalanceAccount",
Expand All @@ -46,10 +47,12 @@ final List<Map<String, dynamic>> respond_schemes = [
"user_id": "610836e3824b6140a513dc38",
"status": "PENDING",
"merchant_name": "HEXAMINATE",
"merchant_profile_picture_url": "https://xnd-merchant-logos.s3.amazonaws.com/business/production/610836e3824b6140a513dc38-1648053563560.png",
"merchant_profile_picture_url":
"https://xnd-merchant-logos.s3.amazonaws.com/business/production/610836e3824b6140a513dc38-1648053563560.png",
"amount": 100000,
"expiry_date": "2023-02-05T18:08:16.896Z",
"invoice_url": "https://checkout-staging.xendit.co/web/63de9f1099c9419bdf5266c7",
"invoice_url":
"https://checkout-staging.xendit.co/web/63de9f1099c9419bdf5266c7",
"available_banks": [
{
"bank_code": "MANDIRI",
Expand Down
2 changes: 1 addition & 1 deletion package/general_payment/lib/package/xendit/xendit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ Bukan maksud kami menipu itu karena harga yang sudah di kalkulasi + bantuan tiba
<!-- END LICENSE --> */
export "xendit_core.dart";

export "api/api.dart";
export "api/api.dart";
Loading

0 comments on commit ea8d558

Please sign in to comment.