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>
<div class="modal-body"> <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> <ngx-paypal [config]="payPalConfig"></ngx-paypal>
</div> </div>
@ -11,9 +16,5 @@
<button type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal" (click)="cancel()"> <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> <fa-icon icon="arrow-left"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
</button> </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> </div>
</form> </form>

View File

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