| Conditions | 1 |
| Paths | 1 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | 1 | public function handle(Events\Base $event) |
|
| 43 | { |
||
| 44 | 1 | $data = $event->data; |
|
| 45 | |||
| 46 | // now this code only convert state into deactivated |
||
| 47 | // you may want to do something special to your project |
||
| 48 | // for instance you may want to turn subscription into free local package |
||
| 49 | 1 | $subscription = Subscription::where('fastspring_id', $data['id'])->firstOrFail(); |
|
| 50 | |||
| 51 | // fill |
||
| 52 | 1 | $subscription->user_id = $this->getUserByFastspringId($data['account']['id'])->id; |
|
| 53 | 1 | $subscription->plan = $data['product']['product']; |
|
| 54 | 1 | $subscription->state = $data['state']; |
|
| 55 | 1 | $subscription->currency = $data['currency']; |
|
| 56 | 1 | $subscription->quantity = $data['quantity']; |
|
| 57 | |||
| 58 | // save |
||
| 59 | 1 | $subscription->save(); |
|
| 60 | 1 | } |
|
| 62 |