File tree Expand file tree Collapse file tree 2 files changed +4
-13
lines changed
components/settings/billing-page Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Original file line number Diff line number Diff line change 42
42
{{ /if }}
43
43
</div >
44
44
<div class =" flex items-center justify-end" >
45
- {{ #if (and charge.invoiceId charge.statusIsSucceeded )}}
45
+ {{ #if (and charge.receiptUrl charge.statusIsSucceeded )}}
46
46
<a
47
- href ={{ charge.invoiceDownloadUrl }}
47
+ href ={{ charge.receiptUrl }}
48
48
target =" _blank"
49
49
class =" text-teal-500 dark:text-teal-400 hover:text-teal-600 dark:hover:text-teal-300 font-semibold text-sm"
50
50
data-test-download-invoice-link
51
51
rel =" noopener noreferrer"
52
52
>
53
- Download Invoice
53
+ View Invoice
54
54
</a >
55
55
{{ else if charge.statusIsFailed}}
56
56
<span class =" text-gray-600 dark:text-gray-300 text-sm" >Payment failed</span >
Original file line number Diff line number Diff line change 1
1
import Model , { attr , belongsTo } from '@ember-data/model' ;
2
- import config from 'codecrafters-frontend/config/environment' ;
3
2
import type UserModel from 'codecrafters-frontend/models/user' ;
4
3
import { equal } from '@ember/object/computed' ; // eslint-disable-line ember/no-computed-properties-in-native-classes
5
4
@@ -10,7 +9,7 @@ export default class Charge extends Model {
10
9
@attr ( 'number' ) declare amountRefunded : number ;
11
10
@attr ( 'date' ) declare createdAt : Date ;
12
11
@attr ( 'string' ) declare currency : string ;
13
- @attr ( 'string' ) declare invoiceId : string ;
12
+ @attr ( 'string' ) declare receiptUrl : string ;
14
13
@attr ( 'string' ) declare status : 'succeeded' | 'pending' | 'failed' ;
15
14
16
15
@belongsTo ( 'user' , { async : false , inverse : null } ) declare user : UserModel ;
@@ -23,14 +22,6 @@ export default class Charge extends Model {
23
22
return Charge . buildDisplayString ( this . amount , this . currency ) ;
24
23
}
25
24
26
- get invoiceDownloadUrl ( ) {
27
- if ( ! this . invoiceId ) {
28
- return null ;
29
- }
30
-
31
- return `${ config . x . backendUrl } /invoices/${ this . invoiceId } /download` ;
32
- }
33
-
34
25
get isFullyRefunded ( ) {
35
26
return this . amountRefunded === this . amount ;
36
27
}
You can’t perform that action at this time.
0 commit comments