Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose refund time to console purchases/subscription views. #974

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 13 additions & 12 deletions apigrpc/apigrpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions apigrpc/apigrpc.proto
Expand Up @@ -58,10 +58,11 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
}
}
security: {
// Made up security so we can apply "Bearer <JWT_TOKEN>"
key: "BearerJwt";
key: "BearerJwt"
value: {
type: TYPE_INVALID;
type: TYPE_API_KEY
in: IN_HEADER
name: "Authorization"
}
}
security: {
Expand Down
4 changes: 3 additions & 1 deletion apigrpc/apigrpc.swagger.json
Expand Up @@ -5225,7 +5225,9 @@
"type": "basic"
},
"BearerJwt": {
"type": ""
"type": "apiKey",
"name": "Authorization",
"in": "header"
},
"HttpKeyAuth": {
"type": "apiKey",
Expand Down
23 changes: 12 additions & 11 deletions console/console.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions console/console.proto
Expand Up @@ -55,9 +55,12 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
}
}
security: {
// Made up security so we can apply "Bearer <JWT_TOKEN>"
key: "BearerJwt";
value: {};
key: "BearerJwt"
value: {
type: TYPE_API_KEY
in: IN_HEADER
name: "Authorization"
}
}
}
// Default security definition.
Expand Down
4 changes: 3 additions & 1 deletion console/console.swagger.json
Expand Up @@ -4063,7 +4063,9 @@
"type": "basic"
},
"BearerJwt": {
"type": ""
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
},
"security": [
Expand Down
2 changes: 1 addition & 1 deletion console/ui/dist/prod-nt/index.html
Expand Up @@ -10,5 +10,5 @@
<link rel="stylesheet" href="static/styles.14b882f135e080634619.css"></head>
<body class="h-100">
<app-root></app-root>
<script src="static/runtime.4ced225923cd14368d64.js" defer=""></script><script src="static/polyfills.cb4331e883de4daa4c94.js" defer=""></script><script src="static/main.8e218c242568953c057c.js" defer=""></script></body>
<script src="static/runtime.4ced225923cd14368d64.js" defer=""></script><script src="static/polyfills.cb4331e883de4daa4c94.js" defer=""></script><script src="static/main.6c39b14c019905e4d727.js" defer=""></script></body>
</html>

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion console/ui/dist/prod/index.html
Expand Up @@ -10,5 +10,5 @@
<link rel="stylesheet" href="static/styles.14b882f135e080634619.css"></head>
<body class="h-100">
<app-root></app-root>
<script src="static/runtime.4ced225923cd14368d64.js" defer=""></script><script src="static/polyfills.cb4331e883de4daa4c94.js" defer=""></script><script src="static/main.fccf1eefb431fad17814.js" defer=""></script></body>
<script src="static/runtime.4ced225923cd14368d64.js" defer=""></script><script src="static/polyfills.cb4331e883de4daa4c94.js" defer=""></script><script src="static/main.eae8e312bbf936b64915.js" defer=""></script></body>
</html>

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions console/ui/src/app/account/purchases/purchases.component.html
Expand Up @@ -25,10 +25,11 @@ <h6 class="mr-2 d-inline font-weight-bold">Error while processing request: {{err
<th>Store</th>
<th style="width: 180px">Purchase Time</th>
<th style="width: 180px">Create Time</th>
<th style="width: 180px">Refund Time</th>
</tr>
</thead>
<tbody>
<ng-template ngFor let-i="index" let-p [ngForOf]="purchases">
<ng-template ngFor let-i="index" let-p [ngForOf]="purchases">
<tr>
<td>
<div class="arrow" (click)="purchasesRowsOpen[i]=!purchasesRowsOpen[i];">
Expand All @@ -41,9 +42,10 @@ <h6 class="mr-2 d-inline font-weight-bold">Error while processing request: {{err
<td>{{getStoreText(p.store)}}</td>
<td>{{p.purchase_time}}</td>
<td>{{p.create_time}}</td>
<td>{{getRefundText(p.refund_time)}}</td>
</tr>
<tr *ngIf="purchasesRowsOpen[i]" class="open-row">
<td colspan="7">
<td colspan="6">
<div class="p-2">
<div><small><b>Provider Response</b></small></div>
<div>
Expand All @@ -53,7 +55,7 @@ <h6 class="mr-2 d-inline font-weight-bold">Error while processing request: {{err
</td>
</tr>
</ng-template>
<tr *ngIf="purchases.length === 0"><td colspan="5" class="text-muted">No purchases were found.</td></tr>
<tr *ngIf="purchases.length === 0"><td colspan="6" class="text-muted">No purchases were found.</td></tr>
</tbody>
</table>
</div>
7 changes: 7 additions & 0 deletions console/ui/src/app/account/purchases/purchases.component.ts
Expand Up @@ -66,6 +66,13 @@ export class PurchasesComponent implements OnInit {
return this.formatStoreText(ApiStoreProvider[store]);
}

getRefundText(time: string): string {
if (time === '1970-01-01T00:00:00Z') {
return '';
}
return time;
}

formatStoreText(label: string): string {
return label.split('_').map(s => s[0] + s.slice(1).toLowerCase()).join(' ');
}
Expand Down
Expand Up @@ -26,20 +26,41 @@ <h6 class="mr-2 d-inline font-weight-bold">Error while processing request: {{err
<th style="width: 180px">Purchase Time</th>
<th style="width: 180px">Expiry Time</th>
<th style="width: 180px">Create Time</th>
<th style="width: 180px">Refund Time</th>
</tr>
</thead>
<tbody>
<ng-template ngFor let-i="index" let-p [ngForOf]="subscriptions">
<ng-template ngFor let-i="index" let-p [ngForOf]="subscriptions">
<tr>
<td>{{p.product_id}}</td>
<td>
<div class="arrow" (click)="subscriptionsRowOpen[i]=!subscriptionsRowOpen[i];">
<div class="arrow-right" *ngIf="!subscriptionsRowOpen[i]"></div>
<div class="arrow-down" *ngIf="subscriptionsRowOpen[i]"></div>
</div>
{{p.product_id}}
</td>
<td>{{p.original_transaction_id}}</td>
<td>{{getStoreText(p.store)}}</td>
<td>{{p.purchase_time}}</td>
<td>{{p.expiry_time}}</td>
<td>{{p.create_time}}</td>
<td>{{getRefundText(p.refund_time)}}</td>
</tr>
<tr *ngIf="subscriptionsRowOpen[i]" class="open-row">
<td colspan="7">
<div class="p-2">
<div><small><b>Provider Response</b></small></div>
<div>
<pre class="pre-wrap m-0 p-0"><small>{{p.provider_response}}</small></pre>
</div>
<div class="pt-2"><small><b>Provider Notification</b></small></div>
<div>
<pre class="pre-wrap m-0 p-0"><small>{{p.provider_notification}}</small></pre>
</div>
</div>
</tr>
</ng-template>
<tr *ngIf="subscriptions.length === 0"><td colspan="6" class="text-muted">No purchases were found.</td></tr>
<tr *ngIf="subscriptions.length === 0"><td colspan="7" class="text-muted">No subscriptions were found.</td></tr>
</tbody>
</table>
</div>
Expand Up @@ -29,6 +29,7 @@ import {Observable} from 'rxjs';
})
export class SubscriptionsComponent implements OnInit {
public subscriptions: ApiValidatedSubscription[] = [];
public subscriptionsRowOpen: boolean[] = [];
public error = '';
public nextCursor = '';
public prevCursor = '';
Expand Down Expand Up @@ -58,6 +59,7 @@ export class SubscriptionsComponent implements OnInit {
cursor,
).subscribe(res => {
this.subscriptions = res.validated_subscriptions;
this.subscriptionsRowOpen = [];
this.nextCursor = res.cursor;
this.prevCursor = res.prev_cursor;
}, error => {
Expand All @@ -69,14 +71,22 @@ export class SubscriptionsComponent implements OnInit {
return this.formatStoreText(ApiStoreProvider[store]);
}

getRefundText(time: string): string {
if (time === '1970-01-01T00:00:00Z') {
return '';
}
return time;
}

formatStoreText(label: string): string {
return label.split('_').map(s => s[0] + s.slice(1).toLowerCase()).join(' ');
}
}

@Injectable({providedIn: 'root'})
export class SubscriptionsResolver implements Resolve<ApiPurchaseList> {
constructor(private readonly consoleService: ConsoleService) {}
constructor(private readonly consoleService: ConsoleService) {
}

resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<ApiSubscriptionList> {
const userId = route.parent.paramMap.get('id');
Expand Down