From 09a1a972f8b3575cb28c8bd56617a78d92afdd0e Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Mon, 1 Feb 2021 14:28:26 +0100 Subject: [PATCH] feat(admin-ui): Implement creation of new PaymentMethods Relates to #671 --- packages/admin-ui/i18n-coverage.json | 52 +++++++++---------- .../lib/core/src/common/generated-types.ts | 14 ++--- .../utilities/configurable-operation-utils.ts | 2 +- .../payment-method-detail.component.html | 1 + .../payment-method-detail.component.ts | 1 + .../payment-method-list.component.html | 4 ++ .../routing/payment-method-resolver.ts | 3 +- .../src/lib/static/i18n-messages/cs.json | 6 ++- .../src/lib/static/i18n-messages/de.json | 6 ++- .../src/lib/static/i18n-messages/en.json | 4 +- .../src/lib/static/i18n-messages/es.json | 6 ++- .../src/lib/static/i18n-messages/fr.json | 6 ++- .../src/lib/static/i18n-messages/pl.json | 6 ++- .../src/lib/static/i18n-messages/pt_BR.json | 8 +-- .../src/lib/static/i18n-messages/zh_Hans.json | 6 ++- .../src/lib/static/i18n-messages/zh_Hant.json | 6 ++- 16 files changed, 78 insertions(+), 53 deletions(-) diff --git a/packages/admin-ui/i18n-coverage.json b/packages/admin-ui/i18n-coverage.json index 170f9f888f..42f4df3d87 100644 --- a/packages/admin-ui/i18n-coverage.json +++ b/packages/admin-ui/i18n-coverage.json @@ -1,51 +1,51 @@ { - "generatedOn": "2021-01-22T13:12:13.937Z", - "lastCommit": "d969e15cbac79672127aee5446532e3e91eb20c5", + "generatedOn": "2021-02-01T13:23:30.145Z", + "lastCommit": "56c39f8ada2711dd731de4543e48358d24212b3f", "translationStatus": { "cs": { - "tokenCount": 765, - "translatedCount": 754, - "percentage": 99 + "tokenCount": 767, + "translatedCount": 753, + "percentage": 98 }, "de": { - "tokenCount": 765, - "translatedCount": 595, - "percentage": 78 + "tokenCount": 767, + "translatedCount": 594, + "percentage": 77 }, "en": { - "tokenCount": 765, + "tokenCount": 767, "translatedCount": 764, "percentage": 100 }, "es": { - "tokenCount": 765, - "translatedCount": 457, - "percentage": 60 + "tokenCount": 767, + "translatedCount": 456, + "percentage": 59 }, "fr": { - "tokenCount": 765, - "translatedCount": 691, + "tokenCount": 767, + "translatedCount": 690, "percentage": 90 }, "pl": { - "tokenCount": 765, - "translatedCount": 550, + "tokenCount": 767, + "translatedCount": 549, "percentage": 72 }, "pt_BR": { - "tokenCount": 765, - "translatedCount": 641, - "percentage": 84 + "tokenCount": 767, + "translatedCount": 749, + "percentage": 98 }, "zh_Hans": { - "tokenCount": 765, - "translatedCount": 532, - "percentage": 70 + "tokenCount": 767, + "translatedCount": 531, + "percentage": 69 }, "zh_Hant": { - "tokenCount": 765, - "translatedCount": 532, - "percentage": 70 + "tokenCount": 767, + "translatedCount": 531, + "percentage": 69 } } -} +} \ No newline at end of file diff --git a/packages/admin-ui/src/lib/core/src/common/generated-types.ts b/packages/admin-ui/src/lib/core/src/common/generated-types.ts index 4c81de6afa..b7e80e321e 100644 --- a/packages/admin-ui/src/lib/core/src/common/generated-types.ts +++ b/packages/admin-ui/src/lib/core/src/common/generated-types.ts @@ -1476,7 +1476,7 @@ export type ImportInfo = { /** * @description * The state of a Job in the JobQueue - * + * * @docsCategory common */ export enum JobState { @@ -2569,7 +2569,7 @@ export enum DeletionResult { * @description * Permissions for administrators and customers. Used to control access to * GraphQL resolvers via the {@link Allow} decorator. - * + * * @docsCategory common */ export enum Permission { @@ -2778,7 +2778,7 @@ export type ConfigArgDefinition = { type: Scalars['String']; list: Scalars['Boolean']; required: Scalars['Boolean']; - defaultValue?: Maybe; + defaultValue?: Maybe; label?: Maybe; description?: Maybe; ui?: Maybe; @@ -2966,7 +2966,7 @@ export type CountryList = PaginatedList & { /** * @description * ISO 4217 currency code - * + * * @docsCategory common */ export enum CurrencyCode { @@ -3503,7 +3503,7 @@ export type HistoryEntryList = PaginatedList & { * region or script modifier (e.g. de_AT). The selection available is based * on the [Unicode CLDR summary list](https://unicode-org.github.io/cldr-staging/charts/37/summary/root.html) * and includes the major spoken languages of the world and any widely-used variants. - * + * * @docsCategory common */ export enum LanguageCode { @@ -3882,7 +3882,7 @@ export type OrderItem = Node & { unitPriceWithTax: Scalars['Int']; /** * The price of a single unit including discounts, excluding tax. - * + * * If Order-level discounts have been applied, this will not be the * actual taxable unit price (see `proratedUnitPrice`), but is generally the * correct price to display to customers to avoid confusion @@ -3922,7 +3922,7 @@ export type OrderLine = Node & { unitPriceWithTax: Scalars['Int']; /** * The price of a single unit including discounts, excluding tax. - * + * * If Order-level discounts have been applied, this will not be the * actual taxable unit price (see `proratedUnitPrice`), but is generally the * correct price to display to customers to avoid confusion diff --git a/packages/admin-ui/src/lib/core/src/common/utilities/configurable-operation-utils.ts b/packages/admin-ui/src/lib/core/src/common/utilities/configurable-operation-utils.ts index 7d19b05eb8..dcc7849f74 100644 --- a/packages/admin-ui/src/lib/core/src/common/utilities/configurable-operation-utils.ts +++ b/packages/admin-ui/src/lib/core/src/common/utilities/configurable-operation-utils.ts @@ -100,5 +100,5 @@ export function configurableOperationValueIsValid( * Returns a default value based on the type of the config arg. */ export function getDefaultConfigArgValue(arg: ConfigArgDefinition): any { - return arg.list ? [] : arg.defaultValue || null; // getDefaultConfigArgSingleValue(arg.type as ConfigArgType); + return arg.list ? [] : arg.defaultValue ?? null; } diff --git a/packages/admin-ui/src/lib/settings/src/components/payment-method-detail/payment-method-detail.component.html b/packages/admin-ui/src/lib/settings/src/components/payment-method-detail/payment-method-detail.component.html index e1095e544e..c612fa759a 100644 --- a/packages/admin-ui/src/lib/settings/src/components/payment-method-detail/payment-method-detail.component.html +++ b/packages/admin-ui/src/lib/settings/src/components/payment-method-detail/payment-method-detail.component.html @@ -9,6 +9,7 @@ class="btn btn-primary" *ngIf="isNew$ | async; else updateButton" [disabled]="detailForm.pristine || detailForm.invalid" + (click)="create()" > {{ 'common.create' | translate }} diff --git a/packages/admin-ui/src/lib/settings/src/components/payment-method-detail/payment-method-detail.component.ts b/packages/admin-ui/src/lib/settings/src/components/payment-method-detail/payment-method-detail.component.ts index ed4a159015..1741b7f045 100644 --- a/packages/admin-ui/src/lib/settings/src/components/payment-method-detail/payment-method-detail.component.ts +++ b/packages/admin-ui/src/lib/settings/src/components/payment-method-detail/payment-method-detail.component.ts @@ -168,6 +168,7 @@ export class PaymentMethodDetailComponent }); this.detailForm.markAsPristine(); this.changeDetector.markForCheck(); + this.router.navigate(['../', data.createPaymentMethod.id], { relativeTo: this.route }); }, err => { this.notificationService.error(_('common.notify-create-error'), { diff --git a/packages/admin-ui/src/lib/settings/src/components/payment-method-list/payment-method-list.component.html b/packages/admin-ui/src/lib/settings/src/components/payment-method-list/payment-method-list.component.html index b72dc66b5d..2b5c56dc69 100644 --- a/packages/admin-ui/src/lib/settings/src/components/payment-method-list/payment-method-list.component.html +++ b/packages/admin-ui/src/lib/settings/src/components/payment-method-list/payment-method-list.component.html @@ -1,6 +1,10 @@ + + + {{ 'settings.create-new-payment-method' | translate }} + diff --git a/packages/admin-ui/src/lib/settings/src/providers/routing/payment-method-resolver.ts b/packages/admin-ui/src/lib/settings/src/providers/routing/payment-method-resolver.ts index 5277039452..7ec8958fd2 100644 --- a/packages/admin-ui/src/lib/settings/src/providers/routing/payment-method-resolver.ts +++ b/packages/admin-ui/src/lib/settings/src/providers/routing/payment-method-resolver.ts @@ -23,7 +23,8 @@ export class PaymentMethodResolver extends BaseEntityResolver dataService.settings.getPaymentMethod(id).mapStream(data => data.paymentMethod), ); diff --git a/packages/admin-ui/src/lib/static/i18n-messages/cs.json b/packages/admin-ui/src/lib/static/i18n-messages/cs.json index 4b5fe04efb..4e64c2515c 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/cs.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/cs.json @@ -714,6 +714,7 @@ "confirm-delete-tax-rate": "Smazat daňovou sazbu?", "create-new-channel": "Vytvořit kanál", "create-new-country": "Vytvořit zemi", + "create-new-payment-method": "", "create-new-role": "Vytvořit roli", "create-new-shipping-method": "Vytvořit dodací metodu", "create-new-tax-category": "Vytvořit daňovou kategorii", @@ -734,7 +735,8 @@ "last-name": "Příjmení", "no-eligible-shipping-methods": "Nezpůsobilé pro žádnou dodací metodu", "password": "Heslo", - "payment-method-config-options": "Konfigurace platební metody", + "payment-eligibility-checker": "", + "payment-handler": "", "permissions": "Oprávnění", "prices-include-tax": "Zadávané ceny jsou včetně daně pro výchozí zónu", "profile": "Profil", @@ -798,4 +800,4 @@ "job-result": "Výsledek úlohy", "job-state": "Stav úlohy" } -} +} \ No newline at end of file diff --git a/packages/admin-ui/src/lib/static/i18n-messages/de.json b/packages/admin-ui/src/lib/static/i18n-messages/de.json index eaa6ffdafa..de61e6b984 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/de.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/de.json @@ -714,6 +714,7 @@ "confirm-delete-tax-rate": "Steuersatz löschen?", "create-new-channel": "Neuen Kanal erstellen", "create-new-country": "Neues Land erstellen", + "create-new-payment-method": "", "create-new-role": "Neue Rolle erstellen", "create-new-shipping-method": "Neue Versandart erstellen", "create-new-tax-category": "Neue Steuerkategorie erstellen", @@ -734,7 +735,8 @@ "last-name": "Nachname", "no-eligible-shipping-methods": "Keine verfügbaren Versandarten", "password": "Passwort", - "payment-method-config-options": "Konfiguration der Zahlungsart", + "payment-eligibility-checker": "", + "payment-handler": "", "permissions": "Berechtigungen", "prices-include-tax": "Preise enthalten die Steuer für die Standardzone", "profile": "", @@ -798,4 +800,4 @@ "job-result": "Job-Ergebnis", "job-state": "Job-Status" } -} +} \ No newline at end of file diff --git a/packages/admin-ui/src/lib/static/i18n-messages/en.json b/packages/admin-ui/src/lib/static/i18n-messages/en.json index eebdf7c2d1..54300a0b8e 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/en.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/en.json @@ -714,6 +714,7 @@ "confirm-delete-tax-rate": "Delete tax rate?", "create-new-channel": "Create new channel", "create-new-country": "Create new country", + "create-new-payment-method": "Create new payment method", "create-new-role": "Create new role", "create-new-shipping-method": "Create new shipping method", "create-new-tax-category": "Create tax category", @@ -734,7 +735,8 @@ "last-name": "Last name", "no-eligible-shipping-methods": "No eligible shipping methods", "password": "Password", - "payment-method-config-options": "Payment method configuration", + "payment-eligibility-checker": "Payment eligibility checker", + "payment-handler": "Payment handler", "permissions": "Permissions", "prices-include-tax": "Prices include tax for the default Zone", "profile": "Profile", diff --git a/packages/admin-ui/src/lib/static/i18n-messages/es.json b/packages/admin-ui/src/lib/static/i18n-messages/es.json index f3a40e14b2..0a3829aa76 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/es.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/es.json @@ -714,6 +714,7 @@ "confirm-delete-tax-rate": "¿Eliminar tasa de impuestos?", "create-new-channel": "Crear nuevo canal", "create-new-country": "Crear nuevo país", + "create-new-payment-method": "", "create-new-role": "Crear nuevo rol", "create-new-shipping-method": "Crear nuevo método de envío", "create-new-tax-category": "Crear categoría de impuestos", @@ -734,7 +735,8 @@ "last-name": "Apellidos", "no-eligible-shipping-methods": "No hay métodos de envío disponibles", "password": "Contraseña", - "payment-method-config-options": "Configuración método de pago", + "payment-eligibility-checker": "", + "payment-handler": "", "permissions": "Permisos", "prices-include-tax": "Los precios incluyen impuestos para la zona por defecto.", "profile": "", @@ -798,4 +800,4 @@ "job-result": "Resultado", "job-state": "Estado" } -} +} \ No newline at end of file diff --git a/packages/admin-ui/src/lib/static/i18n-messages/fr.json b/packages/admin-ui/src/lib/static/i18n-messages/fr.json index 0aedc7fd10..45752f651d 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/fr.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/fr.json @@ -714,6 +714,7 @@ "confirm-delete-tax-rate": "Supprimer le taux de taxe ?", "create-new-channel": "Créer nouveau canal", "create-new-country": "Créer nouveau pays", + "create-new-payment-method": "", "create-new-role": "Créer nouveau role", "create-new-shipping-method": "Créer nouveau mode d'expédition", "create-new-tax-category": "Créer catégorie de taxe", @@ -734,7 +735,8 @@ "last-name": "Nom", "no-eligible-shipping-methods": "Aucun mode d'expédition", "password": "Mot de passe", - "payment-method-config-options": "Configuration du mode de paiement", + "payment-eligibility-checker": "", + "payment-handler": "", "permissions": "Permissions", "prices-include-tax": "Les prix TTC pour la zone par défaut", "profile": "Profil", @@ -798,4 +800,4 @@ "job-result": "Résultat de la tâche", "job-state": "Etat de la tâche" } -} +} \ No newline at end of file diff --git a/packages/admin-ui/src/lib/static/i18n-messages/pl.json b/packages/admin-ui/src/lib/static/i18n-messages/pl.json index 1f38d17c74..7174fbff90 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/pl.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/pl.json @@ -714,6 +714,7 @@ "confirm-delete-tax-rate": "Usunąć stawke podatkową?", "create-new-channel": "Utwórz nowy kanał", "create-new-country": "Utwórz nowy kraj", + "create-new-payment-method": "", "create-new-role": "Utwórz nową role", "create-new-shipping-method": "Utwórz nową metode wysyłki", "create-new-tax-category": "Utwórz nową kategorię podatkową", @@ -734,7 +735,8 @@ "last-name": "Nazwisko", "no-eligible-shipping-methods": "Brak pasujących metod wysyłki", "password": "Hasło", - "payment-method-config-options": "Konfiguracja metody płatności", + "payment-eligibility-checker": "", + "payment-handler": "", "permissions": "Uprawnienia", "prices-include-tax": "Ceny zawierają podatek dla domyślnej strefy", "profile": "", @@ -798,4 +800,4 @@ "job-result": "Rezultat zlecenia", "job-state": "Status zlecenia" } -} +} \ No newline at end of file diff --git a/packages/admin-ui/src/lib/static/i18n-messages/pt_BR.json b/packages/admin-ui/src/lib/static/i18n-messages/pt_BR.json index 7e6ef07c64..4c5b3d0ebf 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/pt_BR.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/pt_BR.json @@ -12,7 +12,7 @@ "original-asset-size": "Tamanho do arquivo", "preview": "Pré-visualização", "remove-asset": "Excluir imagens", - "search-asset-name": "Procurar imagens por nome", + "select-asset": "", "select-assets": "Selecione imagens", "set-as-featured-asset": "Definir como imagem em destaque", "set-focal-point": "Definir ponto central", @@ -714,6 +714,7 @@ "confirm-delete-tax-rate": "Excluir taxa de imposto?", "create-new-channel": "Criar novo canal", "create-new-country": "Criar novo país", + "create-new-payment-method": "", "create-new-role": "Criar nova regra", "create-new-shipping-method": "Criar novo método de envio", "create-new-tax-category": "Criar categoria de imposto", @@ -734,7 +735,8 @@ "last-name": "Sobrenome", "no-eligible-shipping-methods": "Nenhum método de envio qualificado", "password": "Senha", - "payment-method-config-options": "Configuração do método de pagamento", + "payment-eligibility-checker": "", + "payment-handler": "", "permissions": "Permissões", "prices-include-tax": "Os preços incluem impostos para a Zona padrão", "profile": "Perfil", @@ -798,4 +800,4 @@ "job-result": "Resultado do trabalho", "job-state": "Estado do trabalho" } -} +} \ No newline at end of file diff --git a/packages/admin-ui/src/lib/static/i18n-messages/zh_Hans.json b/packages/admin-ui/src/lib/static/i18n-messages/zh_Hans.json index 523ef21c7d..e91e60d962 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/zh_Hans.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/zh_Hans.json @@ -714,6 +714,7 @@ "confirm-delete-tax-rate": "去人删除税率?", "create-new-channel": "添加销售渠道", "create-new-country": "添加国家", + "create-new-payment-method": "", "create-new-role": "添加角色", "create-new-shipping-method": "添加配送方式", "create-new-tax-category": "创建税表分类", @@ -734,7 +735,8 @@ "last-name": "姓", "no-eligible-shipping-methods": "没有符合条件的配送方式", "password": "密码", - "payment-method-config-options": "支付方式选项配置", + "payment-eligibility-checker": "", + "payment-handler": "", "permissions": "权限", "prices-include-tax": "设置默认销售区域价格含税", "profile": "", @@ -798,4 +800,4 @@ "job-result": "", "job-state": "" } -} +} \ No newline at end of file diff --git a/packages/admin-ui/src/lib/static/i18n-messages/zh_Hant.json b/packages/admin-ui/src/lib/static/i18n-messages/zh_Hant.json index 4e63d0c44c..df82a473a5 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/zh_Hant.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/zh_Hant.json @@ -714,6 +714,7 @@ "confirm-delete-tax-rate": "確認移除税率?", "create-new-channel": "新增渠道", "create-new-country": "新增國家", + "create-new-payment-method": "", "create-new-role": "新增角色", "create-new-shipping-method": "新增配送方式", "create-new-tax-category": "建立税表分類", @@ -734,7 +735,8 @@ "last-name": "姓", "no-eligible-shipping-methods": "没有符合條件的配送方式", "password": "密碼", - "payment-method-config-options": "支付方式選項配置", + "payment-eligibility-checker": "", + "payment-handler": "", "permissions": "權限", "prices-include-tax": "設定默認銷售區域價格連税", "profile": "", @@ -798,4 +800,4 @@ "job-result": "", "job-state": "" } -} +} \ No newline at end of file