disable button until items are in cart

This commit is contained in:
Zakary Timson 2018-07-23 11:19:56 -04:00
parent 88dd66188e
commit 9645a6b81f
2 changed files with 5 additions and 3 deletions

View File

@ -19,8 +19,8 @@ export const checkout = functions.https.onRequest((request, response) => {
intent: 'sale',
payer: {payment_method: 'paypal'},
redirect_urls: {
return_url: 'https://fhsons.zakscode.com/success',
cancel_url: 'https://fhsons.zakscode.com/cart'
return_url: 'https://fhsons.zakscode.com/cart/success',
cancel_url: 'https://fhsons.zakscode.com/cart/cancelled'
},
transactions: [
{
@ -52,6 +52,8 @@ export const checkout = functions.https.onRequest((request, response) => {
return acc + row.price * row.quantity;
}, 0);
console.info(req);
// Send request to PayPal
let create = new Promise((res, rej) => {
paypal.payment.create(req, (error, payment) => {

View File

@ -33,7 +33,7 @@
<td class="pl-3">{{total() | currency}}</td>
</tr>
</table>
<button mat-raised-button class="float-right mt-3" color="primary" (click)="checkout()">Checkout</button>
<button mat-raised-button class="float-right mt-3" color="primary" (click)="checkout()" [disabled]="total() <= 0">Checkout</button>
</div>
</mat-card>
</div>