modificaciones de PayPal

This commit is contained in:
Paola 2021-08-09 18:58:06 -06:00
parent e2fbc4a607
commit 3ef698c0d3
3 changed files with 18 additions and 22 deletions

View File

@ -4,6 +4,11 @@
</div>
<div class="modal-body">
<h1 class="ds-title">Plantilla: {{ plantilla!.nombre }}</h1>
<h2 class="ds-title--small">Cantidad: 1</h2>
<h2 class="ds-title--small">Total: ${{ plantilla!.precio }}</h2>
<hr />
<ngx-paypal [config]="payPalConfig"></ngx-paypal>
</div>
@ -11,9 +16,5 @@
<button type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal" (click)="cancel()">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button>
<button id="jhi-confirm-delete-encuesta" data-cy="entityConfirmDeleteButton" type="submit" class="ds-btn ds-btn--primary">
&nbsp;<span jhiTranslate="entity.action.publish">Delete</span>
</button>
</div>
</form>

View File

@ -4,6 +4,7 @@ import { ParametroAplicacionService } from '../../parametro-aplicacion/service/p
import { EncuestaService } from '../../encuesta/service/encuesta.service';
import { FormBuilder } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { IPlantilla } from '../../plantilla/plantilla.model';
@Component({
selector: 'jhi-paypal-dialog',
@ -13,6 +14,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
export class PaypalDialogComponent implements OnInit {
public payPalConfig?: IPayPalConfig;
showSuccess = false;
plantilla?: IPlantilla;
constructor(protected activeModal: NgbActiveModal) {}
@ -21,6 +23,7 @@ export class PaypalDialogComponent implements OnInit {
}
private initConfig(): void {
debugger;
this.payPalConfig = {
currency: 'USD',
clientId: 'sb',
@ -30,23 +33,22 @@ export class PaypalDialogComponent implements OnInit {
purchase_units: [
{
amount: {
currency_code: 'EUR',
value: '9.99',
currency_code: 'USD',
value: String(this.plantilla?.precio),
breakdown: {
item_total: {
currency_code: 'EUR',
value: '9.99',
currency_code: 'USD',
value: String(this.plantilla?.precio),
},
},
},
items: [
{
name: 'Enterprise Subscription',
name: this.plantilla?.nombre,
quantity: '1',
category: 'DIGITAL_GOODS',
unit_amount: {
currency_code: 'EUR',
value: '9.99',
currency_code: 'USD',
value: String(this.plantilla?.precio),
},
},
],
@ -61,8 +63,10 @@ export class PaypalDialogComponent implements OnInit {
layout: 'vertical',
},
onApprove: (data, actions) => {
debugger;
console.log('onApprove - transaction was approved, but not authorized', data, actions);
actions.order.get().then((details: any) => {
//calls baxkend
console.log('onApprove - you can get full order details inside onApprove: ', details);
});
},
@ -70,15 +74,6 @@ export class PaypalDialogComponent implements OnInit {
console.log('onClientAuthorization - you should probably inform your server about completed transaction at this point', data);
this.showSuccess = true;
},
onCancel: (data, actions) => {
console.log('OnCancel', data, actions);
},
onError: err => {
console.log('OnError', err);
},
onClick: (data, actions) => {
console.log('onClick', data, actions);
},
};
}

View File

@ -97,7 +97,7 @@
>
</div>
<div class="entity-body--row m-2">
<p>Calificacion</p>
<p>Calificación</p>
<fa-icon *ngFor="let i of [].constructor(encuesta.calificacion)" class="entity-icon--star" [icon]="faStar"></fa-icon>
<fa-icon
*ngFor="let i of [].constructor(5 - encuesta.calificacion!)"