mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 06:47:30 -05:00 
			
		
		
		
	Updates for importing Sepa Debit payment methods
This commit is contained in:
		
							parent
							
								
									6d2709e671
								
							
						
					
					
						commit
						c65cfcb31b
					
				@ -73,6 +73,18 @@ class UpdatePaymentMethods
 | 
				
			|||||||
            $this->addOrUpdateCard($method, $customer->id, $client, GatewayType::SOFORT);
 | 
					            $this->addOrUpdateCard($method, $customer->id, $client, GatewayType::SOFORT);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $sepa_methods = PaymentMethod::all(
 | 
				
			||||||
 | 
					            [
 | 
				
			||||||
 | 
					                    'customer' => $customer->id,
 | 
				
			||||||
 | 
					                    'type' => 'sepa_debit',
 | 
				
			||||||
 | 
					                ],
 | 
				
			||||||
 | 
					            $this->stripe->stripe_connect_auth
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        foreach ($sepa_methods as $method) {
 | 
				
			||||||
 | 
					            $this->addOrUpdateCard($method, $customer->id, $client, GatewayType::SEPA);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->importBankAccounts($customer, $client);
 | 
					        $this->importBankAccounts($customer, $client);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        $this->importPMBankAccounts($customer, $client);
 | 
					        $this->importPMBankAccounts($customer, $client);
 | 
				
			||||||
@ -189,7 +201,7 @@ class UpdatePaymentMethods
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Ignore Expired cards */
 | 
					        /* Ignore Expired cards */
 | 
				
			||||||
        if ($method->card->exp_year <= date('Y') && $method->card->exp_month < date('m')) {
 | 
					        if ($method->card && $method->card->exp_year <= date('Y') && $method->card->exp_month < date('m')) {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -231,6 +243,15 @@ class UpdatePaymentMethods
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                return new \stdClass;
 | 
					                return new \stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            case GatewayType::SEPA:
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
 | 
					                    $payment_meta = new \stdClass;
 | 
				
			||||||
 | 
					                    $payment_meta->brand = (string) \sprintf('%s (%s)', $method->sepa_debit->bank_code, ctrans('texts.sepa'));
 | 
				
			||||||
 | 
					                    $payment_meta->last4 = (string) $method->sepa_debit->last4;
 | 
				
			||||||
 | 
					                    $payment_meta->state = 'authorized';
 | 
				
			||||||
 | 
					                    $payment_meta->type = GatewayType::SEPA;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					                    return $payment_meta;
 | 
				
			||||||
            default:
 | 
					            default:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user