@@ -22,6 +22,8 @@ import { InitPaymentRequest } from './dto'
2222@Injectable ( )
2323export class PaymentService {
2424 private readonly HOSTS_APP : string
25+ private readonly HOSTS_REST : string
26+
2527 private readonly SUBSCRIPTION_PRICE = 349
2628
2729 public constructor (
@@ -31,6 +33,7 @@ export class PaymentService {
3133 private readonly heleketService : HeleketService
3234 ) {
3335 this . HOSTS_APP = this . configService . getOrThrow < string > ( 'HOSTS_APP' )
36+ this . HOSTS_REST = this . configService . getOrThrow < string > ( 'HOSTS_REST' )
3437 }
3538
3639 public async create ( dto : InitPaymentRequest , user : User ) {
@@ -80,19 +83,15 @@ export class PaymentService {
8083 )
8184 break
8285 case PaymentMethod . CRYPTO :
83- // providerResponse = await this.heleketService.createPayment({
84- // // amount: String(this.SUBSCRIPTION_PRICE),
85- // amount: '40',
86- // currency: 'RUB',
87- // order_id: payment.id,
88- // url_return: 'http://localhost:14701/premium',
89- // url_success: 'http://localhost:14701/payment/success',
90- // url_callback:
91- // 'https://72263b5f4671.ngrok-free.app/webhook/crypto'
92- // })
93- throw new BadRequestException (
94- 'This payment method is not available yet'
95- )
86+ providerResponse = await this . heleketService . createPayment ( {
87+ amount : String ( this . SUBSCRIPTION_PRICE ) ,
88+ currency : 'RUB' ,
89+ order_id : payment . id ,
90+ url_return : `${ this . HOSTS_APP } /payment/success` ,
91+ url_success : `${ this . HOSTS_APP } /premium` ,
92+ url_callback : `${ this . HOSTS_REST } /webhook/crypto`
93+ } )
94+ break
9695 default :
9796 throw new BadRequestException ( 'Unsupported payment provider' )
9897 }
0 commit comments