Repository: fossasia/open-event-server

Issue:
Set default value of amount in orders to 0
**Describe the bug**
<!-- A clear and concise description of what the bug is. -->
In free orders, the amount being set is null , which should be defaulted to 0 in such cases

**To Reproduce**
See : fossasia/open-event-android#1728

**Stacktrace**
<!-- If applicable, add stacktrace to help explain your problem. -->
```
com.eventyay.attendee D/OkHttp: {"errors": [{"detail": "Field may not be null.", "source": {"pointer": "/data/attributes/amount"}, "status": "422", "title": "Validation error"}], "jsonapi": {"version": "1.0"}}
2019-05-08 12:42:11.499 23901-24241/com.eventyay.attendee D/OkHttp: <-- END HTTP (177-byte body)
2019-05-08 12:42:11.516 23901-23901/com.eventyay.attendee D/AttendeeViewModel$createOrder: Failed creating Order
    retrofit2.adapter.rxjava2.HttpException: HTTP 422 UNPROCESSABLE ENTITY
        at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:54)
        at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onNext(BodyObservable.java:37)
        at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:44)
        at io.reactivex.Observable.subscribe(Observable.java:12267)
        at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34)
        at io.reactivex.Observable.subscribe(Observable.java:12267)
        at io.reactivex.internal.operators.observable.ObservableSingleSingle.subscribeActual(ObservableSingleSingle.java:35)
        at io.reactivex.Single.subscribe(Single.java:3603)
        at io.reactivex.internal.operators.single.SingleMap.subscribeActual(SingleMap.java:34)
        at io.reactivex.Single.subscribe(Single.java:3603)
        at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
        at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:578)
        at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
        at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:760)
```

**Additional details (please complete the following information):**
 - OS: [e.g. MacOS, Ubuntu, CentOS] Ubuntu 16.04
 - Python Version [e.g. `3.5`, `3.6`] 3.6

**Additional context**
<!-- Add any other context about the problem here. -->
Working on it


Discussion:

Resolving patch:
diff --git a/app/api/schema/orders.py b/app/api/schema/orders.py
--- a/app/api/schema/orders.py
+++ b/app/api/schema/orders.py
@@ -47,7 +47,7 @@ def initial_values(self, data):
 
     id = fields.Str(dump_only=True)
     identifier = fields.Str(dump_only=True)
-    amount = fields.Float(validate=lambda n: n >= 0, allow_none=False)
+    amount = fields.Float(validate=lambda n: n >= 0, allow_none=False, default=0)
     address = fields.Str(allow_none=True)
     city = fields.Str(allow_none=True)
     state = fields.Str(db.String, allow_none=True)


Test patch: