mirror of
https://github.com/valitydev/koffing.git
synced 2024-11-06 01:05:19 +00:00
FE-540: added qiwi support (#188)
This commit is contained in:
parent
c3a6fbf69a
commit
f93c6c30ad
@ -1,4 +1,5 @@
|
||||
export const PAYMENT_METHOD = {
|
||||
bankCard: 'bankCard',
|
||||
paymentTerminal: 'paymentTerminal'
|
||||
paymentTerminal: 'paymentTerminal',
|
||||
digitalWallet: 'digitalWallet'
|
||||
};
|
||||
|
@ -1,3 +1,4 @@
|
||||
export * from './payment-method';
|
||||
export * from './payment-method-bank-card';
|
||||
export * from './payment-method-terminal';
|
||||
export * from './payment-method-wallets';
|
||||
|
@ -0,0 +1,11 @@
|
||||
import { PaymentMethod } from './payment-method';
|
||||
|
||||
export class PaymentMethodWallets extends PaymentMethod {
|
||||
|
||||
public providers: string[];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.method = 'DigitalWallet';
|
||||
}
|
||||
}
|
@ -11,18 +11,6 @@ form([formGroup]="form", novalidate)
|
||||
label.text-left Описание вашего продукта или сервиса:
|
||||
.col-xs-12.col-sm-7
|
||||
input.form-control(type="text", formControlName="description")
|
||||
.form-group
|
||||
.row
|
||||
.col-xs-12.col-sm-5
|
||||
label.text-left Текст кнопки оплаты:
|
||||
.col-xs-12.col-sm-7
|
||||
input.form-control(type="text", formControlName="payButtonLabel")
|
||||
.form-group
|
||||
.row
|
||||
.col-xs-12.col-sm-5
|
||||
label.text-left URL для задания логотипа:
|
||||
.col-xs-12.col-sm-7
|
||||
input.form-control(type="text", formControlName="logo", placeholder="http(s)://example.com/image.png")
|
||||
.form-group
|
||||
.row
|
||||
.col-xs-12.col-sm-5
|
||||
@ -37,13 +25,13 @@ form([formGroup]="form", novalidate)
|
||||
input.form-control(type="text", formControlName="redirectUrl", placeholder="http(s)://example.com")
|
||||
.form-group(*ngIf="additionalMethods")
|
||||
.row
|
||||
.col-xs-12.col-sm-5
|
||||
.col-xs-12
|
||||
label.text-left Дополнительные методы оплаты:
|
||||
.col-xs-12.col-sm-5
|
||||
.col-xs-12.col-sm-6.col-md-4(*ngFor="let method of configurableMethods")
|
||||
label.text-left
|
||||
input(type="checkbox", formControlName="terminals", (click)="toggleTerminals()")
|
||||
| Терминалы "Евросеть"
|
||||
div(*ngIf="!form.value.terminals")
|
||||
input(type="checkbox", formControlName="{{getInfo(method.method).formControlName}}", (click)="toggleHolds()")
|
||||
| {{getInfo(method.method).label}}
|
||||
div(*ngIf="!form.value.terminals && !form.value.wallets")
|
||||
.ln_solid
|
||||
.form-group
|
||||
.row
|
||||
|
@ -5,7 +5,11 @@ import { SelectItem } from 'koffing/common/select/select-item';
|
||||
import { HOLD_EXPIRATION } from 'koffing/backend/constants/hold-expiration';
|
||||
import { CheckoutConfigFormService } from './checkout-config-form.service';
|
||||
import { PaymentMethod } from 'koffing/backend/model/payment-method/payment-method';
|
||||
import { PaymentMethodTerminal } from 'koffing/backend/model/payment-method/payment-method-terminal';
|
||||
|
||||
interface ConfigurablePaymentMethodInfo {
|
||||
label: string;
|
||||
formControlName: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'kof-checkout-config-form',
|
||||
@ -17,6 +21,8 @@ export class CheckoutConfigFormComponent implements OnInit, OnChanges {
|
||||
@Input()
|
||||
public methods: PaymentMethod[];
|
||||
|
||||
public configurableMethods: PaymentMethod[];
|
||||
|
||||
public form: FormGroup;
|
||||
|
||||
public holdExpirationItems: SelectItem[];
|
||||
@ -31,14 +37,13 @@ export class CheckoutConfigFormComponent implements OnInit, OnChanges {
|
||||
new SelectItem(HOLD_EXPIRATION.capture, 'в пользу мерчанта')
|
||||
];
|
||||
this.form = this.checkoutConfigFormService.form;
|
||||
|
||||
}
|
||||
|
||||
public ngOnChanges() {
|
||||
if (this.methods) {
|
||||
const terminal = this.methods.find((method) => method.method === 'PaymentTerminal') as PaymentMethodTerminal;
|
||||
if (terminal) {
|
||||
this.additionalMethods = !!terminal.providers.find((provider) => provider === 'euroset');
|
||||
}
|
||||
this.configurableMethods = this.methods.filter((method) => method.method !== 'BankCard');
|
||||
this.additionalMethods = this.methods.length > 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,10 +51,25 @@ export class CheckoutConfigFormComponent implements OnInit, OnChanges {
|
||||
return this.form.value.holdExpiration === holdExpiration;
|
||||
}
|
||||
|
||||
public toggleTerminals() {
|
||||
public getInfo(methodName: string): ConfigurablePaymentMethodInfo {
|
||||
switch (methodName) {
|
||||
case 'PaymentTerminal':
|
||||
return {
|
||||
label: 'Терминалы "Евросеть"',
|
||||
formControlName: 'terminals'
|
||||
};
|
||||
case 'DigitalWallet':
|
||||
return {
|
||||
label: 'QIWI кошелек',
|
||||
formControlName: 'wallets'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public toggleHolds() {
|
||||
this.form.patchValue({
|
||||
paymentFlowHold: false,
|
||||
terminals: !this.form.value.terminals
|
||||
paymentFlowHold: false
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,14 +15,13 @@ export class CheckoutConfigFormService {
|
||||
private initForm(): FormGroup {
|
||||
return this.fb.group({
|
||||
name: ['', [Validators.maxLength(30)]],
|
||||
description: ['', [Validators.maxLength(30)]],
|
||||
payButtonLabel: ['', [Validators.maxLength(30)]],
|
||||
logo: [''],
|
||||
description: [''],
|
||||
email: [''],
|
||||
redirectUrl: [''],
|
||||
paymentFlowHold: [false, [Validators.required] ],
|
||||
holdExpiration: [HOLD_EXPIRATION.cancel, [Validators.required]],
|
||||
terminals: false
|
||||
terminals: true,
|
||||
wallets: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -14,4 +14,5 @@ export class PaymentLinkArguments {
|
||||
public paymentFlowHold?: boolean;
|
||||
public holdExpiration?: string;
|
||||
public terminals?: boolean;
|
||||
public wallets?: boolean;
|
||||
}
|
||||
|
@ -92,6 +92,7 @@ export class PaymentLinkService {
|
||||
args.applePayTest = true;
|
||||
}
|
||||
args.terminals = formValue.terminals;
|
||||
args.wallets = formValue.wallets;
|
||||
return args;
|
||||
}
|
||||
|
||||
|
@ -77,17 +77,32 @@ form.form-horizontal.form-label-left.css-form
|
||||
label.col-sm-5 Метод оплаты:
|
||||
.col-sm-7
|
||||
div {{payment.payer?.paymentToolDetails?.detailsType | kofPaymentToolDetailsType}}
|
||||
|
||||
.row
|
||||
.col-xs-12(*ngIf="payment.payer?.paymentToolDetails?.detailsType === 'PaymentToolDetailsPaymentTerminal'")
|
||||
.form-group
|
||||
label.col-sm-5 Провайдер:
|
||||
.col-sm-7
|
||||
div {{payment.payer?.paymentToolDetails?.provider | kofProviderName}}
|
||||
|
||||
.col-xs-12(*ngIf="payment.payer?.paymentToolDetails?.detailsType === 'PaymentToolDetailsDigitalWallet'")
|
||||
.form-group
|
||||
label.col-sm-5 Провайдер:
|
||||
.col-sm-7
|
||||
div {{payment.payer?.paymentToolDetails?.digitalWalletDetailsType | kofProviderName}}
|
||||
|
||||
.col-xs-12(*ngIf="payment.payer?.paymentToolDetails?.detailsType === 'PaymentToolDetailsBankCard'")
|
||||
.form-group
|
||||
label.col-sm-5 Данные карты:
|
||||
.col-sm-7
|
||||
div **** **** **** {{payment.payer?.paymentToolDetails?.cardNumberMask}} ({{payment.payer?.paymentToolDetails?.paymentSystem}})
|
||||
|
||||
.col-xs-12(*ngIf="payment.payer?.paymentToolDetails?.detailsType === 'PaymentToolDetailsDigitalWallet'")
|
||||
.form-group
|
||||
label.col-sm-5 Данные кошелька:
|
||||
.col-sm-7
|
||||
div {{payment.payer?.paymentToolDetails?.phoneNumberMask}}
|
||||
|
||||
div(*ngIf="payment.payer?.payerType === 'CustomerPayer'")
|
||||
.row
|
||||
.col-xs-12
|
||||
|
@ -7,7 +7,8 @@ export class PaymentToolDetailsTypePipe implements PipeTransform {
|
||||
|
||||
private names = {
|
||||
PaymentToolDetailsPaymentTerminal: 'Терминал',
|
||||
PaymentToolDetailsBankCard: 'Банковская карта'
|
||||
PaymentToolDetailsBankCard: 'Банковская карта',
|
||||
PaymentToolDetailsDigitalWallet: 'Электронный кошелек'
|
||||
};
|
||||
|
||||
public transform(input: string): string {
|
||||
|
@ -7,6 +7,7 @@ export class ProviderNamePipe implements PipeTransform {
|
||||
|
||||
private names = {
|
||||
euroset: 'Евросеть',
|
||||
DigitalWalletDetailsQIWI: 'QIWI'
|
||||
};
|
||||
|
||||
public transform(input: string): string {
|
||||
|
@ -2,5 +2,6 @@ import { PAYMENT_METHOD } from 'koffing/backend';
|
||||
|
||||
export const PAYMENT_METHOD_LABEL = {
|
||||
[PAYMENT_METHOD.bankCard]: 'Банковская карта',
|
||||
[PAYMENT_METHOD.paymentTerminal]: 'Платежный терминал'
|
||||
[PAYMENT_METHOD.paymentTerminal]: 'Платежный терминал',
|
||||
// [PAYMENT_METHOD.digitalWallet]: 'Электронный кошелек'
|
||||
};
|
||||
|
@ -34,6 +34,7 @@
|
||||
"pipe-naming": [true, "camelCase", "kof"],
|
||||
"component-class-suffix": true,
|
||||
"directive-class-suffix": true,
|
||||
"pipe-impure": true
|
||||
"pipe-impure": true,
|
||||
"interface-name": false
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user