Merge branch 'matt' into dev
This commit is contained in:
commit
04c33a9738
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label stacked>N° de carte</ion-label>
|
<ion-label stacked>N° de carte</ion-label>
|
||||||
<ion-input type="number"></ion-input>
|
<ion-input [(ngModel)]="cardnumber" name="cardnumber" type="number" min="0000000000000000" max="9999999999999999"></ion-input>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<ion-item>
|
<ion-item>
|
||||||
|
@ -31,17 +31,36 @@
|
||||||
<ion-input type="text"></ion-input>
|
<ion-input type="text"></ion-input>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<ion-item>
|
|
||||||
<ion-label stacked>Date d'expiration</ion-label>
|
|
||||||
<ion-input type="number"></ion-input>
|
<ion-grid>
|
||||||
</ion-item>
|
<ion-row class="cb-date">
|
||||||
|
<ion-col col-5>
|
||||||
|
<ion-item>
|
||||||
|
<ion-label stacked>Date d'expiration</ion-label>
|
||||||
|
<ion-input [(ngModel)]="mounth" name="mounth" type="number" min="1" max="12"></ion-input>
|
||||||
|
</ion-item>
|
||||||
|
</ion-col>
|
||||||
|
</ion-row>
|
||||||
|
<ion-row>
|
||||||
|
<ion-col col-2> / </ion-col>
|
||||||
|
</ion-row>
|
||||||
|
<ion-row>
|
||||||
|
<ion-col col-5>
|
||||||
|
<ion-item>
|
||||||
|
<ion-input [(ngModel)]="year" name="year" type="number"></ion-input>
|
||||||
|
</ion-item>
|
||||||
|
</ion-col>
|
||||||
|
</ion-row>
|
||||||
|
</ion-grid>
|
||||||
|
|
||||||
|
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label stacked>Cryptogramme</ion-label>
|
<ion-label stacked>Cryptogramme</ion-label>
|
||||||
<ion-input type="number"></ion-input>
|
<ion-input [(ngModel)]="cryp" name="cryp" type="number" min="000" max="999"></ion-input>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<button ion-button (click)="sendTransaction(amount)">Payer {{amount}} €</button>
|
<button ion-button (click)="sendTransaction(cardnumber, mounth, year, cryp, amount)">Payer {{amount}} €</button>
|
||||||
|
|
||||||
|
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
|
|
@ -23,19 +23,75 @@ export class BuyPage {
|
||||||
console.log('ionViewDidLoad BuyPage');
|
console.log('ionViewDidLoad BuyPage');
|
||||||
}
|
}
|
||||||
|
|
||||||
sendTransaction($amount) {
|
sendTransaction($cardnumber, $month, $year, $cryp, $amount) {
|
||||||
//TODO : Contacter l'API et proposer la transaction. L'API répondra true ou False
|
if (typeof $cardnumber !== 'undefined' && typeof $month !== 'undefined' && typeof $year !== 'undefined' && typeof $cryp !== 'undefined' && typeof $amount !== 'undefined' ) {
|
||||||
if (true === true) {
|
if (this.checkFields($cardnumber, $month, $year, $cryp)) {
|
||||||
this.navCtrl.popToRoot();
|
//TODO : Contacter l'API et proposer la transaction. L'API répondra true ou False
|
||||||
|
if (true === true) {
|
||||||
|
this.navCtrl.popToRoot();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const alert = this.alertCtrl.create({
|
||||||
|
title: 'Erreur',
|
||||||
|
subTitle: 'La transaction a échoué. Vérifiez les données saisies et réessayez.',
|
||||||
|
buttons: ['OK']
|
||||||
|
});
|
||||||
|
alert.present();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const alert = this.alertCtrl.create({
|
const alert = this.alertCtrl.create({
|
||||||
title: 'Erreur',
|
title: 'Champs vides',
|
||||||
subTitle: 'La transaction a échoué. Vérifiez les données saisies et réessayez.',
|
subTitle: 'Merci de remplir tous les champs',
|
||||||
buttons: ['OK']
|
buttons: ['OK']
|
||||||
});
|
});
|
||||||
alert.present();
|
alert.present();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Vérification des champs
|
||||||
|
checkFields(cardnumber, month, year, cryp) {
|
||||||
|
if (!this.checkCardInfoIntegrity(12, 19, cardnumber) || !this.checkCardInfoIntegrity(3, 4, cryp) || !this.checkCardInfoValue(0, 9999, cryp)) {
|
||||||
|
const alert = this.alertCtrl.create({
|
||||||
|
title: 'Erreur',
|
||||||
|
subTitle: 'Le numéro de carte bancaire est erroné. Vérifiez les données et recommencez.',
|
||||||
|
buttons: ['OK']
|
||||||
|
});
|
||||||
|
alert.present();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (!this.checkCardInfoIntegrity(1, 2, month) || !this.checkCardInfoValue(1, 12, month) || !this.checkCardInfoIntegrity(4, 4, year) || !this.checkCardInfoValue(2018, 2050, year)) {
|
||||||
|
const alert = this.alertCtrl.create({
|
||||||
|
title: 'Erreur',
|
||||||
|
subTitle: 'La date est erronée. Vérifiez les données et recommencez.',
|
||||||
|
buttons: ['OK']
|
||||||
|
});
|
||||||
|
alert.present();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
checkCardInfoIntegrity($min, $max, $number) {
|
||||||
|
$number = parseInt($number);
|
||||||
|
if ($number.length < $min || $number.length > $max) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkCardInfoValue($min, $max, $number) {
|
||||||
|
$number = parseInt($number);
|
||||||
|
if ($number < $min || $number > $max) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,6 @@
|
||||||
|
|
||||||
<ion-navbar>
|
<ion-navbar>
|
||||||
<ion-title>Mon compte</ion-title>
|
<ion-title>Mon compte</ion-title>
|
||||||
<ion-buttons>
|
|
||||||
<button ion-item (click)="closeConnexion()">Se déconnecter</button>
|
|
||||||
</ion-buttons>
|
|
||||||
</ion-navbar>
|
</ion-navbar>
|
||||||
|
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
@ -32,6 +29,7 @@
|
||||||
<button ion-item (click)="changePage('buy')">Acheter de la monnaie locale</button>
|
<button ion-item (click)="changePage('buy')">Acheter de la monnaie locale</button>
|
||||||
<button ion-item (click)="changePage('send')">Faire un virement</button>
|
<button ion-item (click)="changePage('send')">Faire un virement</button>
|
||||||
<button ion-item (click)="changePage('history')">Historique des transactions</button>
|
<button ion-item (click)="changePage('history')">Historique des transactions</button>
|
||||||
|
<button ion-item (click)="closeConnexion()">Se déconnecter</button>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<ion-header>
|
<ion-header>
|
||||||
|
|
||||||
<ion-navbar>
|
<ion-navbar>
|
||||||
<ion-title>transactions</ion-title>
|
<ion-title>Dernières transactions</ion-title>
|
||||||
</ion-navbar>
|
</ion-navbar>
|
||||||
|
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
@ -28,4 +28,70 @@
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
|
||||||
|
<ion-card>
|
||||||
|
|
||||||
|
<ion-item>
|
||||||
|
<h2>Virement reçu</h2>
|
||||||
|
</ion-item>
|
||||||
|
<ion-card-content>
|
||||||
|
<p>Date : 2 novembre 2018</p>
|
||||||
|
<p>De : Jean-Charles DUTROU</p>
|
||||||
|
<p>Montant : 45 G</p>
|
||||||
|
</ion-card-content>
|
||||||
|
|
||||||
|
</ion-card>
|
||||||
|
|
||||||
|
<ion-card>
|
||||||
|
|
||||||
|
<ion-item>
|
||||||
|
<h2>Virement émis</h2>
|
||||||
|
</ion-item>
|
||||||
|
<ion-card-content>
|
||||||
|
<p>Date : 31 octobre 2018 13:30:03</p>
|
||||||
|
<p>À : Docteur FREUD</p>
|
||||||
|
<p>Montant : 150 G</p>
|
||||||
|
</ion-card-content>
|
||||||
|
|
||||||
|
</ion-card>
|
||||||
|
|
||||||
|
<ion-card>
|
||||||
|
|
||||||
|
<ion-item>
|
||||||
|
<h2>Paiement</h2>
|
||||||
|
</ion-item>
|
||||||
|
<ion-card-content>
|
||||||
|
<p>Date : 30 novembre 2018 22:12:35</p>
|
||||||
|
<p>À : Bar de la CUITTHE</p>
|
||||||
|
<p>Montant : 5 G</p>
|
||||||
|
</ion-card-content>
|
||||||
|
|
||||||
|
</ion-card>
|
||||||
|
|
||||||
|
<ion-card>
|
||||||
|
|
||||||
|
<ion-item>
|
||||||
|
<h2>Paiement</h2>
|
||||||
|
</ion-item>
|
||||||
|
<ion-card-content>
|
||||||
|
<p>Date : 30 novembre 2018 21:23:35</p>
|
||||||
|
<p>À : Bar de la CUITTHE</p>
|
||||||
|
<p>Montant : 5 G</p>
|
||||||
|
</ion-card-content>
|
||||||
|
|
||||||
|
</ion-card>
|
||||||
|
|
||||||
|
<ion-card>
|
||||||
|
|
||||||
|
<ion-item>
|
||||||
|
<h2>Paiement</h2>
|
||||||
|
</ion-item>
|
||||||
|
<ion-card-content>
|
||||||
|
<p>Date : 30 novembre 2018 20:45:35</p>
|
||||||
|
<p>À : Bar de la CUITTHE</p>
|
||||||
|
<p>Montant : 5 G</p>
|
||||||
|
</ion-card-content>
|
||||||
|
|
||||||
|
</ion-card>
|
||||||
|
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
Loading…
Reference in a new issue