Browse Source

feat(admin-ui): Implement creation of new PaymentMethods

Relates to #671
Michael Bromley 5 years ago
parent
commit
09a1a972f8

+ 26 - 26
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
     }
   }
-}
+}

+ 7 - 7
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<Scalars['String']>;
+  defaultValue?: Maybe<Scalars['JSON']>;
   label?: Maybe<Scalars['String']>;
   description?: Maybe<Scalars['String']>;
   ui?: Maybe<Scalars['JSON']>;
@@ -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

+ 1 - 1
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;
 }

+ 1 - 0
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 }}
         </button>

+ 1 - 0
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'), {

+ 4 - 0
packages/admin-ui/src/lib/settings/src/components/payment-method-list/payment-method-list.component.html

@@ -1,6 +1,10 @@
 <vdr-action-bar>
     <vdr-ab-right>
         <vdr-action-bar-items locationId="payment-method-list"></vdr-action-bar-items>
+        <a class="btn btn-primary" [routerLink]="['./create']" *vdrIfPermissions="'CreateSettings'">
+            <clr-icon shape="plus"></clr-icon>
+            {{ 'settings.create-new-payment-method' | translate }}
+        </a>
     </vdr-ab-right>
 </vdr-action-bar>
 

+ 2 - 1
packages/admin-ui/src/lib/settings/src/providers/routing/payment-method-resolver.ts

@@ -23,7 +23,8 @@ export class PaymentMethodResolver extends BaseEntityResolver<PaymentMethod.Frag
                 code: '',
                 description: '',
                 enabled: true,
-                handler: {} as any,
+                checker: undefined as any,
+                handler: undefined as any,
             },
             id => dataService.settings.getPaymentMethod(id).mapStream(data => data.paymentMethod),
         );

+ 4 - 2
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"
   }
-}
+}

+ 4 - 2
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"
   }
-}
+}

+ 3 - 1
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",

+ 4 - 2
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"
   }
-}
+}

+ 4 - 2
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"
   }
-}
+}

+ 4 - 2
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"
   }
-}
+}

+ 5 - 3
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"
   }
-}
+}

+ 4 - 2
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": ""
   }
-}
+}

+ 4 - 2
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": ""
   }
-}
+}