This commit is contained in:
caf 2023-04-26 15:52:01 +04:00
parent 484864adca
commit 735090421d
3 changed files with 52 additions and 0 deletions

View File

@ -117,3 +117,12 @@ export interface Refund {
difference_return: ref;
full_return: ref;
}
export interface PaymentRefund {
id: string,
payment_id: string,
data: {
token: string
},
amount: number,
status: string,
}

View File

@ -169,6 +169,25 @@
</tr>
</ng-template>
</p-table>
<div *ngIf="paymentRefunds.length">
<h2>Список возвратов:</h2>
<p-table [value]="paymentRefunds">
<ng-template pTemplate="header">
<tr>
<th>Сумма</th>
<th>Статус</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-paymentRefund>
<tr>
<td>{{paymentRefund.amount}}</td>
<td>{{paymentRefund.status}}</td>
</tr>
</ng-template>
</p-table>
</div>
</div>
</ng-template>

View File

@ -8,6 +8,7 @@ import {
Delivery_address,
Notification,
Refund,
PaymentRefund,
} from 'src/app/interface/data';
import { ClientsComponent } from '../clients/clients.component';
import { ToastModule } from 'primeng/toast';
@ -31,6 +32,7 @@ import { environment } from 'src/environments/environment.prod';
export class OrdersComponent implements OnInit {
public orders: Array<Order> = [];
public order: Array<Order> = [];
public paymentRefunds: Array<PaymentRefund> = [];
public view: boolean = true;
public chooseName!: string;
public lastOrderUpdateTime: string = '';
@ -321,6 +323,7 @@ export class OrdersComponent implements OnInit {
]).subscribe({
next: ([paymentData, paymentStatus]) => {
const payment_request = paymentData.result.payment_request;
this.getPaymentRefunds(payment_request.id);
this.order[0].payment = [{
summ: payment_request.amount,
type: payment_request.type,
@ -407,6 +410,27 @@ export class OrdersComponent implements OnInit {
});
}
getPaymentRefunds(paymentRequestId: string) {
this.jsonRpcService.rpc2(
{
method: 'getPaymentRefunds',
params: {payment_request_id: paymentRequestId},
},
RpcService.authService,
false,
location.origin
)
.subscribe({
next: (value) => {
console.log(value);
this.paymentRefunds = value;
},
error: (err) => {
console.log('ERROR: ', err);
},
});
}
doAdminRefund(id: any, type: any, id_: any) {
this.dis = false;
let qr_id: string;