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

View File

@ -33,7 +33,7 @@
<td class="pl-3">{{total() | currency}}</td> <td class="pl-3">{{total() | currency}}</td>
</tr> </tr>
</table> </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> </div>
</mat-card> </mat-card>
</div> </div>